Skip to content

mikanbako/Android-Application-Build-Script-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Application Build Script Extension

This project provides scripts that extends build script (build.xml)
generated by Android SDK Tools.

Features :

    * Add target for static code analyzing.

        * Checkstyle (http://checkstyle.sourceforge.net/)
        * FindBugs (http://findbugs.sourceforge.net/)
        * JavaNCSS (http://www.kclee.de/clemens/java/javancss/)
        * PMD (http://pmd.sourceforge.net/)
        * PMD's Copy/Paste Detector (CPD) (http://pmd.sourceforge.net/cpd.html)

    * Add targets for tests.

        * You can generate test result by JUnit XML format.
        * You can verify test result from generated JUnit XML report.

Required softwares :

    * Android SDK Tools Revision 22.3 or above (http://developer.android.com/)
    * Ant 1.8.0 or above (http://ant.apache.org/)
    * Static code analyzing tools if you run targets of static code analyze.

Removed feature :

    * from sdk_r16
        * Coverage filtering
            * Because Android SDK Tools supports coverage filter from revision 17.
              You can filter coverage result by "emma.filter" property.

    * from sdk_r20
        * XML coverage report
            * Because Android SDK Tools supports XML coverage report
              from revision 21. The report is generated to bin directory.

First Setup :

    1. Copy "build" directory to the top directory of your application project.

    2. Replace <import> task at your build.xml by the below.

        <import file="build/extended_build.xml" />

    3. Change the value of version-tag to "custom" in build.xml.

    Example:

        Before :
                <!-- version-tag: 1 -->
                <import file="${sdk.dir}/tools/ant/build.xml" />

        After :
                <!-- version-tag: custom -->
                <import file="build/extended_build.xml" />

Checkstyle Setup :

    1. Put checkstyle-x.x-all.jar in one of library directory of Ant.

    2. Change the value of checkstyle.enable to true in
       config/extension.properties.

    3. Modify or replace config/checkstyle-config.xml to your Checkstyle
       configuration if you need that.

FindBugs Setup :

    1. Install FindBugs to externals/findbugs or other directory.

    2. Put findbugs-ant.jar in one of library directory of Ant.

    3. Change the value of findbugs.enable to true in
       config/extension.properties.

    4. Modify findbugs.home in config/extension.properties to directory
       installed FindBugs if you need that.

    5. Modify or replace config/findbugs-exclude-filter.xml to your FindBugs
       exclude filter if you need that.

JavaNCSS Setup :

    1. Put jars in lib directory of JavaNCSS distribution in one of library
       directory of Ant.

    2. Change  true javancss.enable in config/extension.properties.

PMD Setup :

    1. Put jars in lib directory of PMD distribution in one of library
       directory of Ant.

    2. Change the value of pmd.enable to true in config/extension.properties.

    3. Modify or replace config/pmd-rule-set.xml (for main code) and
       config/pmd-test-rule-set.xml (for test code) to your PMD ruleset
       if you need that.

PMD's Copy/Paste Detector (CPD) Setup :

    1. Put jars in lib directory of PMD distribution in one of library
       directory of Ant.

    2. Change the value of pmd.cpd.enable to true in config/extension.properties.

Test Setup :

    1. Replace <import> task at build.xml by the below in the test project.

        <import file="${tested.project.dir}/build/extended_build.xml" />

    2. Replace the value of version-tag to "custom" at build.xml.

    3. Change the value of test.enable to true in config/extension.properties.

Added Targets :

    After "Checkstyle Setup" :

        checkstyle : Run Checkstyle and report by text to
                     "reports/checkstyle.txt".

        checkstyle-xml : Run Checkstyle and report by XML to
                         "reports/checkstyle.xml".

        Example :

            ant checkstyle
                Run Checkstyle and report by text on project executing Ant.

    After "FindBugs Setup" :

        findbugs : Run FindBugs and report by HTML to "reports/findbugs.html".

        findbugs-xml : Run FindBugs and report by XML to "reports/findbugs.xml".

        Example :

            ant findbugs
                Run FindBugs and report by HTML on project executing Ant.

    After "JavaNCSS Setup" :

        javancss : Run JavaNCSS and report by text to
                   "reports/javancss_metrics.txt".

        javancss-xml : Run JavaNCSS and report by XML to
                       "reports/javancss_metrics.xml".

        Example :

            ant javancss
                Run JavaNCSS and report by text on project executing Ant.

    After "PMD Setup" :

        pmd : Run PMD and report by HTML to
              "reports/pmd.html".

        pmd-xml : Run PMD and report by XML to
                  "reports/pmd.xml".

        Example :

            ant pmd
                Run PMD and report by HTML on project executing Ant.

    After "PMD's Copy/Paste Detector (CPD) Setup" :

        cpd : Run PMD's Copy/Paste Detector and report by text to
              "reports/cpd.txt".

        cpd-xml : Run PMD's Copy/Paste Detector and report by XML to
                  "reports/cpd.xml".

        Example :

            ant cpd
                Run PMD's Copy/Paste Detector and report by text on project
                executing Ant.

    After "Test Setup" :

        test-xml : Run tests and generate report by XML formatted by JUnit XML
                   format.

            * Test results report to "reports/test_result.xml" in test project.

            * Coverage reports are generated when you run text-xml target after
              emma target.

        verify-test-result : Check the JUnit XML report. And fail this build
                             if the test is failure.

            * This target needs the test results report from test-xml target.

            * If the test is successful, this target does not anything.

        Example :

            ant test-xml
                Run tests and generate report formatted by JUnit XML.
                The tested application and test application must be installed
                to the device before this target is ran.

            ant debug install test-xml
                Build test application and tested application, install
                the both application to the device, run tests and generate
                report formatted by JUnit XML.

            ant debug install test-xml verify-test-result
                Build test and tested application, install the both application,
                run tests and generate report formatted by JUnit XML.
                If the test failed, the build of Ant will be failure.

            ant emma debug install test-xml
                Build test and tested application, install the both application,
                run tests and generate report formatted by JUnit XML and
                coverage reports.

About

Extension scripts for building android application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published