ぷちぷちとビルドファイル作成 (ザウルスで MIDP 開発環境完成!)
そもそも preverify とは何ぞや?
基本に戻り“ドキュメント”を読み始める at 帰路の電車の中。
Documentation Home J2ME Wireless Toolkit 2.2
WTK2.2/index.html
…と,“答”はすぐに見つかった。
付録 B コマンド行リファレンス
WTK2.2/docs/ja/docs/UserGuide-html/commandline.html
あろう事か *全て* の“答”がここに,しかも“日本語”で記述させているではナイか?!
// これが Google 依存症の弊害か?
ともかく,コレでいつでもどこでも
MIDlet が書けるぞ!
帰りの通勤電車が楽しみだ! (朝の電車は読書タイム)
ベタベタだが build.xml をここに記しておく。
<project name="Koyomi" default="all" basedir=".">
<property name="build.compiler" value="jikes" />
<property name="midpname" value="Koyomi" />
<property name="vendor" value="Studio High-Score" />
<property name="datasize" value="1024" />
<property name="midpicon" value="Koyomi.png" />
<property name="src" location="src" />
<property name="res" location="res" />
<property name="bin" location="bin" />
<property name="tmp" location="tmpclasses" />
<property name="mangled" location="mangled_classes" />
<property name="classes" location="classes" />
<property name="manifest" location="${bin}/MANIFEST.MF" />
<property name="myclasses" value="/home/zaurus/bin/classes" />
<property name="midpclasses" value="/home/zaurus/bin/WTK2.2/lib" />
<property name="midplib" value="${midpclasses}/midpapi20.jar" />
<property name="cldclib" value="${midpclasses}/cldcapi11.jar" />
<property name="jmangle" value="${myclasses}/jmangle.jar" />
<property name="midptooldir" value="/home/zaurus/bin/midptools" />
<property name="manifest2jad" value="${midptooldir}/manifest2jad" />
<property name="cp" value="${cldclib}:${midplib}" />
<target name="run" depends="all">
<exec executable="${emulator}">
<arg line="-classpath ${bin}/${midpname}.jar ${midpname}" />
</exec>
</target>
<target name="all" depends="makejad"/>
<target name="rebuild" depends="clean, all"/>
<target name="makejad" depends="jarres">
<exec executable="${manifest2jad}" dir="${bin}">
<arg line="${midpname}" />
</exec>
</target>
<target name="jarres" depends="jarclass">
<jar update="true"
destfile="${bin}/${midpname}.jar"
basedir="${res}" manifest="${manifest}">
<include name="*.png" />
</jar>
</target>
<target name="jarclass" depends="preverify,makemanifest">
<jar update="false"
destfile="${bin}/${midpname}.jar"
basedir="${classes}" manifest="${manifest}">
<include name="**/*.class" />
</jar>
</target>
<target name="makemanifest" >
<manifest file="${manifest}">
<attribute name="MIDlet-Name" value="${midpname}" />
<attribute name="MIDlet-Vendor" value="${vendor}" />
<attribute name="MIDlet-Version" value="1.0" />
<attribute name="MicroEdition-Configuration" value="CLDC-1.1" />
<attribute name="MicroEdition-Profile" value="MIDP-2.0" />
<attribute name="MIDlet-Data-Size" value="${datasize}" />
<attribute name="MIDlet-1" value="${midpname},${midpicon},${midpname}" />
</manifest>
</target>
<target name="preverify" depends="mangle" >
<exec executable="preverify">
<arg line="-d ${classes} -classpath ${cp} ${mangled}" />
</exec>
</target>
<target name="preverify_" depends="compile" >
<exec executable="preverify">
<arg line="-d ${classes} -classpath ${cp} ${tmp}" />
</exec>
</target>
<target name="mangle" depends="compile" >
<java classname="jmangle" fork="true">
<classpath>
<pathelement location="${midplib}" />
<pathelement location="${cldclib}" />
<pathelement location="${jmangle}" />
<pathelement path="${tmp}" />
</classpath>
<arg line="+prefix t +verbose - +map - ${tmp} ${mangled}" />
</java>
</target>
<target name="compile" depends="makedir" >
<javac srcdir="${src}" destdir="${tmp}" encoding="SJIS" debug="off" >
<classpath>
<pathelement location="${midplib}" />
<pathelement location="${cldclib}" />
</classpath>
</javac>
</target>
<target name="ascii">
<native2ascii
encoding="ISO2022JP"
src="./"
dest="./"
includes="**/*.jis"
ext=".java"
/>
</target>
<target name="jis">
<native2ascii
reverse="on"
encoding="ISO2022JP"
src="./"
dest="./"
includes="**/*.java"
ext=".jis"
/>
</target>
<target name="makedir">
<mkdir dir="${bin}" />
<mkdir dir="${tmp}" />
<mkdir dir="${mangled}" />
<mkdir dir="${classes}" />
</target>
<target name="clean">
<delete dir="${bin}" />
<delete dir="${tmp}" />
<delete dir="${mangled}" />
<delete dir="${classes}" />
</target>
</project>