# HG changeset patch # User wenzelm # Date 1660728490 -7200 # Node ID ee2f93fa244033a996448a2431a0bf03a578af90 # Parent e7b04452eef36b078080ae494add05fd75de3e2c proper Java/Scala compiler classpath (amending b42e20adaeed): ISABELLE_SETUP_CLASSPATH must not be included prematurely (breaks on Windows), instead use runtime Classpath().jars; diff -r e7b04452eef3 -r ee2f93fa2440 Admin/components/components.sha1 --- a/Admin/components/components.sha1 Tue Aug 16 17:24:58 2022 +0200 +++ b/Admin/components/components.sha1 Wed Aug 17 11:28:10 2022 +0200 @@ -153,6 +153,7 @@ 91c5d29e9fa40aee015e8e65ffea043e218c2fc5 isabelle_setup-20220323.tar.gz 056979bd1c08eb9d0d12cc1118b4ff70bfe2d594 isabelle_setup-20220701.tar.gz be91402b3e5ef5bc6d4802a45175ee238cd9653e isabelle_setup-20220808.tar.gz +171df3eb58bdac4cc495f773b797fa578f7d4be6 isabelle_setup-20220817.tar.gz 0b2206f914336dec4923dd0479d8cee4b904f544 jdk-11+28.tar.gz e12574d838ed55ef2845acf1152329572ab0cc56 jdk-11.0.10+9.tar.gz 3e05213cad47dbef52804fe329395db9b4e57f39 jdk-11.0.2+9.tar.gz diff -r e7b04452eef3 -r ee2f93fa2440 Admin/components/main --- a/Admin/components/main Tue Aug 16 17:24:58 2022 +0200 +++ b/Admin/components/main Wed Aug 17 11:28:10 2022 +0200 @@ -9,7 +9,7 @@ flatlaf-2.4 idea-icons-20210508 isabelle_fonts-20211004 -isabelle_setup-20220808 +isabelle_setup-20220817 jdk-17.0.2+8 jedit-20211103 jfreechart-1.5.3 diff -r e7b04452eef3 -r ee2f93fa2440 src/Pure/Tools/scala_build.scala --- a/src/Pure/Tools/scala_build.scala Tue Aug 16 17:24:58 2022 +0200 +++ b/src/Pure/Tools/scala_build.scala Wed Aug 17 11:28:10 2022 +0200 @@ -10,6 +10,7 @@ import java.util.{Properties => JProperties} import java.io.{ByteArrayOutputStream, PrintStream} import java.nio.file.Files +import java.nio.file.{Path => JPath} import scala.jdk.CollectionConverters._ @@ -39,15 +40,22 @@ p <- java_context.requirement_paths(s).asScala.iterator } yield (File.path(p.toFile))).toList - def build(fresh: Boolean = false): String = { + def build( + classpath: List[Path] = Path.split(Isabelle_System.getenv("ISABELLE_CLASSPATH")), + fresh: Boolean = false + ): String = { + val java_classpath = new java.util.LinkedList[JPath] + classpath.foreach(path => java_classpath.add(path.java_path)) + val output0 = new ByteArrayOutputStream val output = new PrintStream(output0) def get_output(): String = { output.flush() Library.trim_line(output0.toString(UTF8.charset)) } + try { - isabelle.setup.Build.build(output, java_context, fresh) + isabelle.setup.Build.build(java_classpath, output, java_context, fresh) get_output() } catch { case ERROR(msg) => cat_error(get_output(), msg) } @@ -87,7 +95,7 @@ Isabelle_System.with_tmp_file("result", "jar") { tmp_file => val output = context(dir, component = component, no_title = true, do_build = true, - module = Some(tmp_file)).build() + module = Some(tmp_file)).build(classpath = Classpath().jars.map(File.path)) val jar_bytes = Bytes.read(tmp_file) val jar_path = context(dir, component = component).module_result Result(output, jar_bytes, jar_path) diff -r e7b04452eef3 -r ee2f93fa2440 src/Tools/Setup/src/Build.java --- a/src/Tools/Setup/src/Build.java Tue Aug 16 17:24:58 2022 +0200 +++ b/src/Tools/Setup/src/Build.java Wed Aug 17 11:28:10 2022 +0200 @@ -450,7 +450,7 @@ /** build **/ - public static void build(PrintStream output, Context context, boolean fresh) + public static void build(List classpath, PrintStream output, Context context, boolean fresh) throws NoSuchAlgorithmException, IOException, InterruptedException { String module = context.module_result(); @@ -492,18 +492,11 @@ output.print("### Building " + title + " (" + jar_path + ") ...\n"); } - String classpath1 = Environment.getenv("ISABELLE_CLASSPATH"); - String classpath2 = Environment.getenv("ISABELLE_SETUP_CLASSPATH"); - Path build_dir = Files.createTempDirectory("isabelle"); try { /* compile sources */ - for (String s : (classpath1 + ":" + classpath2).split(":", -1)) { - if (!s.isEmpty()) { - compiler_deps.add(Path.of(Environment.platform_path(s))); - } - } + compiler_deps.addAll(classpath); List compiler_sources = new LinkedList(); for (String s : sources) { compiler_sources.add(context.path(s)); } @@ -563,8 +556,15 @@ public static void build_components(PrintStream output, boolean fresh) throws NoSuchAlgorithmException, IOException, InterruptedException { + List classpath = new LinkedList(); + for (String s : Environment.getenv("ISABELLE_CLASSPATH").split(":", -1)) { + if (!s.isEmpty()) { + classpath.add(Path.of(Environment.platform_path(s))); + } + } + for (Context context : component_contexts()) { - build(output, context, fresh); + build(classpath, output, context, fresh); } } }