Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save creativepsyco/10664971 to your computer and use it in GitHub Desktop.

Select an option

Save creativepsyco/10664971 to your computer and use it in GitHub Desktop.

Revisions

  1. @pboos pboos revised this gist Oct 25, 2013. 1 changed file with 29 additions and 0 deletions.
    29 changes: 29 additions & 0 deletions annotation-processor-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    configurations {
    apt
    }

    dependencies {
    compile 'com.squareup.dagger:dagger:1.1.0'
    apt 'com.squareup.dagger:dagger-compiler:1.1.0'
    }

    android.applicationVariants.all { variant ->
    def aptOutput = project.file("${project.buildDir}/source/apt_generated/${variant.dirName}")

    println "****************************"
    println "variant: ${variant.name}"
    println "manifest: ${variant.processResources.manifestFile}"
    println "aptOutput: ${aptOutput}"
    println "****************************"

    variant.javaCompile.doFirst {
    println "*** compile doFirst ${variant.name}"
    aptOutput.mkdirs()
    variant.javaCompile.options.compilerArgs += [
    '-processorpath', configurations.apt.getAsPath(),
    '-AandroidManifestFile=' + variant.processResources.manifestFile,
    '-AresourcePackageName=ch.tutti.daggertest',
    '-s', aptOutput
    ]
    }
    }
  2. @pboos pboos revised this gist Oct 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy-build.gradle
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ buildscript {
    }
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.4.2'
    classpath 'com.android.tools.build:gradle:0.6.+'
    }
    }

  3. @pboos pboos revised this gist Jul 12, 2013. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions signing-build.gradle
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,11 @@
    println ("##################")
    }
    }
    }

    buildTypes {
    release {
    signingConfig signingConfigs.release
    zipAlign true
    }
    }
  4. @pboos pboos revised this gist Jul 10, 2013. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions deploy-build.gradle
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,9 @@ repositories {
    }
    }

    version = '0.1-SNAPSHOT'
    group = 'ch.pboos.android.awesome'

    uploadArchives {
    repositories {
    // the maven plugin features this deployer
    @@ -31,6 +34,15 @@ uploadArchives {
    repository(url: "http://localhost:8081/nexus/content/repositories/releases") {
    authentication(userName: 'admin', password: 'admin123gi')
    }
    snapshotRepository(url: nexusSnapshotRepo) {
    // values as variable names declared in ~/.gradle/gradle.properties
    authentication(userName: nexusUsername, password: nexusPassword)
    }
    pom.project {
    artifactId 'my-awesome-library'
    name 'Pure awesome!'
    packaging 'aar'
    }
    }
    }
    }
  5. @pboos pboos revised this gist Jul 10, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions deploy-sonatype-build.gradle
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,7 @@ uploadArchives {
    }

    pom.project {
    artifactId 'gpuimage-library'
    name 'GPUImage for Android Library'
    packaging 'aar'
    description 'Image filters for Android with OpenGL (based on GPUImage for iOS)'
  6. @pboos pboos revised this gist Jul 10, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions deploy-sonatype-build.gradle
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    // run with: ./gradlew uploadArchives

    apply plugin: 'android-library'
    apply plugin: 'maven'
    apply plugin: 'signing'
  7. @pboos pboos revised this gist Jul 10, 2013. 2 changed files with 73 additions and 0 deletions.
    64 changes: 64 additions & 0 deletions deploy-sonatype-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    apply plugin: 'android-library'
    apply plugin: 'maven'
    apply plugin: 'signing'

    version = "1.1.2-SNAPSHOT"
    group = "jp.co.cyberagent.android.gpuimage"

    configurations {
    archives {
    extendsFrom configurations.default
    }
    }

    signing {
    required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
    sign configurations.archives
    }

    uploadArchives {
    configuration = configurations.archives
    repositories.mavenDeployer {
    beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

    repository(url: sonatypeRepo) {
    authentication(userName: sonatypeUsername, password: sonatypePassword)
    }
    snapshotRepository(url: sonatypeSnapshotRepo) {
    authentication(userName: sonatypeUsername, password: sonatypePassword)
    }

    pom.project {
    name 'GPUImage for Android Library'
    packaging 'aar'
    description 'Image filters for Android with OpenGL (based on GPUImage for iOS)'
    url 'https://github.com/cyberagent/android-gpuimage/'

    scm {
    url 'scm:git@github.com:CyberAgent/android-gpuimage.git'
    connection 'scm:git@github.com:CyberAgent/android-gpuimage.git'
    developerConnection 'scm:git@github.com:CyberAgent/android-gpuimage.git'
    }

    licenses {
    license {
    name 'The Apache Software License, Version 2.0'
    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    distribution 'repo'
    }
    }

    developers {
    developer {
    id 'pboos'
    name 'Patrick Boos'
    email 'patrickboos85@gmail.com'
    }
    }
    }
    }
    }

    android {
    ...
    }
    9 changes: 9 additions & 0 deletions deploy-sonatype-gradle.properties
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # ~/.gradle/gradle.properties
    signing.keyId=123456 # from gpg --list-keys
    signing.password=password # password of that key
    signing.secretKeyRingFile=/Users/boos_patrick/.gnupg/secring.gpg

    sonatypeRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2/
    sonatypeSnapshotRepo=https://oss.sonatype.org/content/repositories/snapshots/
    sonatypeUsername=sonatype_user
    sonatypePassword=your_difficult_password
  8. @pboos pboos revised this gist Jul 4, 2013. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion ndk-build.gradle
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,10 @@
    //////////////
    // NDK Support
    //////////////
    task copyNativeLibs(type: Copy) {
    // If using this, Android studio will fail run the following to set the environment variable for android studio:
    // launchctl setenv ANDROID_NDK_HOME /Users/boos_patrick/Development/Android/android-ndk-r8e
    // otherwise remove the dependsOn part and run ./gradlew buildNative from the command line
    task copyNativeLibs(type: Copy, dependsOn: 'buildNative') {
    dependsOn 'buildNative'
    from(new File('libs')) { include '**/*.so' }
    into new File(buildDir, 'native-libs')
  9. @pboos pboos revised this gist Jun 21, 2013. 1 changed file with 40 additions and 0 deletions.
    40 changes: 40 additions & 0 deletions deploy-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    buildscript {
    repositories {
    // rather than hit central each time with this:
    // mavenCentral()
    // we hit our company Nexus server ont he public group
    // which includes the Central Repository
    // and is local, so more performant
    maven {
    url "http://localhost:8081/nexus/content/groups/public"
    }
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.4.2'
    }
    }

    apply plugin: 'maven'

    repositories {
    // we also hit Nexus for all other dependencies!
    maven {
    url 'http://localhost:8081/nexus/content/groups/public'
    }
    }

    uploadArchives {
    repositories {
    // the maven plugin features this deployer
    mavenDeployer {
    // we deploy to the release repository in this case
    repository(url: "http://localhost:8081/nexus/content/repositories/releases") {
    authentication(userName: 'admin', password: 'admin123gi')
    }
    }
    }
    }

    android {
    ....
    }
  10. @pboos pboos created this gist Jun 18, 2013.
    30 changes: 30 additions & 0 deletions ndk-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    //////////////
    // NDK Support
    //////////////
    task copyNativeLibs(type: Copy) {
    dependsOn 'buildNative'
    from(new File('libs')) { include '**/*.so' }
    into new File(buildDir, 'native-libs')
    }

    tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }

    clean.dependsOn 'cleanCopyNativeLibs'

    tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniDir new File(buildDir, 'native-libs')
    }

    task buildNative(type: Exec) {
    if (System.env.ANDROID_NDK_HOME != null) {
    def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build')
    commandLine ndkBuild
    } else {
    doLast {
    println '##################'
    println 'Skipping NDK build'
    println 'Reason: ANDROID_NDK_HOME not set.'
    println '##################'
    }
    }
    }
    17 changes: 17 additions & 0 deletions signing-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    signingConfigs {
    release {
    def env = System.getenv()
    if (env['GRADLE_KEYSTORE_FILE'] != null) {
    storeFile file(env['GRADLE_KEYSTORE_FILE'])
    storePassword env['GRADLE_KEYSTORE_PASSWORD']
    keyAlias env['GRADLE_KEYSTORE_KEY_ALIAS']
    keyPassword env['GRADLE_KEYSTORE_KEY_PASSWORD']
    } else {
    println ("##################")
    println ("No keystore for release set.")
    println ("Set GRADLE_KEYSTORE_FILE, GRADLE_KEYSTORE_PASSWORD,"
    + "GRADLE_KEYSTORE_KEY_ALIAS and GRADLE_KEYSTORE_KEY_PASSWORD")
    println ("##################")
    }
    }
    }
    11 changes: 11 additions & 0 deletions spoon-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    task spoon(type: JavaExec, dependsOn: ["assembleDebug", "assembleTest"]) {
    main = "-jar"
    args relativePath("../spoon-runner-1.0.6-SNAPSHOT-jar-with-dependencies.jar")
    args "--apk"
    args relativePath("build/apk/sample-app-debug-unaligned.apk")
    args "--test-apk"
    args relativePath("build/apk/sample-app-test-unaligned.apk")
    args "--output"
    args "build/spoon"
    logger.info "main=${main},classpath=${classpath},args=${args}"
    }
    4 changes: 4 additions & 0 deletions utf-8-build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    // UTF-8
    tasks.withType(Compile) {
    options.encoding = 'UTF-8'
    }