clarified signature;
authorwenzelm
Wed, 27 Mar 2024 17:04:37 +0100
changeset 80038 b1e2246147eb
parent 80033 71d005ffa9fe
child 80039 0732ee5c8ee1
clarified signature;
src/Pure/System/platform.scala
src/Pure/Tools/dotnet_setup.scala
src/Pure/Tools/go_setup.scala
--- a/src/Pure/System/platform.scala	Wed Mar 27 15:38:41 2024 +0100
+++ b/src/Pure/System/platform.scala	Wed Mar 27 17:04:37 2024 +0100
@@ -81,6 +81,17 @@
 
   /* platform info */
 
+  object Info {
+    def check(infos: List[Info], spec: String): String = {
+      val specs = Library.distinct(infos.map(_.family_name) ::: infos.map(_.platform))
+      if (specs.contains(spec)) spec
+      else {
+        error("Bad platform specification " + quote(spec) +
+          "\n  expected " + commas_quote(specs))
+      }
+    }
+  }
+
   trait Info {
     def platform: String
     override def toString: String = platform
@@ -97,15 +108,6 @@
     def is(spec: String): Boolean = platform == spec || family_name == spec
   }
 
-  def check_spec(infos: List[Info], spec: String): String = {
-    val specs = Library.distinct(infos.map(_.family_name) ::: infos.map(_.platform))
-    if (specs.contains(spec)) spec
-    else {
-      error("Bad platform specification " + quote(spec) +
-        "\n  expected " + commas_quote(specs))
-    }
-  }
-
 
   /* JVM version */
 
--- a/src/Pure/Tools/dotnet_setup.scala	Wed Mar 27 15:38:41 2024 +0100
+++ b/src/Pure/Tools/dotnet_setup.scala	Wed Mar 27 17:04:37 2024 +0100
@@ -30,8 +30,7 @@
         exec = "powershell -ExecutionPolicy ByPass",
         check = () => Isabelle_System.require_command("powershell", "-NoProfile -Command Out-Null")))
 
-  def check_platform_spec(spec: String): String =
-    Platform.check_spec(all_platforms, spec)
+  def check_platform(spec: String): String = Platform.Info.check(all_platforms, spec)
 
 
   /* dotnet download and setup */
@@ -51,7 +50,7 @@
     dry_run: Boolean = false,
     progress: Progress = new Progress
   ): Unit = {
-    platforms.foreach(check_platform_spec)
+    platforms.foreach(check_platform)
 
 
     /* component directory */
@@ -171,7 +170,7 @@
           "V:" -> (arg => version = arg),
           "f" -> (_ => force = true),
           "n" -> (_ => dry_run = true),
-          "p:" -> (arg => platforms = space_explode(',', arg).map(check_platform_spec)),
+          "p:" -> (arg => platforms = space_explode(',', arg).map(check_platform)),
           "v" -> (_ => verbose = true))
 
         val more_args = getopts(args)
--- a/src/Pure/Tools/go_setup.scala	Wed Mar 27 15:38:41 2024 +0100
+++ b/src/Pure/Tools/go_setup.scala	Wed Mar 27 17:04:37 2024 +0100
@@ -28,8 +28,7 @@
       Platform_Info("x86_64-linux", "linux_amd64"),
       Platform_Info("x86_64-windows", "windows_amd64"))
 
-  def check_platform_spec(spec: String): String =
-    Platform.check_spec(all_platforms, spec)
+  def check_platform(spec: String): String = Platform.Info.check(all_platforms, spec)
 
 
   /* Go download and setup */
@@ -48,7 +47,7 @@
     progress: Progress = new Progress,
     force: Boolean = false
   ): Unit = {
-    platforms.foreach(check_platform_spec)
+    platforms.foreach(check_platform)
 
 
     /* component directory */
@@ -159,7 +158,7 @@
           "U:" -> (arg => base_url = arg),
           "V:" -> (arg => version = arg),
           "f" -> (_ => force = true),
-          "p:" -> (arg => platforms = space_explode(',', arg).map(check_platform_spec)))
+          "p:" -> (arg => platforms = space_explode(',', arg).map(check_platform)))
 
         val more_args = getopts(args)
         if (more_args.nonEmpty) getopts.usage()