<commit_before><?xml version="1.0" encoding="UTF-8"?>

<!--
 Copyright 2007 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project name="javame" default="build">

  <property file="../build.properties"/>

  <path id="wtk-build-path">
    <fileset dir="${WTK-home}/lib">
      <include name="cldcapi11.jar"/>
      <include name="midpapi20.jar"/>
      <include name="mmapi.jar"/>
      <include name="jsr234.jar"/>
      <include name="satsa-apdu.jar"/>
    </fileset>
    <pathelement location="../core/core.jar"/>
  </path>
  <property name="preverify-classpath" refid="wtk-build-path"/>

  <path id="javame-compile-bootclasspath">
    <fileset dir="${WTK-home}/lib">
      <include name="cldcapi11.jar"/>
      <include name="midpapi20.jar"/>
    </fileset>
  </path>
  <property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>

  <target name="init">
    <tstamp/>
    <fail message="Please set 'WTK-home' in build.properties">
      <condition>
        <not>
          <available file="${WTK-home}" type="dir"/>
        </not>
      </condition>
    </fail>
    <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
      <condition>
        <not>
          <available file="${WTK-home}/bin/proguard.jar" type="file"/>
        </not>
      </condition>
    </fail>
    <fail message="Please build 'core' first">
      <condition>
        <not>
          <available file="../core/core.jar" type="file"/>
        </not>
      </condition>
    </fail>
  </target>

  <target name="compile" depends="init">
    <mkdir dir="build"/>
    <javac srcdir="src"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
    </javac>
    <jar jarfile="javame.jar" basedir="build"/>
  </target>

  <target name="compile-basic" depends="init">
    <mkdir dir="build"/>
    <!-- For an explanation of this odd build command, see javadoc in
         src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java -->
    <javac srcdir="src-basic"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
    </javac>
    <javac srcdir="src"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
      <exclude name="com/google/zxing/client/j2me/AdvancedMultimediaManager.java"/>
    </javac>
    <jar jarfile="javame-basic.jar" basedir="build" level="9"/>    
  </target>

  <target name="package">
    <unzip src="../core/core.jar" dest="build"/>

    <mkdir dir="build-j2me"/>
    <exec executable="${WTK-home}/bin/preverify1.1" failonerror="true">
      <arg line="-classpath '${preverify-classpath}' -d build-j2me build"/>
    </exec>

    <copy todir="build-j2me">
      <fileset dir=".">
        <include name="res/**"/>
      </fileset>
    </copy>

    <copy file="src/com/google/zxing/client/j2me/MANIFEST.MF.template"
          tofile="src/com/google/zxing/client/j2me/MANIFEST.MF" overwrite="true">
      <filterset>
        <filter token="APP_NAME" value="${jar-name}"/>
        <filter token="VERSION" value="${version}"/>
      </filterset>
    </copy>

    <jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF"
         level="9"/>

    <move file="${jar-name}.jar" tofile="temp.jar"/>
    <java jar="${WTK-home}/bin/proguard.jar" fork="true" failonerror="true">
      <jvmarg value="-Dmaximum.inlined.code.length=32"/>
      <arg value="-injars temp.jar"/>
      <arg value="-outjars ${jar-name}.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/cldcapi11.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/midpapi20.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/mmapi.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/jsr234.jar"/>
      <arg value="-microedition"/>
      <arg value="-keep public class com.google.zxing.client.j2me.ZXingMIDlet"/>
      <arg value="-optimizationpasses 7"/>
      <arg value="-overloadaggressively"/>
      <arg value="-allowaccessmodification"/>
      <arg value="-verbose"/>
    </java>
    <delete file="temp.jar"/>

    <!-- get .jar size to include it in the .jad file -->
    <length file="${jar-name}.jar" property="jar-size"/>

    <copy file="BarcodeReader.jad.template" tofile="${jar-name}.jad" overwrite="true">
      <filterset>
        <filter token="JAR_SIZE" value="${jar-size}"/>
        <filter token="APP_NAME" value="${jar-name}"/>
        <filter token="VERSION" value="${version}"/>
      </filterset>
    </copy>

  </target>

  <target name="build">
    <description>Builds the main reader .jar file</description>
    <property name="jar-name" value="BarcodeReader"/>
    <antcall target="clean"/>
    <antcall target="compile"/>
    <antcall target="package"/>
  </target>

  <target name="build-basic">
    <description>Builds the basic reader .jar file</description>
    <property name="jar-name" value="BarcodeReaderBasic"/>
    <antcall target="clean"/>
    <antcall target="compile-basic"/>
    <antcall target="package"/>
  </target>

  <target name="clean">
    <delete dir="build"/>
    <delete dir="build-j2me"/>
    <delete dir="." includes="*.jar"/>
    <delete dir="." includes="*.jad"/>
    <delete file="src/com/google/zxing/client/j2me/MANIFEST.MF"/>
  </target>

</project><commit_msg>Remove level="9" here (oops) and add a dump target for debugging<commit_after><?xml version="1.0" encoding="UTF-8"?>

<!--
 Copyright 2007 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project name="javame" default="build">

  <property file="../build.properties"/>

  <path id="wtk-build-path">
    <fileset dir="${WTK-home}/lib">
      <include name="cldcapi11.jar"/>
      <include name="midpapi20.jar"/>
      <include name="mmapi.jar"/>
      <include name="jsr234.jar"/>
      <include name="satsa-apdu.jar"/>
    </fileset>
    <pathelement location="../core/core.jar"/>
  </path>
  <property name="preverify-classpath" refid="wtk-build-path"/>

  <path id="javame-compile-bootclasspath">
    <fileset dir="${WTK-home}/lib">
      <include name="cldcapi11.jar"/>
      <include name="midpapi20.jar"/>
    </fileset>
  </path>
  <property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>

  <target name="init">
    <tstamp/>
    <fail message="Please set 'WTK-home' in build.properties">
      <condition>
        <not>
          <available file="${WTK-home}" type="dir"/>
        </not>
      </condition>
    </fail>
    <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
      <condition>
        <not>
          <available file="${WTK-home}/bin/proguard.jar" type="file"/>
        </not>
      </condition>
    </fail>
    <fail message="Please build 'core' first">
      <condition>
        <not>
          <available file="../core/core.jar" type="file"/>
        </not>
      </condition>
    </fail>
  </target>

  <target name="compile" depends="init">
    <mkdir dir="build"/>
    <javac srcdir="src"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
    </javac>
    <jar jarfile="javame.jar" basedir="build"/>
  </target>

  <target name="compile-basic" depends="init">
    <mkdir dir="build"/>
    <!-- For an explanation of this odd build command, see javadoc in
         src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java -->
    <javac srcdir="src-basic"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
    </javac>
    <javac srcdir="src"
           destdir="build"
           source="1.2"
           target="1.2"
           bootclasspath="${javame-compile-bootclasspath-path}"
           optimize="true"
           debug="true"
           deprecation="true"
           fork="true">
      <classpath refid="wtk-build-path"/>
      <exclude name="com/google/zxing/client/j2me/AdvancedMultimediaManager.java"/>
    </javac>
    <jar jarfile="javame-basic.jar" basedir="build"/>
  </target>

  <target name="package">
    <unzip src="../core/core.jar" dest="build"/>

    <mkdir dir="build-j2me"/>
    <exec executable="${WTK-home}/bin/preverify1.1" failonerror="true">
      <arg line="-classpath '${preverify-classpath}' -d build-j2me build"/>
    </exec>

    <copy todir="build-j2me">
      <fileset dir=".">
        <include name="res/**"/>
      </fileset>
    </copy>

    <copy file="src/com/google/zxing/client/j2me/MANIFEST.MF.template"
          tofile="src/com/google/zxing/client/j2me/MANIFEST.MF" overwrite="true">
      <filterset>
        <filter token="APP_NAME" value="${jar-name}"/>
        <filter token="VERSION" value="${version}"/>
      </filterset>
    </copy>

    <jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF"/>

    <move file="${jar-name}.jar" tofile="temp.jar"/>
    <java jar="${WTK-home}/bin/proguard.jar" fork="true" failonerror="true">
      <jvmarg value="-Dmaximum.inlined.code.length=32"/>
      <arg value="-injars temp.jar"/>
      <arg value="-outjars ${jar-name}.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/cldcapi11.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/midpapi20.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/mmapi.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/jsr234.jar"/>
      <arg value="-microedition"/>
      <arg value="-keep public class com.google.zxing.client.j2me.ZXingMIDlet"/>
      <arg value="-optimizationpasses 7"/>
      <arg value="-overloadaggressively"/>
      <arg value="-allowaccessmodification"/>
      <arg value="-verbose"/>
    </java>
    <delete file="temp.jar"/>

    <!-- get .jar size to include it in the .jad file -->
    <length file="${jar-name}.jar" property="jar-size"/>

    <copy file="BarcodeReader.jad.template" tofile="${jar-name}.jad" overwrite="true">
      <filterset>
        <filter token="JAR_SIZE" value="${jar-size}"/>
        <filter token="APP_NAME" value="${jar-name}"/>
        <filter token="VERSION" value="${version}"/>
      </filterset>
    </copy>

  </target>

  <target name="build">
    <description>Builds the main reader .jar file</description>
    <property name="jar-name" value="BarcodeReader"/>
    <antcall target="clean"/>
    <antcall target="compile"/>
    <antcall target="package"/>
  </target>

  <target name="build-basic">
    <description>Builds the basic reader .jar file</description>
    <property name="jar-name" value="BarcodeReaderBasic"/>
    <antcall target="clean"/>
    <antcall target="compile-basic"/>
    <antcall target="package"/>
  </target>

  <target name="dump">
    <java jar="${WTK-home}/bin/proguard.jar" fork="true">
      <arg value="-injars BarcodeReader.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/cldcapi11.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/midpapi20.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/mmapi.jar"/>
      <arg value="-libraryjars ${WTK-home}/lib/jsr234.jar"/>
      <arg value="-dontshrink"/>
      <arg value="-dontobfuscate"/>
      <arg value="-dontoptimize"/>
      <arg value="-dump dump.txt"/>
    </java>
  </target>

  <target name="clean">
    <delete dir="build"/>
    <delete dir="build-j2me"/>
    <delete dir="." includes="*.jar"/>
    <delete dir="." includes="*.jad"/>
    <delete file="src/com/google/zxing/client/j2me/MANIFEST.MF"/>
  </target>

</project>
{'fraction_non_alphanumeric': 0.17855002995805871, 'fraction_numerical': 0.009436788496105452, 'mean_word_length': 2.789160045402951, 'pattern_counts': {'":': 0, '<': 284, '<?xml version=': 2, '>': 284, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3777865', 'n_tokens_mistral': 4363, 'n_tokens_neox': 4255, 'n_words': 872}