-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New build system for cross-JDK testing
- Loading branch information
Showing
4 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
blaze.dependencies = [ | ||
"com.fizzed:jne:4.1.1" | ||
] | ||
|
||
java.source.version = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import com.fizzed.blaze.Config; | ||
import com.fizzed.blaze.Contexts; | ||
import com.fizzed.blaze.Task; | ||
import com.fizzed.jne.HardwareArchitecture; | ||
import com.fizzed.jne.JavaHome; | ||
import com.fizzed.jne.JavaHomeFinder; | ||
import org.slf4j.Logger; | ||
|
||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static com.fizzed.blaze.Contexts.withBaseDir; | ||
import static com.fizzed.blaze.Systems.exec; | ||
import static java.util.Arrays.asList; | ||
import static java.util.Optional.ofNullable; | ||
|
||
public class blaze { | ||
|
||
private final Logger log = Contexts.logger(); | ||
private final Config config = Contexts.config(); | ||
private final Path projectDir = withBaseDir("../").toAbsolutePath(); | ||
|
||
@Task(order = 1) | ||
public void test() throws Exception { | ||
final Integer jdkVersion = this.config.value("jdk.version", Integer.class).orNull(); | ||
final HardwareArchitecture jdkArch = ofNullable(this.config.value("jdk.arch").orNull()) | ||
.map(HardwareArchitecture::resolve) | ||
.orElse(null); | ||
|
||
final long start = System.currentTimeMillis(); | ||
final JavaHome jdkHome = new JavaHomeFinder() | ||
.jdk() | ||
.version(jdkVersion) | ||
.hardwareArchitecture(jdkArch) | ||
.preferredDistributions() | ||
.sorted(jdkVersion != null || jdkArch != null) // sort if any criteria provided | ||
.find(); | ||
|
||
log.info(""); | ||
log.info("Detected {} (in {} ms)", jdkHome, (System.currentTimeMillis()-start)); | ||
log.info(""); | ||
|
||
exec("mvn", "clean", "test") | ||
.workingDir(this.projectDir) | ||
.env("JAVA_HOME", jdkHome.getDirectory().toString()) | ||
.verbose() | ||
.run(); | ||
} | ||
|
||
@Task(order = 2) | ||
public void test_all_jdks() throws Exception { | ||
// collect and find all the jdks we will test on | ||
final List<JavaHome> jdks = new ArrayList<>(); | ||
for (int jdkVersion : asList(21, 17, 11, 8)) { | ||
jdks.add(new JavaHomeFinder() | ||
.jdk() | ||
.version(jdkVersion) | ||
.preferredDistributions() | ||
.sorted() | ||
.find()); | ||
} | ||
|
||
log.info("Detected JDKs:"); | ||
jdks.forEach(jdk -> log.info(" {}", jdk)); | ||
|
||
for (JavaHome jdk : jdks) { | ||
try { | ||
log.info(""); | ||
log.info("Using JDK {}", jdk); | ||
log.info(""); | ||
|
||
exec("mvn", "clean", "test") | ||
.workingDir(this.projectDir) | ||
.env("JAVA_HOME", jdk.getDirectory().toString()) | ||
.verbose() | ||
.run(); | ||
} catch (Exception e) { | ||
log.error(""); | ||
log.error("Failed on JDK " + jdk); | ||
log.error(""); | ||
throw e; | ||
} | ||
} | ||
|
||
log.info("Success on JDKs:"); | ||
jdks.forEach(jdk -> log.info(" {}", jdk)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>blaze</groupId> | ||
<artifactId>bigmap-blaze</artifactId> | ||
<version>0.0.1</version> | ||
|
||
<!-- | ||
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! | ||
Edit or create a <blaze-script>.conf file, and re-run the generate-maven-project command. | ||
--> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<maven.install.skip>true</maven.install.skip> | ||
<maven.deploy.skip>true</maven.deploy.skip> | ||
</properties> | ||
<build> | ||
<sourceDirectory>${project.basedir}</sourceDirectory> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.fizzed</groupId> | ||
<artifactId>blaze-ivy</artifactId> | ||
<version>1.5.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.11.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>2.0.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.typesafe</groupId> | ||
<artifactId>config</artifactId> | ||
<version>1.3.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.ivy</groupId> | ||
<artifactId>ivy</artifactId> | ||
<version>2.5.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fizzed</groupId> | ||
<artifactId>blaze-core</artifactId> | ||
<version>1.5.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>2.0.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.zeroturnaround</groupId> | ||
<artifactId>zt-exec</artifactId> | ||
<version>1.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fizzed</groupId> | ||
<artifactId>jne</artifactId> | ||
<version>4.1.1</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |