further jedit build option;
authorwenzelm
Wed Jun 08 21:29:49 2011 +0200 (2011-06-08)
changeset 43285966f359dc724
parent 43284 04d473e883df
child 43286 a319da4fbfb0
further jedit build option;
misc tuning;
src/Pure/build-jars
src/Tools/jEdit/lib/Tools/jedit
     1.1 --- a/src/Pure/build-jars	Wed Jun 08 20:58:51 2011 +0200
     1.2 +++ b/src/Pure/build-jars	Wed Jun 08 21:29:49 2011 +0200
     1.3 @@ -140,7 +140,7 @@
     1.4      fail "Failed to compile sources"
     1.5    mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
     1.6  
     1.7 -  pushd classes
     1.8 +  pushd classes >/dev/null
     1.9  
    1.10    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
    1.11      fail "Failed to produce $PURE_JAR"
     2.1 --- a/src/Tools/jEdit/lib/Tools/jedit	Wed Jun 08 20:58:51 2011 +0200
     2.2 +++ b/src/Tools/jEdit/lib/Tools/jedit	Wed Jun 08 21:29:49 2011 +0200
     2.3 @@ -5,6 +5,34 @@
     2.4  # DESCRIPTION: Isabelle/jEdit interface wrapper
     2.5  
     2.6  
     2.7 +## sources
     2.8 +
     2.9 +declare -a SOURCES=(
    2.10 +  "src/dockable.scala"
    2.11 +  "src/document_model.scala"
    2.12 +  "src/document_view.scala"
    2.13 +  "src/html_panel.scala"
    2.14 +  "src/isabelle_encoding.scala"
    2.15 +  "src/isabelle_hyperlinks.scala"
    2.16 +  "src/isabelle_markup.scala"
    2.17 +  "src/isabelle_options.scala"
    2.18 +  "src/isabelle_sidekick.scala"
    2.19 +  "src/output_dockable.scala"
    2.20 +  "src/plugin.scala"
    2.21 +  "src/protocol_dockable.scala"
    2.22 +  "src/raw_output_dockable.scala"
    2.23 +  "src/scala_console.scala"
    2.24 +  "src/session_dockable.scala"
    2.25 +)
    2.26 +
    2.27 +declare -a PLUGIN_FILES=(
    2.28 +  "plugin/actions.xml"
    2.29 +  "plugin/dockables.xml"
    2.30 +  "plugin/Isabelle.props"
    2.31 +  "plugin/services.xml"
    2.32 +)
    2.33 +
    2.34 +
    2.35  ## diagnostics
    2.36  
    2.37  PRG="$(basename "$0")"
    2.38 @@ -17,7 +45,9 @@
    2.39    echo "  Options are:"
    2.40    echo "    -J OPTION    add JVM runtime option"
    2.41    echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
    2.42 +  echo "    -b           build only"
    2.43    echo "    -d           enable debugger"
    2.44 +  echo "    -f           fresh build"
    2.45    echo "    -j OPTION    add jEdit runtime option"
    2.46    echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
    2.47    echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
    2.48 @@ -44,22 +74,30 @@
    2.49  
    2.50  # options
    2.51  
    2.52 +BUILD_ONLY=false
    2.53 +BUILD_JARS="jars"
    2.54  JEDIT_LOGIC="$ISABELLE_LOGIC"
    2.55  JEDIT_PRINT_MODE=""
    2.56  
    2.57  function getoptions()
    2.58  {
    2.59    OPTIND=1
    2.60 -  while getopts "J:dj:l:m:" OPT
    2.61 +  while getopts "J:bdfj:l:m:" OPT
    2.62    do
    2.63      case "$OPT" in
    2.64        J)
    2.65          JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
    2.66          ;;
    2.67 +      b)
    2.68 +        BUILD_ONLY=true
    2.69 +        ;;
    2.70        d)
    2.71          JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
    2.72          JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
    2.73          ;;
    2.74 +      f)
    2.75 +        BUILD_JARS="jars_fresh"
    2.76 +        ;;
    2.77        j)
    2.78          ARGS["${#ARGS[@]}"]="$OPTARG"
    2.79          ;;
    2.80 @@ -103,35 +141,7 @@
    2.81  
    2.82  ## dependencies
    2.83  
    2.84 -pushd "$JEDIT_HOME" || failed
    2.85 -
    2.86 -
    2.87 -# sources
    2.88 -
    2.89 -declare -a SOURCES=(
    2.90 -  "src/dockable.scala"
    2.91 -  "src/document_model.scala"
    2.92 -  "src/document_view.scala"
    2.93 -  "src/html_panel.scala"
    2.94 -  "src/isabelle_encoding.scala"
    2.95 -  "src/isabelle_hyperlinks.scala"
    2.96 -  "src/isabelle_markup.scala"
    2.97 -  "src/isabelle_options.scala"
    2.98 -  "src/isabelle_sidekick.scala"
    2.99 -  "src/output_dockable.scala"
   2.100 -  "src/plugin.scala"
   2.101 -  "src/protocol_dockable.scala"
   2.102 -  "src/raw_output_dockable.scala"
   2.103 -  "src/scala_console.scala"
   2.104 -  "src/session_dockable.scala"
   2.105 -)
   2.106 -
   2.107 -declare -a PLUGIN_FILES=(
   2.108 -  "plugin/actions.xml"
   2.109 -  "plugin/dockables.xml"
   2.110 -  "plugin/Isabelle.props"
   2.111 -  "plugin/services.xml"
   2.112 -)
   2.113 +pushd "$JEDIT_HOME" >/dev/null || failed
   2.114  
   2.115  JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
   2.116  
   2.117 @@ -155,30 +165,34 @@
   2.118  
   2.119  TARGET="dist/jars/Isabelle-jEdit.jar"
   2.120  
   2.121 -OUTDATED=false
   2.122 -for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
   2.123 -do
   2.124 -  [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
   2.125 -  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   2.126 -done
   2.127 +if [ "$BUILD_JARS" = jars_fresh ]; then
   2.128 +  OUTDATED=true
   2.129 +else
   2.130 +  OUTDATED=false
   2.131 +  for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
   2.132 +  do
   2.133 +    [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
   2.134 +    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   2.135 +  done
   2.136 +fi
   2.137  
   2.138  
   2.139  # build
   2.140  
   2.141  if [ "$OUTDATED" = true ]
   2.142  then
   2.143 -  echo "###"
   2.144 -  echo "### Building Isabelle/jEdit ..."
   2.145 -  echo "###"
   2.146 -
   2.147    [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
   2.148  
   2.149    [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
   2.150      fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
   2.151  
   2.152    [ -e "$ISABELLE_HOME/Admin/build" ] && \
   2.153 -    { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
   2.154 +    { "$ISABELLE_HOME/Admin/build" "$BUILD_JARS" || exit $?; }
   2.155 +
   2.156  
   2.157 +  echo "###"
   2.158 +  echo "### Building Isabelle/jEdit ..."
   2.159 +  echo "###"
   2.160  
   2.161    rm -rf dist || failed
   2.162    mkdir -p dist dist/classes || failed
   2.163 @@ -240,16 +254,18 @@
   2.164  
   2.165  # run
   2.166  
   2.167 -case "$JEDIT_LOGIC" in
   2.168 -  /*)
   2.169 -    ;;
   2.170 -  */*)
   2.171 -    JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
   2.172 -    ;;
   2.173 -esac
   2.174 +[ "$BUILD_ONLY" = true ] || {
   2.175 +  case "$JEDIT_LOGIC" in
   2.176 +    /*)
   2.177 +      ;;
   2.178 +    */*)
   2.179 +      JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
   2.180 +      ;;
   2.181 +  esac
   2.182  
   2.183 -export JEDIT_LOGIC JEDIT_PRINT_MODE
   2.184 +  export JEDIT_LOGIC JEDIT_PRINT_MODE
   2.185  
   2.186 -exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
   2.187 -  -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
   2.188 -  "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
   2.189 +  exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
   2.190 +    -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
   2.191 +    "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
   2.192 +}