• JVM, Android, Native, and Web • Flexible, Dynamic, and extensible • Plugin/Integration for every imaginable tool • Based on Groovy with complete interoperability with java
of you application. • Alpha - Internal testing • Beta - External testing • Demo - A free trial version • etc…. Each flavor can also share a similar codebase that can vary in behavior based on the product flavor
version and scope of all your project’s external dependencies • Organize into existing configurations (i.e., scopes) or create your own • Apply dependencies throughout the build using configurations • Model project relationships using the same declarative style as external dependencies
artifacts from any known binary repository, from public to private to local. • Gradually transition from other build systems by mixing and matching repository types. • Maven Repositories • Maven Central • jCenter • Bintray • Local • Ivy Repositories • Custom & Legacy • Flat Files
parts: • The group identifier: e.g. com.google.dagger or com.52inc • Organization/Company identifier, usually their main domain • The artifact identifier: e.g. dagger or 52Kit • This is the project/library identifier. • The version code: e.g. 2.0.0 or 0.1.+ • This is the version of said library you are trying to load. You can specify the full version number/name or you can use the + identifier to specify the latest for the Major, Minor, or Build version numbers (if you follow Semantic Versioning).
// Remote binary dependency compile 'com.android.support:appcompat-v7:22.0.0' // Local binary dependency compile fileTree(dir: 'libs', include: ['*.jar']) } Here are the most common ways you will see dependencies declared
for different behavior. • Common configurations are: • compile - Normal configuration • debugCompile - debug build only configurations • releaseCompile- release build only configurations • <build_type>Compile • You can prepend any build type your create to the Compile command to limit dependencies to that build type. • provided - This dependency is need for compilation, and it shouldn't be distributed with it. • This is typically used for annotation pre-processors
library, but how do you wield it? • You could import it as a local module in your project // Module dependency compile project(":lib") • You could export the binary .aar file and load it in your project // Local binary dependency compile fileTree(dir: 'libs', include: ['*.aar']) • Or we can use a public central repository for free!
of knowledge” • Maven itself is a build system/tool with dependency management • Maven is Gradle’s predecessor • Gradle still uses POM (Project Object Model) XML descriptor files for fetching dependencies
<dependency> <groupId>com.52inc</groupId> <artifactId>52Kit</artifactId> <version>0.1.3</version> </dependency> • The new Gradle way of importing dependencies compile 'com.52inc:52Kit:0.1.3'
to Maven Central? 1. Create a Sonatype account at https://oss.sonatype.org Add your username and password to your ~/.gradle/gradle.properties global config file. NEXUS_USERNAME=r0adkll NEXUS_PASSWORD=somepassword 2. Create a new group JIRA Ticket: http://goo.gl/s8dgmn Here you will want to choose a unique Group Id that can be reused for future projects • com.r0adkll or com.52inc
Enter your email, same sonatype.org email, and other info from prompts. Export the secring.gpg file $gpg2 —-export-secret-keys > secring.gpg List your keys to get your keyId using this command: $gpg2 —-list-keys [email protected] Add the following data to your global grade.properties file signing.keyId=BBBBBBBB signing.password=password signing.secretKeyRingFile=/Users/drew.heavner/.gnupg/secring.gpg
To enable the sonatype servers to verify the key, the public key needs to be sent to the standard key servers. $gpg2 —-keyserver pgp.mit.edu —-send-keys A2AAD1B1 Use the save key ID that you used in the previous step
root Then add the following properties of your project to it: VERSION_NAME=2.0.3 VERSION_CODE=7 GROUP=com.r0adkll POM_DESCRIPTION=Some Description Here POM_URL=https://github.com/r0adkll/Slidr POM_SCM_URL=https://github.com/r0adkll/Slidr.git POM_SCM_CONNECTION=scm:[email protected]:r0adkll/Slidr.git POM_SCM_DEV_CONNECTION=scm:[email protected]:r0adkll/Slidr.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo POM_DEVELOPER_ID=r0adkll POM_DEVELOPER_NAME=Drew Heavner
Then add the following properties of your project to it: POM_NAME=Slidable Activity POM_ARTIFACT_ID=slidableactivity POM_PACKAGING=aar This defines the artifact identifier for each project that we talked about earlier
gradle-mvn-push/master/gradle-mvn-push.gradle' Add the following command to the end of your sub-module build.gradle file to apply it 7. Build and push your library to maven central $ gradle clean build uploadArchives
repository • Go to https://oss.sonatype.org and Login • Then go to ‘Staging Repositories’ and find the entry that has your group Id in it, i.e. com.r0adkll • Then ‘Close’ it and wait for it to finish • Then ‘Release’ it and wait for it to finish • It will take up to 2 hours to finish syncing with the central repository for it to become available
to-use binaries to your application. • Uses GitHub’s tag and releases for versioning • Why? Because publishing to a central repository can be…difficult. • This is actually really cool! Easy to use package repository for Gradle, Maven and Android projects
HTTP & SPDY client for Android and Java • Retrofit - A high level type-safe REST client for Android and Java • Dagger - A fast dependency injector for Android and Java • Picasso - A powerful image downloading and caching library for Android • Otto - An enhanced Guava-based event bus with emphasis on Android support. • ButterKnife - View "injection" library for Android. • Timber - A logger with a small, extensible API which provides utility on top of Android's normal Log class. • RxJava - Reactive Extensions for the JVM • Ollie - Compile-time active record ORM for Android with RxJava support • LoganSquare - Screaming fast JSON parsing and serialization library for Android.