src/Pure/Admin/component_jcef.scala
author wenzelm
Sun, 12 Jan 2025 23:07:50 +0100
changeset 81802 4d78ad5abeca
parent 81736 30ae92baf0c3
permissions -rw-r--r--
merged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
81735
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Admin/component_jcef.scala
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     3
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     4
Build Isabelle component for Java Chromium Embedded Framework (JCEF).
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     5
See also:
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     6
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     7
  - https://github.com/jcefmaven/jcefbuild
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     8
  - https://github.com/chromiumembedded/java-cef
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
     9
*/
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    10
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    11
package isabelle
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    12
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    13
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    14
object Component_JCEF {
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    15
  /* platform information */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    16
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    17
  sealed case class JCEF_Platform(
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    18
    platform_name: String, archive: String, lib: String, library: String)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    19
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    20
  private val linux_library =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    21
    """ISABELLE_JCEF_LIBRARY="$ISABELLE_JCEF_LIB/libcef.so"
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    22
      export LD_LIBRARY_PATH="$ISABELLE_JCEF_LIB:$JAVA_HOME/lib:$LD_LIBRARY_PATH""""
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    23
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    24
  private val macos_library =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    25
    """export JAVA_LIBRARY_PATH="$ISABELLE_JCEF_HOME/bin/jcef_app.app/Contents/Java:$ISABELLE_JCEF_LIB:$JAVA_LIBRARY_PATH""""
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    26
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    27
  private val windows_library =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    28
    """export PATH="$ISABELLE_JCEF_LIB:$PATH""""
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    29
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    30
  val platforms: List[JCEF_Platform] =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    31
    List(
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    32
      JCEF_Platform("x86_64-linux", "linux-amd64.tar.gz", "bin/lib/linux64", linux_library),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    33
      JCEF_Platform("arm64-linux", "linux-arm64.tar.gz", "bin/lib/linux64", linux_library),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    34
      JCEF_Platform("x86_64-darwin", "macosx-amd64.tar.gz",
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    35
        "bin/jcef_app.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries", macos_library),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    36
      JCEF_Platform("arm64-darwin", "macosx-arm64.tar.gz",
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    37
        "bin/jcef_app.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries", macos_library),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    38
      JCEF_Platform("x86_64-windows", "windows-amd64.tar.gz", "bin/lib/win64", windows_library))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    39
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    40
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    41
  /* build JCEF */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    42
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    43
  val default_url = "https://github.com/jcefmaven/jcefbuild/releases/download"
81736
30ae92baf0c3 update to current jcef-1.0.61;
wenzelm
parents: 81735
diff changeset
    44
  val default_version = "1.0.61"
81735
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    45
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    46
  def build_jcef(
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    47
    base_url: String = default_url,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    48
    version: String = default_version,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    49
    target_dir: Path = Path.current,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    50
    progress: Progress = new Progress
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    51
  ): Unit = {
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    52
    /* component name */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    53
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    54
    val component = "jcef-" + version
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    55
    val component_dir =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    56
      Components.Directory(target_dir + Path.basic(component)).create(progress = progress)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    57
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    58
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    59
    /* download and assemble platforms */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    60
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    61
    val platform_settings: List[String] =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    62
      for (platform <- platforms) yield {
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    63
        Isabelle_System.with_tmp_file("archive", ext = "tar.gz") { archive_file =>
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    64
          val url = base_url + "/" + version + "/" + platform.archive
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    65
          Isabelle_System.download_file(url, archive_file, progress = progress)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    66
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    67
          val platform_dir = component_dir.path + Path.explode(platform.platform_name)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    68
          Isabelle_System.make_directory(platform_dir)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    69
          Isabelle_System.gnutar("-xzf " + File.bash_path(archive_file), dir = platform_dir).check
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    70
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    71
          for {
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    72
            file <- File.find_files(platform_dir.file).iterator
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    73
            name = file.getName
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    74
            if File.is_dll(name) || File.is_exe(name)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    75
          } File.set_executable(File.path(file), true)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    76
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    77
          val classpath =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    78
            File.find_files(platform_dir.file, pred = file => File.is_jar(file.getName))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    79
              .flatMap(file => File.relative_path(platform_dir, File.path(file)))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    80
              .map(_.implode).sorted.map(jar => "        " + quote("$ISABELLE_JCEF_HOME/" + jar))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    81
              .mkString(" \\\n")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    82
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    83
          "    " + platform.platform_name + ")\n" +
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    84
          "      " + "classpath \\\n" + classpath + "\n" +
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    85
          "      " + "ISABELLE_JCEF_LIB=\"$ISABELLE_JCEF_HOME/" + platform.lib + "\"\n" +
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    86
          "      " + platform.library + "\n" +
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    87
          "      " + ";;"
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    88
        }
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    89
      }
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    90
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    91
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    92
    /* settings */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    93
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    94
    File.write(component_dir.settings,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    95
      """# -*- shell-script -*- :mode=shellscript:
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    96
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    97
ISABELLE_JCEF_PLATFORM="${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}}"
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    98
if [ -d "$COMPONENT/$ISABELLE_JCEF_PLATFORM" ]
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
    99
then
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   100
  ISABELLE_JCEF_HOME="$COMPONENT/$ISABELLE_JCEF_PLATFORM"
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   101
  ISABELLE_JCEF_LIBRARY=""
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   102
  case "$ISABELLE_JCEF_PLATFORM" in
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   103
""" + cat_lines(platform_settings) + """
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   104
  esac
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   105
fi
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   106
""")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   107
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   108
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   109
    /* README */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   110
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   111
    File.write(component_dir.README,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   112
      """This distribution of Java Chromium Embedded Framework (JCEF)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   113
has been assembled from the binary builds from
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   114
https://github.com/jcefmaven/jcefbuild/releases/tag/""" +version + """
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   115
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   116
Examples invocations:
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   117
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   118
* Command-line
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   119
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   120
  isabelle env bash -c 'isabelle java -Djava.library.path="$(platform_path "$ISABELLE_JCEF_LIB")" tests.detailed.MainFrame'
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   121
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   122
* Scala REPL (e.g. Isabelle/jEdit Console)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   123
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   124
  import isabelle._
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   125
  System.setProperty("java.library.path", File.platform_path(Path.explode("$ISABELLE_JCEF_LIB")))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   126
  org.cef.CefApp.startup(Array())
81736
30ae92baf0c3 update to current jcef-1.0.61;
wenzelm
parents: 81735
diff changeset
   127
  GUI_Thread.later { val frame = new tests.detailed.MainFrame(false, false, false, 60, Array()); frame.setSize(1200,900); frame.setVisible(true) }
81735
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   128
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   129
* Demo websites
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   130
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   131
    https://mozilla.github.io/pdf.js/web/viewer.html
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   132
    https://www.w3schools.com/w3css/w3css_demo.asp
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   133
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   134
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   135
        Makarius
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   136
        """ + Date.Format.date(Date.now()) + "\n")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   137
  }
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   138
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   139
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   140
  /* Isabelle tool wrapper */
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   141
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   142
  val isabelle_tool =
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   143
    Isabelle_Tool("component_jcef", "build component for Java Chromium Embedded Framework",
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   144
      Scala_Project.here,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   145
      { args =>
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   146
        var target_dir = Path.current
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   147
        var base_url = default_url
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   148
        var version = default_version
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   149
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   150
        val getopts = Getopts("""
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   151
Usage: isabelle component_jcef [OPTIONS]
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   152
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   153
  Options are:
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   154
    -D DIR       target directory (default ".")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   155
    -U URL       download URL (default: """" + default_url + """")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   156
    -V VERSION   version (default: """" + default_version + """")
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   157
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   158
  Build component for Java Chromium Embedded Framework.
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   159
""",
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   160
          "D:" -> (arg => target_dir = Path.explode(arg)),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   161
          "U:" -> (arg => base_url = arg),
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   162
          "V:" -> (arg => version = arg))
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   163
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   164
        val more_args = getopts(args)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   165
        if (more_args.nonEmpty) getopts.usage()
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   166
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   167
        val progress = new Console_Progress()
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   168
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   169
        build_jcef(base_url = base_url, version = version, target_dir = target_dir,
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   170
          progress = progress)
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   171
      })
527daf6823fb recovered "isabelle component_jcef" from bf537a75e872, adapted to 9fe5d8c70352 and 2a99fcb283ee;
wenzelm
parents:
diff changeset
   172
}