-
-
Save JcMinarro/2c6d0cd602d40b6f7cf9 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
apply plugin: 'android-sdk-manager' | |
apply plugin: 'com.android.application' | |
apply plugin: 'hugo' | |
apply plugin: 'crashlytics' | |
def versionMajor = 1 | |
def versionMinor = 7 | |
def versionPatch = 0 | |
def versionBuild = 0 // bump for dogfood builds, public betas, etc. | |
android { | |
compileSdkVersion 20 | |
buildToolsVersion '20' | |
signingConfigs { | |
releaseConfig { | |
storeFile file(STORE_FILE) | |
storePassword STORE_PASSWORD | |
keyAlias KEY_ALIAS | |
keyPassword KEY_PASSWORD | |
} | |
staging { | |
storeFile file(STORE_FILE) | |
storePassword STORE_PASSWORD | |
keyAlias KEY_ALIAS | |
keyPassword KEY_PASSWORD | |
} | |
} | |
defaultConfig { | |
applicationId "com.aracem.mainapp" | |
minSdkVersion 15 | |
targetSdkVersion 20 | |
versionCode versionMajor * 1000 + versionMinor * 100 + versionPatch * 10 + versionBuild | |
versionName "${versionMajor}.${versionMinor}.${versionPatch}" | |
buildConfigField "String", "FLURRY_KEY", "\"VJR4Z7TWX4CHM7DWKTK4\"" | |
} | |
buildTypes { | |
def STRING = "String" | |
def BOOL = "boolean" | |
def API_ENDPOINT = "API_BASE_ENDPOINT" | |
def API_VERSION = "API_VERSION" | |
def TWITTER_KEY = "TWITTER_CONSUMER_KEY" | |
def TWITTER_SECRET = "TWITTER_CONSUMER_SECRET" | |
def OPENTOK_KEY = "OPENTOK_APIKEY" | |
def PUSHER_KEY = "PUSHER_APIKEY" | |
def PUSHER_SECRET = "PUSHER_SECRET" | |
def PUSHER_APPID = "PUSHER_APPID" | |
def ENABLE_FLURRY = "IS_ENABLED_FLURRY" | |
def ENABLE_GA = "IS_ENABLED_GA" | |
debug { | |
buildConfigField STRING, API_ENDPOINT, "\"http://debug.aracem.com\"" | |
buildConfigField STRING, TWITTER_KEY, "\"stuff\"" | |
buildConfigField STRING, TWITTER_SECRET, "\"cosas_bonitas\"" | |
buildConfigField STRING, OPENTOK_KEY, "\"123456\"" | |
buildConfigField STRING, PUSHER_KEY, "\"1234567890\"" | |
buildConfigField STRING, PUSHER_SECRET, "\"123454566772234\"" | |
buildConfigField STRING, PUSHER_APPID, "\"123456789456798\"" | |
buildConfigField BOOL, ENABLE_FLURRY, "true" | |
buildConfigField BOOL, ENABLE_GA, "false" | |
applicationIdSuffix '.dev' | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
debuggable true | |
applicationVariants.all { variant -> | |
def file = variant.outputFile | |
String parent = file.parent | |
if (project.hasProperty('OUTPUT_DIR_DEBUG') && | |
new File((String) OUTPUT_DIR_DEBUG).exists() && | |
file.name.contains("-debug")) { | |
parent = OUTPUT_DIR_DEBUG | |
} | |
variant.outputFile = new File( | |
parent, | |
(String) file.name.replace( | |
"-debug", " v" + defaultConfig.versionName + | |
"-build" + defaultConfig.versionCode | |
) | |
) | |
} | |
} | |
staging { | |
buildConfigField STRING, API_ENDPOINT, "\"http://staging.aracem.com\"" | |
buildConfigField STRING, TWITTER_KEY, "\"key\"" | |
buildConfigField STRING, TWITTER_SECRET, "\"asdf\"" | |
buildConfigField STRING, OPENTOK_KEY, "\"123456\"" | |
buildConfigField STRING, PUSHER_KEY, "\"1234567890\"" | |
buildConfigField STRING, PUSHER_SECRET, "\"123454566772234\"" | |
buildConfigField STRING, PUSHER_APPID, "\"123456789456798\"" | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
debuggable true | |
//Generate APK | |
signingConfig signingConfigs.staging | |
applicationVariants.all { variant -> | |
def file = variant.outputFile | |
String parent = file.parent | |
if (project.hasProperty('OUTPUT_DIR_STAGING') && | |
new File((String) OUTPUT_DIR_STAGING).exists() && | |
file.name.contains("-staging")) { | |
parent = OUTPUT_DIR_STAGING | |
} | |
def filename = file.name.replace( | |
"-staging", "-staging v" + defaultConfig.versionName + | |
"-build" + defaultConfig.versionCode | |
) | |
variant.outputFile = new File(parent, filename) | |
} | |
} | |
release { | |
buildConfigField STRING, API_ENDPOINT, "\"http://aracem.com\"" | |
buildConfigField STRING, TWITTER_KEY, "\"stuff\"" | |
buildConfigField STRING, TWITTER_SECRET, "\"cosas_bonitas\"" | |
buildConfigField STRING, OPENTOK_KEY, "\"123456\"" | |
buildConfigField STRING, PUSHER_KEY, "\"1234567890\"" | |
buildConfigField STRING, PUSHER_SECRET, "\"123454566772234\"" | |
buildConfigField STRING, PUSHER_APPID, "\"123456789456798\"" | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
//Generate APK | |
signingConfig signingConfigs.releaseConfig | |
applicationVariants.all { variant -> | |
def file = variant.outputFile | |
String parent = file.parent | |
if (project.hasProperty('OUTPUT_DIR_PROD') && | |
new File((String) OUTPUT_DIR_PROD).exists() && | |
file.name.contains("-release.")) { | |
parent = OUTPUT_DIR_PROD | |
} | |
def filename = file.name.replace("-release.", " v" + defaultConfig.versionName + | |
"-build" + defaultConfig.versionCode + ".") | |
filename = filename.replace("aether", "Rushmore.fm") | |
variant.outputFile = new File(parent, filename) | |
} | |
} | |
} | |
lintOptions { | |
checkReleaseBuilds true | |
abortOnError true | |
} | |
} | |
repositories { | |
flatDir { | |
dirs 'libs' | |
} | |
maven { url 'http://download.crashlytics.com/maven' } | |
} | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
//Social Networks | |
compile('com.github.androidsocialnetworks:library:0.3.7@aar') { | |
transitive = true | |
} | |
compile 'com.squareup:otto:1.3.5' | |
compile 'com.android.support:support-v4:20.0.0' | |
compile 'com.jakewharton.timber:timber:2.4.1' | |
compile 'com.google.android.gms:play-services:6.1.11' | |
compile 'com.android.support:support-annotations:20.0.0' | |
compile 'com.jakewharton:butterknife:5.1.2' | |
compile 'com.squareup.picasso:picasso:2.3.4' | |
compile 'com.squareup.retrofit:retrofit:1.6.1' | |
compile 'com.intellij:annotations:+@jar' | |
compile 'com.pusher:pusher-java-client:0.3.1' | |
compile 'com.crashlytics.android:crashlytics:1.1.11' | |
compile 'com.path:android-priority-jobqueue:1.1.2' | |
compile 'com.squareup.dagger:dagger:1.2.2' | |
//Notificare | |
compile 're.notifica:notificare-push-lib-android:1.1.0' | |
//Calligraphy https://github.com/chrisjenx/Calligraphy | |
compile 'uk.co.chrisjenx:calligraphy:1.1.+' | |
} | |
// | |
// Remove useless packages from Google Play Services library | |
// | |
def toCamelCase(String string) { | |
String result = "" | |
string.findAll("[^\\W]+") { String word -> | |
result += word.capitalize() | |
} | |
return result | |
} | |
afterEvaluate { project -> | |
Configuration runtimeConfiguration = project.configurations.getByName('compile') | |
ResolutionResult resolution = runtimeConfiguration.incoming.resolutionResult | |
// Forces resolve of configuration | |
ModuleVersionIdentifier module = resolution.getAllComponents().find { it.moduleVersion.name.equals("play-services") }.moduleVersion | |
String prepareTaskName = "prepare${toCamelCase("${module.group} ${module.name} ${module.version}")}Library" | |
File playServiceRootFolder = project.tasks.find { it.name.equals(prepareTaskName) }.explodedDir | |
Task stripPlayServices = project.tasks.create(name: 'stripPlayServices', group: "Strip") { | |
inputs.files new File(playServiceRootFolder, "classes.jar") | |
outputs.dir playServiceRootFolder | |
description 'Strip useless packages from Google Play Services library to avoid reaching dex limit' | |
doLast { | |
copy { | |
from(file(new File(playServiceRootFolder, "classes.jar"))) | |
into(file(playServiceRootFolder)) | |
rename { fileName -> | |
fileName = "classes_orig.jar" | |
} | |
} | |
tasks.create(name: "stripPlayServices" + module.version, type: Jar) { | |
destinationDir = playServiceRootFolder | |
archiveName = "classes.jar" | |
from(zipTree(new File(playServiceRootFolder, "classes_orig.jar"))) { | |
exclude "com/google/ads/**" | |
exclude "com/google/android/gms/drive/**" | |
exclude "com/google/android/gms//**" | |
exclude "com/google/android/gms/games/**" | |
exclude "com/google/android/gms/drive/**" | |
exclude "com/google/android/gms/ads/**" | |
exclude "com/google/android/gms/wearable/**" | |
exclude "com/google/android/gms/wallet/**" | |
exclude "com/google/android/gms/panorama/**" | |
//google the play services packages and remove your useless | |
} | |
}.execute() | |
delete { | |
delete (file(new File(playServiceRootFolder, "classes_orig.jar"))) | |
} | |
} | |
} | |
project.tasks.findAll { it.name.startsWith('prepare') && it.name.endsWith('Dependencies') }.each { Task task -> | |
task.dependsOn stripPlayServices | |
} | |
} |
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
# Project-wide Gradle settings. | |
# IDE (e.g. Android Studio) users: | |
# Settings specified in this file will override any Gradle settings | |
# configured through the IDE. | |
# For more details on how to configure your build environment visit | |
# http://www.gradle.org/docs/current/userguide/build_environment.html | |
# Specifies the JVM arguments used for the daemon process. | |
# The setting is particularly useful for tweaking memory settings. | |
# Default value: -Xmx10248m -XX:MaxPermSize=256m | |
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | |
# When configured, Gradle will run in incubating parallel mode. | |
# This option should only be used with decoupled projects. More details, visit | |
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | |
# org.gradle.parallel=true | |
STORE_FILE=/home/aracem/your/project/path/app/aracem.keystore.jks | |
STORE_PASSWORD=XXX | |
KEY_ALIAS=Aracem | |
KEY_PASSWORD=XXX | |
OUTPUT_DIR_PROD=/home/aracem/appName/apk/ | |
OUTPUT_DIR_DEBUG=/home/aracem/appName/apk/debug | |
OUTPUT_DIR_STAGING=/home/aracem/appName/apk/staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment