2014年4月9日 星期三

note for setting up the build server

1. make a build.xml:
my command:
android.bat update project --name ImageManager --target android-16 --path d:\SVN\bigGod_revised

2. make a build.xml for unit test projects
example:
http://blackriver.to/2012/02/android-continuous-integration-with-ant-and-jenkins-part-1/
my command:
android.bat update test-project -m ..\..\..\workspace\MemoryBox -p D:\svn\libsForMemorybox\MB_UnitTest

reference 1 (simplified Chinese)

3. modify local.properties
set the path to findbugs and android sdk on your build server.
example:
findbugs.home=/opt/findbugs-2.0.3/
sdk.dir=/opt/android-sdk-linux

4. and findbugs to build.xml
example:

<!-- this is added for CI, for the findbugs to work properly. -->
<path id="findbugs-jar">
<pathelement path="${findbugs.home}/lib/findbugs-ant.jar"/>
</path>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs-jar" />

<target name="findbugs">
<mkdir dir="reports" />
<findbugs home="${findbugs.home}" output="xml" outputFile="reports/findbugs.xml" excludeFilter="findbugs-exclude.xml">
<auxClasspath path="${android.jar}" />
<class location="${out.dir}" />
<sourcePath path="${source.dir}"/>

</findbugs>
</target>

5. modify the version-tag in the bottom-most of the build.xml

<!-- version-tag: custom -->



6. Indicate the path to findbugs, checkstyle and android sdk on jenkins
findbugs.home=/opt/findbugs-2.0.3/
checkstyle.home=/opt/checkstyle-5.7/
sdk.dir=/opt/android-sdk-linux


7. add a target for checkstyle in build.xml
<taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-5.7-all.jar"/>
<target name="checkstyle">
<mkdir dir="reports" />
<checkstyle config="${checkstyle.home}/sun_checks.xml"
failureProperty="checkstyle.failure"
failOnViolation="false"
>
<formatter type="xml" tofile="reports/checkstyle_report.xml" />
<fileset dir="src" includes="**/*.java" />
</checkstyle>

</target>