# HG changeset patch # User sundar # Date 1470139430 -19800 # Node ID 0fc6d1871da68810fcfbf8f6ac61bda0834bd7f1 # Parent e613affb88d178dc7c589f1679db113d589bddb4 8159487: Add JAVA_VERSION, OS_NAME, OS_ARCH properties in release file Reviewed-by: jlaskey diff -r e613affb88d1 -r 0fc6d1871da6 jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java Wed Jul 05 22:01:28 2017 +0200 +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java Tue Aug 02 17:33:50 2016 +0530 @@ -228,6 +228,7 @@ desc.osName().ifPresent(s -> props.setProperty("OS_NAME", s)); desc.osVersion().ifPresent(s -> props.setProperty("OS_VERSION", s)); desc.osArch().ifPresent(s -> props.setProperty("OS_ARCH", s)); + props.setProperty("JAVA_VERSION", System.getProperty("java.version")); }); Optional release = pool.findEntry("/java.base/release"); diff -r e613affb88d1 -r 0fc6d1871da6 jdk/test/tools/jlink/IntegrationTest.java --- a/jdk/test/tools/jlink/IntegrationTest.java Wed Jul 05 22:01:28 2017 +0200 +++ b/jdk/test/tools/jlink/IntegrationTest.java Tue Aug 02 17:33:50 2016 +0530 @@ -22,6 +22,7 @@ */ import java.io.File; +import java.io.FileReader; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; @@ -33,6 +34,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import java.util.function.Function; import jdk.tools.jlink.Jlink; @@ -203,6 +205,27 @@ throw new AssertionError("release not generated"); } + Properties props = new Properties(); + try (FileReader reader = new FileReader(release)) { + props.load(reader); + } + + if (props.getProperty("JAVA_VERSION") == null) { + throw new AssertionError("release file does not contain JAVA_VERSION"); + } + + if (props.getProperty("OS_NAME") == null) { + throw new AssertionError("release file does not contain OS_NAME"); + } + + if (props.getProperty("OS_ARCH") == null) { + throw new AssertionError("release file does not contain OS_ARCH"); + } + + if (props.getProperty("OS_VERSION") == null) { + throw new AssertionError("release file does not contain OS_VERSION"); + } + if (!Files.exists(output.resolve("toto.txt"))) { throw new AssertionError("Post processing not called"); }