Forked from pboos/annotation-processor-build.gradle
Created
September 23, 2013 15:15
-
-
Save ffgiraldez/6671995 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} | |
} | |
version = '0.1-SNAPSHOT' | |
group = 'ch.pboos.android.awesome' | |
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') | |
} | |
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' | |
} | |
} | |
} | |
} | |
android { | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run with: ./gradlew uploadArchives | |
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 { | |
artifactId 'gpuimage-library' | |
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:[email protected]:CyberAgent/android-gpuimage.git' | |
connection 'scm:[email protected]:CyberAgent/android-gpuimage.git' | |
developerConnection 'scm:[email protected]: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 '[email protected]' | |
} | |
} | |
} | |
} | |
} | |
android { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////// | |
// NDK Support | |
////////////// | |
// 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') | |
} | |
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 '##################' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ("##################") | |
} | |
} | |
} | |
buildTypes { | |
release { | |
signingConfig signingConfigs.release | |
zipAlign true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UTF-8 | |
tasks.withType(Compile) { | |
options.encoding = 'UTF-8' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment