
こんにちは。ダラファームの藤井 a.k.a ふじいっちです。
jQueryの1.4のプレリリースが出たので早速コードリーディングと思ったのですが、 ついでにbuildさせたときのメモです(環境はWin7)。
git: git://github.com/jquery/jquery.git
svn: http://jqueryjs.googlecode.com/svn/trunk/jquery
(GitやSubversionのインストールや使い方はここでは割愛させていただきます)
build.xmlからbuildさせるにはApache Antが必要なので http://ant.apache.org/ から”Download”項目の”Binary Distributions”のzipアーカイブをダウンロードします。
展開後、適当なディレクトリに配置。PATHを通しておきます。
自分ではC:\binを作り、C:\bin\apache-ant-1.8.0RC1をPATHに追加しました。
JDKが入っていなければWindows版のJDKをインストール。
システム環境変数を確認し、設定されてなければ追加します。
新規変数で”JAVA_HOME”を追加後” C:\Program Files (x86)\Java\jdk1.6.0_18″ (JDKのディレクトリパス)を追加、
PATHへ”%JAVA_HOME%\bin”を追加、
CLASSPATHへ”%JAVA_HOME%\lib\tools.jar”を追加。
これで大丈夫だと思います。
それでは実際にbuildしてみます。
cd C:\www\htdocs\work\example.com\lib\js\jquery
C:\www\htdocs\work\example.com\lib\js\jquery>ant
Buildfile: C:\www\htdocs\work\example.com\lib\js\jquery\build.xml
jquery:
[echo] Building ./dist/jquery.js
[mkdir] Created dir: C:\www\htdocs\work\example.com\lib\js\jquery\dist
[echo] ./dist/jquery.js built.
BUILD SUCCESSFUL
Total time: 1 second
C:\www\htdocs\work\example.com\lib\js\jquery>ls dist
jquery.js
./distにjQueryがbuildされました。
次はミニファイ版をbuildしてみます。
C:\www\htdocs\work\example.com\lib\js\jquery>ant min
Buildfile: C:\www\htdocs\work\example.com\lib\js\jquery\build.xml
jquery:
[echo] Building ./dist/jquery.js
[echo] ./dist/jquery.js built.
min:
[echo] Building ./dist/jquery.min.js
[apply] Applied java to 1 file and 0 directories.
[echo] ./dist/jquery.min.js built.
BUILD SUCCESSFUL
Total time: 3 seconds
これでsvnやgitで更新しantすれば最新のjQueryがbuildされるようになりました。便利!
“jQueryをbuildしたときのメモ”の全文を読む