diff --git a/.blaze/blaze.conf b/.blaze/blaze.conf new file mode 100644 index 0000000..ee2682c --- /dev/null +++ b/.blaze/blaze.conf @@ -0,0 +1,5 @@ +blaze.dependencies = [ + "com.fizzed:jne:4.1.1" +] + +java.source.version = 8 \ No newline at end of file diff --git a/.blaze/blaze.java b/.blaze/blaze.java new file mode 100644 index 0000000..d476af6 --- /dev/null +++ b/.blaze/blaze.java @@ -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 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)); + } + +} \ No newline at end of file diff --git a/.blaze/pom.xml b/.blaze/pom.xml new file mode 100644 index 0000000..cfa9dbe --- /dev/null +++ b/.blaze/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + blaze + bigmap-blaze + 0.0.1 + + + + + 8 + 8 + true + true + + + ${project.basedir} + + + + com.fizzed + blaze-ivy + 1.5.0 + + + commons-io + commons-io + 2.11.0 + + + org.slf4j + slf4j-api + 2.0.7 + + + com.typesafe + config + 1.3.0 + + + org.apache.ivy + ivy + 2.5.2 + + + com.fizzed + blaze-core + 1.5.0 + + + org.slf4j + slf4j-simple + 2.0.7 + + + org.zeroturnaround + zt-exec + 1.12 + + + com.fizzed + jne + 4.1.1 + + + \ No newline at end of file diff --git a/blaze.jar b/blaze.jar new file mode 100644 index 0000000..5acc29e Binary files /dev/null and b/blaze.jar differ