Skip to content

Commit

Permalink
Fix TV build.gradle for Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
Some Popcorn Time Contributor committed Jan 14, 2015
1 parent 94ae450 commit a030ee6
Showing 1 changed file with 59 additions and 2 deletions.
61 changes: 59 additions & 2 deletions tv/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'hugo'

apply plugin: 'com.android.application'
apply plugin: 'hugo'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
Expand All @@ -9,14 +12,69 @@ android {
applicationId "pct.droid.tv"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 0
versionName "0.1"
}

signingConfigs {
mainConfig {
keyAlias System.getenv("S_ALIAS").toString() ?: ""
keyPassword System.getenv("S_KEYPASS").toString() ?: ""
storeFile file(System.getenv("S_KEYSTORE").toString()) ?: file("")
storePassword System.getenv("S_KEYPASS").toString() ?: ""
}
}

buildTypes {
release {
signingConfig signingConfigs.mainConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
versionNameSuffix "#" + (System.getenv("BUILD_NUMBER") == null ? "local" : "dev" + System.getenv("BUILD_NUMBER")) + (System.getenv("GIT_BRANCH") == null ? "" : "-git-" + System.getenv("GIT_BRANCH").replace("origin/", ""))
applicationIdSuffix ".dev"
}
}

lintOptions {
abortOnError false
}

splits {
abi {
enable true
universalApk false
reset()
include 'armeabi', 'armeabi-v7a', 'x86'
}
}

project.ext.versionCodes = ["armeabi": 1, "armeabi-v7a": 2, "arm64-v8a": 3, "x86": 4]

android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def abi = output.getFilter(com.android.build.OutputFile.ABI);
output.versionCodeOverride = project.ext.versionCodes.get(abi, 0) * 1000000 + output.versionCode

def alignedOutputFile = output.outputFile
def unalignedOutputFile = output.packageApplication.outputFile
def outputFileName = alignedOutputFile.name

// Customise APK filenames
if (outputFileName.contains("debug")) {
outputFileName = outputFileName.replace("debug", "development").replace(".apk", "-" + (System.getenv("BUILD_NUMBER") ?: "local") + ".apk")
} else {
outputFileName = outputFileName.replace(".apk", "-" + variant.versionName + ".apk")
}

if (variant.buildType.zipAlignEnabled) {
// normal APK
output.outputFile = new File(alignedOutputFile.parent, outputFileName)
}
// 'unaligned' APK
output.packageApplication.outputFile = new File(unalignedOutputFile.parent, outputFileName.replace(".apk", "-unaligned.apk"))
}
}
}

Expand All @@ -29,7 +87,6 @@ dependencies {
}
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:leanback-v17:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.google.code.gson:gson:2.3'
compile 'com.jakewharton:butterknife:6.0.0'
Expand Down

0 comments on commit a030ee6

Please sign in to comment.