src/Pure/build-jars
changeset 43523 5aaa0fe92672
parent 43521 d477b92109b8
child 43600 4ac04bf9ff89
equal deleted inserted replaced
43522:2562d6c81b03 43523:5aaa0fe92672
   105 
   105 
   106 [ "$#" -ne 0 ] && usage
   106 [ "$#" -ne 0 ] && usage
   107 
   107 
   108 
   108 
   109 
   109 
   110 ## dependencies
   110 # build
   111 
   111 
   112 TARGET_DIR="$ISABELLE_HOME/lib/classes"
   112 TARGET_DIR="$ISABELLE_HOME/lib/classes"
   113 PURE_JAR="$TARGET_DIR/Pure.jar"
   113 TARGET="$TARGET_DIR/ext/Pure.jar"
   114 FULL_JAR="$TARGET_DIR/isabelle-scala.jar"
       
   115 
       
   116 declare -a TARGETS=("$PURE_JAR" "$FULL_JAR")
       
   117 
       
   118 
       
   119 ## main
       
   120 
   114 
   121 declare -a UPDATED=()
   115 declare -a UPDATED=()
   122 
   116 
   123 if [ -n "$FRESH" ]; then
   117 if [ -n "$FRESH" ]; then
   124   OUTDATED=true
   118   OUTDATED=true
   125 else
   119 else
   126   OUTDATED=false
   120   OUTDATED=false
   127   for TARGET in "${TARGETS[@]}"
   121   if [ ! -e "$TARGET" ]; then
   128   do
   122     OUTDATED=true
   129     [ ! -e "$TARGET" ] && OUTDATED=true
   123   else
   130   done
       
   131   if [ "$OUTDATED" = false ]; then
       
   132     for DEP in "${SOURCES[@]}"
   124     for DEP in "${SOURCES[@]}"
   133     do
   125     do
   134       [ ! -e "$DEP" ] && fail "Missing file: $DEP"
   126       [ ! -e "$DEP" ] && fail "Missing file: $DEP"
   135       UPDATE=""
   127       [ "$DEP" -nt "$TARGET" ] && {
   136       for TARGET in "${TARGETS[@]}"
   128         OUTDATED=true
   137       do
   129         UPDATED["${#UPDATED[@]}"]="$DEP"
   138         [ "$DEP" -nt "$TARGET" ] && {
   130       }
   139           OUTDATED=true
       
   140           UPDATE=true
       
   141         }
       
   142       done
       
   143       [ -n "$UPDATE" ] && UPDATED["${#UPDATED[@]}"]="$DEP"
       
   144     done
   131     done
   145   fi
   132   fi
   146 fi
   133 fi
   147 
   134 
   148 if [ "$OUTDATED" = true ]
   135 if [ "$OUTDATED" = true ]
   160   }
   147   }
   161 
   148 
   162   rm -rf classes && mkdir classes
   149   rm -rf classes && mkdir classes
   163   "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \
   150   "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \
   164     fail "Failed to compile sources"
   151     fail "Failed to compile sources"
   165   mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
   152   mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext"
   166 
   153 
   167   pushd classes >/dev/null
   154   pushd classes >/dev/null
   168 
   155 
   169   CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
   156   CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
   170   mkdir -p "$(dirname "$CHARSET_SERVICE")"
   157   mkdir -p "$(dirname "$CHARSET_SERVICE")"
   171   echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
   158   echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
   172 
   159 
   173   jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup META-INF isabelle || \
   160   jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \
   174     fail "Failed to produce $PURE_JAR"
   161     fail "Failed to produce $TARGET"
   175 
   162 
   176   cp "$SCALA_HOME/lib/scala-swing.jar" .
   163   cp "$SCALA_HOME/lib/scala-swing.jar" "$SCALA_HOME/lib/scala-library.jar" "$TARGET_DIR/ext"
   177   jar xf scala-swing.jar
       
   178 
       
   179   cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
       
   180   jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
       
   181     fail "Failed to produce $FULL_JAR"
       
   182 
       
   183   mkdir -p "$TARGET_DIR/ext"
       
   184   cp "$FULL_JAR" "$TARGET_DIR/ext/"
       
   185 
   164 
   186   popd >/dev/null
   165   popd >/dev/null
   187 
   166 
   188   rm -rf classes
   167   rm -rf classes
   189 fi
   168 fi