apply plugin: 'com.android.application' apply plugin: 'android-apt' android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.github.dfa.diaspora_android" minSdkVersion 17 targetSdkVersion 24 versionCode 8 versionName "0.1.6-next" setProperty("archivesBaseName", "diasporaAndroid__${versionName}__") vectorDrawables.useSupportLibrary=true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { disable 'MissingTranslation' } } repositories { maven { //Color picker url "http://dl.bintray.com/dasar/maven" } } dependencies { // Sub-Projects //compile project(':subprojectFromRoot') // Jars compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' // Android standard libs compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support:design:24.1.0' //Don't update. Broken up to 24.2.1 compile 'com.android.support:support-v4:24.2.1' compile "com.android.support:customtabs:24.2.1" // More libraries compile 'com.jakewharton:butterknife:8.0.1' compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1' compile 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1' compile(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar') //Color picker apt 'com.jakewharton:butterknife-compiler:8.0.1' } task copyRepoFiles(type: Copy) { String[] copyFiles = ["README.md", "LICENSE.md", "CHANGELOG.md"] from rootProject.files(copyFiles) into 'src/main/res/raw' rename { String fileName -> fileName.replace(fileName, fileName.toLowerCase()) } // Filter Contributors file from(rootProject.file("CONTRIBUTORS.txt")) { into '.' // Target already changed to 'src/main/res/raw' rename { String fileName -> fileName.replace(fileName, fileName.toLowerCase()) } filter { line -> (line.toString().matches("..l>>.*") || line.toString().startsWith("## 99l CONTRIBUTORS")) ? null : line.toString().trim().replaceAll(" \\(.*\\)", "") } } // Download Podlist final String PODLIST_PATH = "app/src/main/res/raw/podlist.json" final String PODLIST_URL = 'https://raw.githubusercontent.com/Diaspora-for-Android/diaspora-android-extras/master/podList/podlist.json' downloadFile(PODLIST_PATH, PODLIST_URL, false) // Do if we build in release (signed apk) mode android.applicationVariants.all { v -> if (v.buildType.name == "release"){ v.assemble.doFirst { downloadFile(PODLIST_PATH, PODLIST_URL, true) } } } } def downloadFile(filePath, url, downloadIfExists ) { def f = new File(filePath) if (f.exists() && downloadIfExists){ f.delete(); } if (!f.exists()) { new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }} } } tasks.copyRepoFiles.execute()