Next revision | Previous revisionNext revisionBoth sides next revision |
android:gradle [2013/07/29 22:29] – created percy | android:gradle [2013/07/29 22:40] – [Gradle user guide] percy |
---|
| |
===== What's Gradle ===== | ===== What's Gradle ===== |
| Gradle:http://www.gradle.org/ |
| <code> |
| Gradle is build automation evolved. Gradle can automate the |
| building, testing, publishing, deployment and more of software packages or other types of projects such as |
| generated static websites, generated documentation or indeed anything else. |
| </code> |
| |
===== Install Gradle ===== | ===== Install Gradle ===== |
| ==== Download Gradle ==== |
| |
| http://www.gradle.org/downloads |
| |
===== Gradle user guide ===== | ==== Setup Gradle PATH ==== |
| |
| set the gradle/bin to system PATH. |
| |
| export PATH=${PATH}:/Users/pengjianqing/Documents/Android/gradle-1.6/bin |
| |
| ==== First run Gradle ==== |
| |
| when first time run gradle tasks,it will start some install automatically. |
| <code> |
| Download http://repo1.maven.org/maven2/com/android/tools/build/gradle/0.4/gradle-0.4.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/gradle-model/0.4/gradle-model-0.4.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder/0.4/builder-0.4.pom |
| Download http://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/4.9/proguard-gradle-4.9.pom |
| Download http://repo1.maven.org/maven2/net/sf/proguard/proguard-parent/4.9/proguard-parent-4.9.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder-model/0.4/builder-model-0.4.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/sdklib/22.0/sdklib-22.0.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/0.4/builder-test-api-0.4.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/sdk-common/22.0/sdk-common-22.0.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/22.0/ddmlib-22.0.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/22.0/manifest-merger-22.0.pom |
| Download http://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.pom |
| Download http://repo1.maven.org/maven2/net/sf/proguard/proguard-base/4.9/proguard-base-4.9.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/common/22.0/common-22.0.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1.1/httpcomponents-client-4.1.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/layoutlib/layoutlib-api/22.0/layoutlib-api-22.0.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/dvlib/22.0/dvlib-22.0.pom |
| Download http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom |
| Download http://repo1.maven.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom |
| Download http://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom |
| Download http://repo1.maven.org/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom |
| Download http://repo1.maven.org/maven2/kxml2/kxml2/2.3.0/kxml2-2.3.0.pom |
| Download http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom |
| Download http://repo1.maven.org/maven2/com/google/guava/guava/13.0.1/guava-13.0.1.pom |
| Download http://repo1.maven.org/maven2/com/google/guava/guava-parent/13.0.1/guava-parent-13.0.1.pom |
| Download http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-core/4.1/httpcomponents-core-4.1.pom |
| Download http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom |
| Download http://repo1.maven.org/maven2/org/apache/commons/commons-parent/5/commons-parent-5.pom |
| Download http://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.pom |
| Download http://repo1.maven.org/maven2/com/android/tools/build/gradle/0.4/gradle-0.4.jar |
| Download http://repo1.maven.org/maven2/com/google/guava/guava/13.0.1/guava-13.0.1.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/common/22.0/common-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder-model/0.4/builder-model-0.4.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/build/gradle-model/0.4/gradle-model-0.4.jar |
| Download http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar |
| Download http://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar |
| Download http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar |
| Download http://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.jar |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar |
| Download http://repo1.maven.org/maven2/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar |
| Download http://repo1.maven.org/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/layoutlib/layoutlib-api/22.0/layoutlib-api-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/dvlib/22.0/dvlib-22.0.jar |
| Download http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/sdklib/22.0/sdklib-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/22.0/ddmlib-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/0.4/builder-test-api-0.4.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/sdk-common/22.0/sdk-common-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/22.0/manifest-merger-22.0.jar |
| Download http://repo1.maven.org/maven2/com/android/tools/build/builder/0.4/builder-0.4.jar |
| Download http://repo1.maven.org/maven2/net/sf/proguard/proguard-base/4.9/proguard-base-4.9.jar |
| Download http://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/4.9/proguard-gradle-4.9.jar |
| The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead. |
| </code> |
| =====Android Gradle user guide ===== |
| Gradle Plugin User Guide:http://tools.android.com/tech-docs/new-build-system/user-guide |
| |
| Gradle is an advanced build system as well as an advanced build toolkit allowing to create custom build logic through plugins. |
| |
| Here are some of its features that made us choose Gradle: |
| * Domain Specific Language (DSL) to describe and manipulate the build logic |
| * Build files are Groovy based and allow mixing of declarative elements through the DSL and using code to manipulate the DSL elements to provide custom logic. |
| * Built-in dependency management through Maven and/or Ivy. |
| * Very flexible. Allows using best practices but doesn’t force its own way of doing things. |
| * Plugins can expose their own DSL and their own API for build files to use. |
| * Good Tooling API allowing IDE integration |
| |
| |
| |
===== What's Groovy ===== | ===== What's Groovy ===== |
| Groovy:http://groovy.codehaus.org/ |
| |
| <code> |
| Groovy... |
| * is an agile and dynamic language for the Java Virtual Machine |
| * builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk |
| * makes modern programming features available to Java developers with almost-zero learning curve |
| * provides the ability to statically type check and statically compile your code for robustness and performance |
| * supports Domain-Specific Languages and other compact syntax so your code becomes easy to read and maintain |
| * makes writing shell and build scripts easy with its powerful processing primitives, OO abilities and an Ant DSL |
| * increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications |
| * simplifies testing by supporting unit testing and mocking out-of-the-box |
| * seamlessly integrates with all existing Java classes and libraries |
| * compiles straight to Java bytecode so you can use it anywhere you can use Java |
| </code> |
===== Gradle build script example ===== | ===== Gradle build script example ===== |
| |