Skip to content

Commit

Permalink
Add blaze build script command to test against Java 21, 17, 11, and 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Nov 4, 2023
1 parent 19b48ef commit aa46c7d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .blaze/blaze.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
blaze.dependencies = [
"com.fizzed:jne:4.1.1"
]
53 changes: 50 additions & 3 deletions .blaze/blaze.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
import static com.fizzed.blaze.Contexts.fail;
import static com.fizzed.blaze.Contexts.withBaseDir;
import static com.fizzed.blaze.Systems.exec;
import static java.util.Arrays.asList;

import com.fizzed.blaze.Task;
import com.fizzed.blaze.util.Streamables;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.fizzed.jne.JavaHome;
import com.fizzed.jne.JavaHomeFinder;
import org.slf4j.Logger;

public class blaze {
static private final Logger log = Contexts.logger();
static private final Config config = Contexts.config();
private final Logger log = Contexts.logger();
private final Config config = Contexts.config();
private final Path projectDir = withBaseDir("../").toAbsolutePath();

@Task(order=1, value="Demo of parsing a template and logs its structure. Argument of -Drocker.file=<file>")
public void parser() {
Expand Down Expand Up @@ -63,7 +71,46 @@ public void netty() {
"-DskipTests=true", "-Dexec.classpathScope=test",
"-Dexec.mainClass=com.fizzed.rocker.bin.NettyMain").run();
}


@Task(order = 20)
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));
}

@Task(order=99, value="Use by maintainers only. Updates REAME.md with latest git tag.")
public void after_release() throws Exception {
int exitValue = (int)exec("git", "diff-files", "--quiet")
Expand Down
5 changes: 5 additions & 0 deletions .blaze/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@
<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>
2 changes: 1 addition & 1 deletion rocker-test-template/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</dependency>

<!-- test -->

<!---->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down

0 comments on commit aa46c7d

Please sign in to comment.