Android持续集成
2014-04-07 21:56
162 查看
Android 持续集成
https://wiki.jenkins-ci.org/display/JENKINS/Android+Lint+Plugin
1. 进入jenkins插件管理,找到Android Lint Plugin,选择并且安装.之后重启Jenkins。
2. 在jenkins的job中,在build targets后面加上一项lint。
3. 构建job。你就可以看见lint的结果了
4. 之后你还可以在job的主页看到lint结果的变化趋势。
https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project
1. 下载Find’Bugs并且安装,假设安装在/data/findbugs.
下载地址:
http://sourceforge.jp/projects/sfnet_findbugs/downloads/findbugs/3.0.0/findbugs-3.0.0-dev-20131204-e3cbbd5.zip/
或者
http://findbugs.sourceforge.net/downloads.html
2. 从findbugs的安装目录lib下面拷贝findbugs-ant.jar到ant的lib目录下面
3. 在local.property文件中加入,也可以在jenkins的ant构建中加入
findbugs.home=C:\\develope\\findbugs-3.0.0
4. 在工程的build.xml文件中加入以下任务
<taskdefname="findbugs"classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<targetname="findbugs">
<mkdirdir="reports" />
<findbugshome="${findbugs.home}" output="xml"outputFile="reports/findbugs.xml"
excludeFilter="findbugs-exclude.xml">
<auxClasspathpath="${android.jar}" />
<classlocation="${out.dir}" />
</findbugs></target>
5. 不要包含对R文件的check,在工程下面创建findbugs-exclude.xml。
<?xmlversion="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Classname="~.*\.R\$.*"/>
<Bug code="Nm"/>
</Match>
</FindBugsFilter>
6. 在Jenkins中进入插件管理,下载安装FindBugs Plugin并且重启Jenkins。
7. 在job的ant targets中加入findbugs。
8. 最后加上publish findbugs analysis results
**/findbugs.xml
http://blog.jazzy.pro/en/jenkins-ci-and-android/
下载checkstyle
http://sourceforge.net/projects/checkstyle/
1. 将文件解压到一个指定的地方
2. 在ant build.xml中加入
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.home}/checkstyle-5.7-all.jar"/>
<target name="checkstyle">
<checkstyle config="${checkstyle.home}/sun_checks.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml"
tofile="reports/checkstyle.xml"/>
<fileset dir="${source.dir}"includes="**/*.java"/>
</checkstyle>
</target>
3. 在job ant构建中加入以下的属性定义:
checkstyle.home= C: \\develope\\checkstyle-5.7
4. 在ant target中加入checkstyle
5. 在构建后操作中加入Publish Checkstyle analysis results. 填入**/checkstyle.xml
如果你想要加入发送邮件的功能:
参考
http://checkstyle.sourceforge.net/anttask.html
<!-- run this target as part ofautomated build -->
<target name="checkstyle-nightly"
depends="checkstyle"
if="checkstyle.failure"
description="Sends email ifcheckstyle detected code conventions violations.">
<!-- use your own server and email addresses below. See Antdocumentation for details -->
<mail from="qa@some.domain"
tolist="someone@some.domain,someoneelse@some.domain"
mailhost="mailbox.some.domain"
subject="Checkstyle violation(s)in project ${ant.project.name}"
files="checkstyle_report.html"/>
</target>
Lint
参考:https://wiki.jenkins-ci.org/display/JENKINS/Android+Lint+Plugin
1. 进入jenkins插件管理,找到Android Lint Plugin,选择并且安装.之后重启Jenkins。
2. 在jenkins的job中,在build targets后面加上一项lint。
3. 构建job。你就可以看见lint的结果了
4. 之后你还可以在job的主页看到lint结果的变化趋势。
Findbugs
参考地址:https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project
1. 下载Find’Bugs并且安装,假设安装在/data/findbugs.
下载地址:
http://sourceforge.jp/projects/sfnet_findbugs/downloads/findbugs/3.0.0/findbugs-3.0.0-dev-20131204-e3cbbd5.zip/
或者
http://findbugs.sourceforge.net/downloads.html
2. 从findbugs的安装目录lib下面拷贝findbugs-ant.jar到ant的lib目录下面
3. 在local.property文件中加入,也可以在jenkins的ant构建中加入
findbugs.home=C:\\develope\\findbugs-3.0.0
4. 在工程的build.xml文件中加入以下任务
<taskdefname="findbugs"classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<targetname="findbugs">
<mkdirdir="reports" />
<findbugshome="${findbugs.home}" output="xml"outputFile="reports/findbugs.xml"
excludeFilter="findbugs-exclude.xml">
<auxClasspathpath="${android.jar}" />
<classlocation="${out.dir}" />
</findbugs></target>
5. 不要包含对R文件的check,在工程下面创建findbugs-exclude.xml。
<?xmlversion="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Classname="~.*\.R\$.*"/>
<Bug code="Nm"/>
</Match>
</FindBugsFilter>
6. 在Jenkins中进入插件管理,下载安装FindBugs Plugin并且重启Jenkins。
7. 在job的ant targets中加入findbugs。
8. 最后加上publish findbugs analysis results
**/findbugs.xml
Checkstyle
参考地址:http://blog.jazzy.pro/en/jenkins-ci-and-android/
下载checkstyle
http://sourceforge.net/projects/checkstyle/
1. 将文件解压到一个指定的地方
2. 在ant build.xml中加入
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.home}/checkstyle-5.7-all.jar"/>
<target name="checkstyle">
<checkstyle config="${checkstyle.home}/sun_checks.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml"
tofile="reports/checkstyle.xml"/>
<fileset dir="${source.dir}"includes="**/*.java"/>
</checkstyle>
</target>
3. 在job ant构建中加入以下的属性定义:
checkstyle.home= C: \\develope\\checkstyle-5.7
4. 在ant target中加入checkstyle
5. 在构建后操作中加入Publish Checkstyle analysis results. 填入**/checkstyle.xml
如果你想要加入发送邮件的功能:
参考
http://checkstyle.sourceforge.net/anttask.html
<!-- run this target as part ofautomated build -->
<target name="checkstyle-nightly"
depends="checkstyle"
if="checkstyle.failure"
description="Sends email ifcheckstyle detected code conventions violations.">
<!-- use your own server and email addresses below. See Antdocumentation for details -->
<mail from="qa@some.domain"
tolist="someone@some.domain,someoneelse@some.domain"
mailhost="mailbox.some.domain"
subject="Checkstyle violation(s)in project ${ant.project.name}"
files="checkstyle_report.html"/>
</target>
相关文章推荐
- Jenkins构建Android项目持续集成之创建项目
- 自动化测试与持续集成方案--Android crash 收集
- monkey自动化测试与持续集成方案--Android crash 收集
- !!!Android开发、测试持续集成环境Jenkins搭建
- Windows环境下jenkins +svn+android studio自动化构建(持续集成,打包)
- 在Android持续集成项目中android.jar前加载自己的jar包
- Jenkins+Gradle实现android开发持续集成、打包
- Android持续集成--JENKINS+GRADLE+JACOCO+SONARQUBE(三)
- Jenkins构建Android项目持续集成之系统配置篇
- Jenkins构建Android项目持续集成之findbugs的使用
- Jenkins构建Android项目持续集成之Jenkins的安装篇
- Jenkins+Gradle实现android开发持续集成、打包
- 使用Hudson持续集成Android项目
- android配置集成CI持续化开发工具Jenkins
- 使用Jenkins搭建iOS/Android持续集成打包平台
- Jenkins+Gradle实现android开发持续集成问题汇总
- Jenkins+svn_Gradle实现android开发持续集成问题笔记
- 基于Jenkins+git+gradle的android持续集成
- 【mac+Android Studio】【持续集成优化】搭建Jenkins+svn+Android Studio+发布到蒲公英+发邮件
- Android持续集成