Skip to content

Commit

Permalink
Pass current artifact versions to test projects
Browse files Browse the repository at this point in the history
  • Loading branch information
sormuras committed May 26, 2018
1 parent 92dc2cd commit 7114328
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ on GitHub.

* New overloaded variant of `isAnnotated()` in `AnnotationSupport` that accepts
`Optional<? extends AnnotatedElement>` instead of `AnnotatedElement`.
* New integration test sub-project `platform-tooling-support-tests` added. Set system
property `platform.tooling.support.tests.enabled` to `true` to activate it in the
main build process.

[[release-notes-5.3.0-M1-junit-jupiter]]
=== JUnit Jupiter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ test {
// The standalone artifact is needed by Ant projects using its native <junitlauncher> task
dependsOn project(':junit-platform-console-standalone').jar

// Pass versions to tests as system properties
systemProperty 'JUNIT_JUPITER_VERSION', version
systemProperty 'JUNIT_VINTAGE_VERSION', vintageVersion
systemProperty 'JUNIT_PLATFORM_VERSION', platformVersion

useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@ plugins {
// don't use `build` as target to prevent Jenkins picking up
project.buildDir = 'bin'

// grab jupiter version from system environment
def jupiterVersion = System.getenv('JUNIT_JUPITER_VERSION')
def vintageVersion = System.getenv('JUNIT_VINTAGE_VERSION')
def platformVersion = System.getenv('JUNIT_PLATFORM_VERSION')

// emit default file encoding to a file
file('file.encoding.txt').write(System.getProperty('file.encoding'))
file('junit.versions.txt').write("""
jupiterVersion=${jupiterVersion}
vintageVersion=${vintageVersion}
platformVersion=${platformVersion}
""")

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.0-SNAPSHOT')
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiterVersion}")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@ plugins {
// don't use `build` as target to prevent Jenkins picking up
project.buildDir = 'bin'

// grab jupiter version from system environment
def jupiterVersion = System.getenv('JUNIT_JUPITER_VERSION')
def vintageVersion = System.getenv('JUNIT_VINTAGE_VERSION')
def platformVersion = System.getenv('JUNIT_PLATFORM_VERSION')

// emit default file encoding to a file
file('file.encoding.txt').write(System.getProperty('file.encoding'))
file('junit.versions.txt').write("""
jupiterVersion=${jupiterVersion}
vintageVersion=${vintageVersion}
platformVersion=${platformVersion}
""")

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.0-SNAPSHOT')
testImplementation('org.junit.jupiter:junit-jupiter-params:5.3.0-SNAPSHOT')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.3.0-SNAPSHOT')
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiterVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${jupiterVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}")
}

test {
Expand Down
4 changes: 2 additions & 2 deletions platform-tooling-support-tests/projects/maven-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>10</java.version>
<junit.jupiter.version>5.3.0-SNAPSHOT</junit.jupiter.version>
<junit.platform.version>1.3.0-SNAPSHOT</junit.platform.version>
<junit.jupiter.version>${env.JUNIT_JUPITER_VERSION}</junit.jupiter.version>
<junit.platform.version>${env.JUNIT_PLATFORM_VERSION}</junit.platform.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public BuildResult run(BuildRequest request) throws Exception {
.directory(workspace.toFile()) //
.redirectOutput(result.out.toFile()) //
.redirectError(result.err.toFile());
setEnv(builder, "JUNIT_JUPITER_VERSION");
setEnv(builder, "JUNIT_VINTAGE_VERSION");
setEnv(builder, "JUNIT_PLATFORM_VERSION");
var process = builder.start();
result.status = process.waitFor();
var encoding = workspace.resolve("file.encoding.txt");
Expand All @@ -120,4 +123,8 @@ public BuildResult run(BuildRequest request) throws Exception {
}
return result;
}

private void setEnv(ProcessBuilder builder, String key) {
builder.environment().put(key, System.getProperty(key));
}
}

0 comments on commit 7114328

Please sign in to comment.