Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): spring-boot-starter-test默认依赖由ihub-test插件转移至ihub-spring #747

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023 the original author or authors.
* Copyright (c) 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@ import org.springframework.boot.gradle.tasks.run.BootRun
import pub.ihub.plugin.IHubPlugin
import pub.ihub.plugin.IHubPluginsExtension
import pub.ihub.plugin.IHubProjectPluginAware
import pub.ihub.plugin.bom.IHubBomExtension
import pub.ihub.plugin.java.IHubJavaPlugin

import static org.springframework.boot.buildpack.platform.build.PullPolicy.IF_NOT_PRESENT
Expand All @@ -40,6 +41,10 @@ class IHubBootPlugin extends IHubProjectPluginAware<IHubBootExtension> {

@Override
void apply() {
withExtension(IHubBomExtension).dependencies {
testImplementation 'org.spockframework:spock-spring'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-test'
}
withExtension(AFTER) { ext ->
withTask(BootRun) {
ext.systemProperties it, '.boot-java-local.properties'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023 the original author or authors.
* Copyright (c) 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,6 +37,8 @@ class IHubBootPluginTest extends IHubSpecification {
def result = gradleBuilder.build()

then: '检查结果'
result.output.contains '│ testImplementation │ org.spockframework:spock-spring │'
result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │'
result.output.contains 'BUILD SUCCESSFUL'

when: '构建项目'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class IHubTestPlugin extends IHubProjectPluginAware<IHubTestExtension> {
(SPOCK) : { IHubBomExtension iHubBom ->
applyPlugin GroovyPlugin
iHubBom.dependencies {
testImplementation 'org.spockframework:spock-spring'
testRuntimeOnly 'com.athaydes:spock-reports', 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.spockframework:spock-core'
testRuntimeOnly 'com.athaydes:spock-reports'
}
},
(JUNIT_JUPITER): { IHubBomExtension iHubBom ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class IHubVerificationPluginTest extends IHubSpecification {
result = gradleBuilder.withArguments('-DiHubTest.runSkippedPropNames=java.endorsed.dirs').build()

then: '检查结果'
!result.output.contains('│ testImplementation │ org.spockframework:spock-spring │')
!result.output.contains('│ testRuntimeOnly │ com.athaydes:spock-reports')
!result.output.contains('org.spockframework:spock-core')
!result.output.contains('com.athaydes:spock-reports')
result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │'
result.output.contains 'BUILD SUCCESSFUL'

Expand All @@ -113,10 +113,9 @@ class IHubVerificationPluginTest extends IHubSpecification {
result = gradleBuilder.withArguments('-DiHubTest.runIncludePropNames=java.endorsed.dirs').build()

then: '检查结果'
result.output.contains '│ testImplementation │ org.spockframework:spock-spring │'
result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │'
result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │'
result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │'
result.output.contains '│ testImplementation │ org.spockframework:spock-core │'
result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │'
result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │'
result.output.contains 'BUILD SUCCESSFUL'
}

Expand All @@ -137,10 +136,9 @@ class IHubVerificationPluginTest extends IHubSpecification {
def result = gradleBuilder.build()

then: '检查结果'
result.output.contains '│ testImplementation │ org.spockframework:spock-spring │'
result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │'
result.output.contains '│ testRuntimeOnly │ org.springframework.boot:spring-boot-starter-test │'
result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │'
result.output.contains '│ testImplementation │ org.spockframework:spock-core │'
result.output.contains '│ testRuntimeOnly │ com.athaydes:spock-reports │'
result.output.contains '│ pmd │ com.alibaba.p3c:p3c-pmd │'
result.output.contains 'BUILD SUCCESSFUL'
}

Expand Down
Loading