Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
gpslogger/gpslogger/build.gradle
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
325 lines (245 sloc)
8.76 KB
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 { | |
| google() | |
| mavenCentral() | |
| maven { | |
| url "https://plugins.gradle.org/m2/" | |
| } | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:7.2.0' | |
| classpath 'org.jacoco:org.jacoco.core:0.7.4.201502262128' | |
| classpath "com.moowork.gradle:gradle-node-plugin:0.13" | |
| } | |
| } | |
| //Android | |
| apply plugin: 'com.android.application' | |
| //Generating PGP | |
| apply plugin: 'signing' | |
| //Generating colorful output | |
| apply from: 'buildtools/ColoredOutput.gradle' | |
| project.ext.set("GHACTIONS_FOLDING", true) | |
| //Generate help pages | |
| apply plugin: 'com.moowork.node' | |
| repositories { | |
| mavenCentral() | |
| maven { | |
| url "https://jitpack.io" | |
| } | |
| google() | |
| } | |
| android { | |
| compileSdkVersion 30 | |
| defaultConfig { | |
| applicationId "com.mendhak.gpslogger" | |
| minSdkVersion 16 | |
| targetSdkVersion 30 | |
| versionCode 125 | |
| versionName "126-RC1" | |
| manifestPlaceholders = [ | |
| appAuthRedirectScheme: 'com.mendhak.gpslogger' | |
| ] | |
| } | |
| buildTypes { | |
| debug { | |
| minifyEnabled true | |
| shrinkResources false | |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | |
| debuggable true | |
| } | |
| release { | |
| minifyEnabled true | |
| shrinkResources true | |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | |
| debuggable false | |
| } | |
| } | |
| testOptions { | |
| unitTests.returnDefaultValues = true | |
| } | |
| lint { | |
| abortOnError false | |
| } | |
| namespace 'com.mendhak.gpslogger' | |
| //Release signing key | |
| if (project.hasProperty("RELEASE_STORE_FILE")) { | |
| signingConfigs { | |
| release { | |
| storeFile file(RELEASE_STORE_FILE) | |
| storePassword RELEASE_STORE_PASSWORD | |
| keyAlias RELEASE_KEY_ALIAS | |
| keyPassword RELEASE_KEY_PASSWORD | |
| } | |
| } | |
| buildTypes { | |
| release { | |
| signingConfig signingConfigs.release | |
| } | |
| } | |
| } | |
| } | |
| dependencies { | |
| // implementation 'androidx.legacy:legacy-support-v4:1.0.0' | |
| implementation "androidx.activity:activity:1.3.1" | |
| implementation "androidx.fragment:fragment:1.3.6" | |
| implementation "androidx.preference:preference:1.1.1" | |
| implementation "androidx.constraintlayout:constraintlayout:2.1.0" | |
| //Google Drive Oauth | |
| implementation 'net.openid:appauth:0.9.1' | |
| //FTP operations | |
| implementation('commons-net:commons-net:3.4') | |
| //Debug Logging | |
| implementation('org.slf4j:slf4j-api:1.7.6') | |
| implementation('com.github.tony19:logback-android-classic:1.1.1-2'){ | |
| exclude group: 'com.google.android', module: 'android' | |
| } | |
| implementation('com.github.tony19:logback-android-core:1.1.1-2') | |
| //Android lollipop/material features including the Toolbar | |
| implementation 'androidx.appcompat:appcompat:1.3.1' | |
| //Cardviews | |
| implementation 'androidx.cardview:cardview:1.0.0' | |
| // Simple Dialog Fragments, replacing Material Dialogs. | |
| // implementation 'io.github.eltos:simpledialogfragments:3.4' | |
| implementation 'com.github.eltos:SimpleDialogFragments:v3.5' | |
| //The material drawer | |
| implementation('com.mikepenz:materialdrawer:4.6.4@aar') { | |
| transitive = true | |
| } | |
| //Progress button | |
| implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4' | |
| //Android Priority Jobqueue | |
| implementation ('com.birbit:android-priority-jobqueue:2.0.1'){ | |
| exclude group: 'com.google.android', module: 'android' | |
| } | |
| //Event bus | |
| implementation 'de.greenrobot:eventbus:2.4.0' | |
| //JARs which aren't on maven | |
| //compile 'com.mendhak.gpsloggersupportfiles:owncloud-android-library:0.0.3@aar' | |
| implementation 'com.github.owncloud:android-library:oc-android-library-0.9.14' | |
| //Required by owncloud library | |
| implementation ('commons-httpclient:commons-httpclient:3.1') { | |
| exclude module: 'commons-logging' | |
| } | |
| implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.12.2' | |
| //Expandable textview in the FAQ | |
| implementation 'com.ms-square:expandableTextView:0.1.4' | |
| //The single letter text icons | |
| implementation 'com.github.amulyakhare:TextDrawable:558677ea31' | |
| //OKHTTP client | |
| implementation 'com.squareup.okhttp3:okhttp:3.10.0' | |
| //OKHTTP interceptor, works with oauth signpost | |
| implementation 'se.akerfeldt:okhttp-signpost:1.1.0' | |
| //OAuth signing | |
| implementation('oauth.signpost:signpost-core:1.2.1.1'){ | |
| exclude module: 'commons-codec' | |
| } | |
| //Dropbox API 3 | |
| implementation 'com.dropbox.core:dropbox-core-sdk:5.1.1' | |
| //Markdown to HTML library | |
| implementation 'com.github.commonsguy:cwac-anddown:dedb48ec0f' | |
| // A fork of JSCH used in SFTPJob. It specifically requires bouncycastle to use modern algorithms. | |
| implementation 'com.github.mwiede:jsch:0.1.67' | |
| implementation 'org.bouncycastle:bcpkix-jdk15to18:1.68' | |
| implementation 'org.bouncycastle:bcprov-jdk15to18:1.68' | |
| //File Picker, but a patched version | |
| //https://github.com/codekidX/storage-chooser/issues/127 | |
| //https://github.com/codekidX/storage-chooser/issues/134 | |
| implementation 'com.github.mendhak:storage-chooser:2.0.4.4b' | |
| //CSV library | |
| implementation('org.apache.commons:commons-csv:1.9.0') | |
| //Libraries required for unit testing | |
| testImplementation 'junit:junit:4.12' | |
| testImplementation 'org.mockito:mockito-core:3.10.0' | |
| testImplementation 'org.json:json:20180813' | |
| testImplementation 'androidx.test:runner:1.4.0' | |
| testImplementation 'androidx.test:rules:1.4.0' | |
| } | |
| tasks.withType(Test) { | |
| //Tell Gradle to always run the tests even if build is up to date | |
| outputs.upToDateWhen { false } | |
| //Tell Gradle to show test output in the console | |
| testLogging { | |
| events "failed" | |
| exceptionFormat = 'full' | |
| showStandardStreams true | |
| } | |
| } | |
| tasks.whenTaskAdded { task -> | |
| //Don't run lint. Takes too long. | |
| if (task.name.contains("lint")) { | |
| task.enabled = false | |
| } | |
| } | |
| task buildTranslationArray { | |
| def foundLocales = new StringBuilder() | |
| foundLocales.append("new String[]{") | |
| fileTree("src/main/res").visit { FileVisitDetails details -> | |
| if(details.file.path.endsWith("strings.xml")){ | |
| def languageCode = details.file.parent.tokenize(File.separator).last().replaceAll('values-','').replaceAll('-r','-') | |
| languageCode = (languageCode == "values") ? "en" : languageCode; | |
| foundLocales.append("\"").append(languageCode).append("\"").append(",") | |
| } | |
| } | |
| foundLocales.append("}") | |
| //Don't forget to remove the trailing comma | |
| def foundLocalesString = foundLocales.toString().replaceAll(',}','}') | |
| android.defaultConfig.buildConfigField "String[]", "TRANSLATION_ARRAY", foundLocalesString | |
| } | |
| preBuild.dependsOn buildTranslationArray | |
| tasks.whenTaskAdded { task -> | |
| if (task.name == 'preDebugBuild' || task.name == 'preReleaseBuild') { | |
| task.dependsOn buildTranslationArray | |
| } | |
| } | |
| task buildDocs(group: "docs", type: NodeTask, dependsOn:"installNodeModules") { | |
| script = file('../assets/generate-pages/index.js') | |
| execOverrides { | |
| it.workingDir = '../assets/generate-pages' | |
| } | |
| } | |
| task installNodeModules(group:"docs", type:NpmTask){ | |
| args = ['install'] | |
| execOverrides { | |
| it.workingDir = '../assets/generate-pages' | |
| } | |
| } | |
| task copyFAQsIntoAssets(group:"docs", type:Copy){ | |
| from '../assets/text/faq' | |
| into 'src/main/assets/faq/' | |
| include('*.md') | |
| } | |
| task deleteFAQsAssets(group:"docs", type:Delete){ | |
| def dirName = 'src/main/assets/faq' | |
| fileTree( dirName ).include('**/*.md').each{ | |
| f -> delete f | |
| } | |
| } | |
| task copyFinalAPK(group:'build') { | |
| //Copies final APK to this directory | |
| def finalApkName = "gpslogger-"+android.defaultConfig.versionName+".apk" | |
| copy{ | |
| from "build/outputs/apk/release/gpslogger-release.apk" | |
| into "./" | |
| // Use a closure to map the file name | |
| rename { String fileName -> | |
| fileName.replace("gpslogger-release.apk", finalApkName) | |
| } | |
| } | |
| //PGP Sign | |
| //Verify with gpg --verify ~/Downloads/gpslogger-71.apk.asc | |
| if(file(finalApkName).isFile()){ | |
| signing { | |
| useGpgCmd() | |
| sign file(finalApkName) | |
| } | |
| //SHA256 Checksum | |
| //Verify with sha256sum -c ~/Downloads/gpslogger-71.apk.SHA256 | |
| ant.checksum(file: finalApkName, fileext: '.SHA256', algorithm: "SHA-256", pattern: "{0} {1}") | |
| } | |
| } | |
| preBuild.dependsOn copyFAQsIntoAssets | |
| clean.dependsOn deleteFAQsAssets | |
| task deleteReleaseAPKs(group:"build", type:Delete){ | |
| delete fileTree(dir:'./', include:'*.apk*') | |
| } | |
| clean.dependsOn deleteReleaseAPKs |