merged
authornipkow
Wed, 12 May 2021 06:35:16 +0200
changeset 73679 71c45d60a90a
parent 73677 73c50ce808ed (diff)
parent 73678 78929c029785 (current diff)
child 73680 50437744eb1c
child 73684 a63d76ba0a03
merged
--- a/src/Pure/Tools/scala_project.scala	Tue May 11 22:40:59 2021 +0200
+++ b/src/Pure/Tools/scala_project.scala	Wed May 12 06:35:16 2021 +0200
@@ -66,16 +66,14 @@
         else map
     }
 
-  val isabelle_dirs: List[(String, Path)] =
-    List(
-      "src/Pure/" -> Path.explode("isabelle"),
-      "src/Tools/Graphview/" -> Path.explode("isabelle.graphview"),
-      "src/Tools/VSCode/" -> Path.explode("isabelle.vscode"),
-      "src/Tools/jEdit/src-base/" -> Path.explode("isabelle.jedit_base"),
-      "src/Tools/jEdit/src/" -> Path.explode("isabelle.jedit"),
-      "src/HOL/SPARK/Tools" -> Path.explode("isabelle.spark"),
-      "src/HOL/Tools/ATP" -> Path.explode("isabelle.atp"),
-      "src/HOL/Tools/Nitpick" -> Path.explode("isabelle.nitpick"))
+  private def guess_package(path: Path): String =
+  {
+    val lines = split_lines(File.read(path))
+    val Package = """\bpackage\b +(?:object +)?\b((?:\w|\.)+)\b""".r
+
+    lines.collectFirst({ case Package(name) => name }) getOrElse
+      error("Failed to guess package from " + path)
+  }
 
 
   /* compile-time position */
@@ -123,12 +121,8 @@
     isabelle_scala_files
 
     for (file <- files if file.endsWith(".scala")) {
-      val (path, target) =
-        isabelle_dirs.collectFirst({
-          case (prfx, p) if file.startsWith(prfx) =>
-            (Path.ISABELLE_HOME + Path.explode(file), scala_src_dir + p)
-        }).getOrElse(error("Unknown directory prefix for " + quote(file)))
-
+      val path = Path.ISABELLE_HOME + Path.explode(file)
+      val target = scala_src_dir + Path.basic(guess_package(path))
       Isabelle_System.make_directory(target)
       if (symlinks) Isabelle_System.symlink(path, target)
       else Isabelle_System.copy_file(path, target)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/.name	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,1 @@
+isabelle-setup
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/artifacts/Setup_jar.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,8 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="Setup:jar">
+    <output-path>$PROJECT_DIR$/out/artifacts/</output-path>
+    <root id="archive" name="Setup.jar">
+      <element id="module-output" name="Setup" />
+    </root>
+  </artifact>
+</component>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/codeStyles/Project.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,9 @@
+<component name="ProjectCodeStyleConfiguration">
+  <code_scheme name="Project" version="173">
+    <option name="LINE_SEPARATOR" value="&#10;" />
+    <option name="SOFT_MARGINS" value="100" />
+    <codeStyleSettings language="Scala">
+      <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
+    </codeStyleSettings>
+  </code_scheme>
+</component>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/codeStyles/codeStyleConfig.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,5 @@
+<component name="ProjectCodeStyleConfiguration">
+  <state>
+    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
+  </state>
+</component>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/misc.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/modules.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/Setup.iml" filepath="$PROJECT_DIR$/Setup.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/sbt.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ScalaSbtSettings">
+    <option name="customVMPath" />
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/vcs.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/../../.." vcs="hg4idea" />
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/.idea/workspace.xml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ArtifactsWorkspaceSettings">
+    <artifacts-to-build>
+      <artifact name="Setup:jar" />
+    </artifacts-to-build>
+  </component>
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="a00f79eb-e202-4706-95b3-a972b05b3ddb" name="Default Changelist" comment="" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="CodeStyleSettingsInfer">
+    <option name="done" value="true" />
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Class" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectCodeStyleSettingsMigration">
+    <option name="version" value="1" />
+  </component>
+  <component name="ProjectId" id="1sP6lEsakYWhAQI9WzuHpAcovaN" />
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent">
+    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
+    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
+    <property name="project.structure.last.edited" value="Artifacts" />
+    <property name="project.structure.proportion" value="0.15" />
+    <property name="project.structure.side.proportion" value="0.18055555" />
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="a00f79eb-e202-4706-95b3-a972b05b3ddb" name="Default Changelist" comment="" />
+      <created>1620762028428</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1620762028428</updated>
+    </task>
+    <servers />
+  </component>
+  <component name="hg4idea.settings">
+    <option name="CHECK_INCOMING_OUTGOING" value="true" />
+    <option name="RECENT_HG_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
+  </component>
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/Setup.iml	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/src/META-INF/MANIFEST.MF	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: isabelle.setup.Setup
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/Setup/src/isabelle/setup/Setup.java	Wed May 12 06:35:16 2021 +0200
@@ -0,0 +1,15 @@
+/*  Title:      Tools/Setup/isabelle/setup/Setup.java
+    Author:     Makarius
+
+Isabelle setup tool: bootstrap from generic Java environment.
+*/
+
+package isabelle.setup;
+
+class Setup
+{
+    public static void main(String[] args)
+    {
+        System.out.println("Isabelle setup");
+    }
+}