Skip to content

Commit

Permalink
fix f-droid build
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrya committed Nov 8, 2019
1 parent f2588b2 commit 85ea385
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ android:
# Additional components
- extra-google-m2repository
- extra-android-m2repository
script: ./gradlew assembleDebug lintDebug testDebug checkDebugDuplicateClasses checkDebugManifest
script:
- ./gradlew assembleDebug lintDebug testDebug checkDebugDuplicateClasses checkDebugManifest
- ./gradlew checkUpdatedLicenseFile
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
Expand Down
1 change: 0 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/build
/src/main/assets/open_source_licenses.html
27 changes: 12 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ android {
applicationId getBuildApplicationId()
minSdkVersion 14
targetSdkVersion 28
versionCode 18
versionCode 19
versionName scmVersion.version
}
signingConfigs {
Expand All @@ -77,23 +77,9 @@ android {
}

afterEvaluate {
preBuild.dependsOn(generateLicenseFile)
preBuild.dependsOn(checkVersionCode)
}

// work around empty license file bug
// see https://github.com/jaredsburrows/gradle-license-plugin/issues/38
task generateLicenseFile(type: Exec) {
inputs.file(buildFile)
outputs.file("${project.projectDir}/src/main/assets/open_source_licenses.html")
workingDir project.rootDir
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'gradlew.bat', 'app:licenseReleaseReport'
} else {
commandLine './gradlew', 'app:licenseReleaseReport'
}
}

task checkVersionCode {
doLast {
if (android.defaultConfig.versionCode != getBuildVersionCode()) {
Expand All @@ -102,6 +88,17 @@ task checkVersionCode {
}
}

afterEvaluate {
task checkUpdatedLicenseFile {
dependsOn licenseDebugReport
doLast {
if (grgit.status().unstaged.modified.contains('app/src/main/assets/open_source_licenses.html')) {
throw new InvalidUserDataException('License file has changed, please commit new version first')
}
}
}
}

play {
serviceAccountCredentials = file("../../google-key.json")
}
Expand Down
Loading

0 comments on commit 85ea385

Please sign in to comment.