import java.security.MessageDigest buildscript { repositories { maven { url "https://repo1.maven.org/maven2" jcenter() } } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' classpath files('libs/gradle-witness.jar') classpath 'me.tatarka:gradle-retrolambda:3.7.0' } } apply plugin: 'com.android.application' apply plugin: 'witness' apply plugin: 'me.tatarka.retrolambda' repositories { maven { url "https://repo1.maven.org/maven2/" } maven { url "https://raw.github.com/whispersystems/maven/master/preferencefragment/releases/" } maven { url "https://raw.github.com/whispersystems/maven/master/smil/releases/" } maven { url "https://raw.github.com/whispersystems/maven/master/photoview/releases/" } maven { url "https://raw.github.com/whispersystems/maven/master/shortcutbadger/releases/" } maven { url "https://maven.google.com" } maven { // textdrawable url 'https://dl.bintray.com/amulyakhare/maven' } jcenter() mavenLocal() } dependencies { compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support:recyclerview-v7:26.1.0' compile 'com.android.support:design:26.1.0' compile 'com.android.support:support-v13:26.1.0' compile 'com.android.support:cardview-v7:26.1.0' compile 'com.android.support:preference-v7:26.1.0' compile 'com.android.support:preference-v14:26.1.0' compile 'com.android.support:gridlayout-v7:26.1.0' compile 'com.android.support:multidex:1.0.2' compile 'com.google.android.gms:play-services-gcm:9.6.1' compile 'com.google.android.gms:play-services-maps:9.6.1' compile 'com.google.android.gms:play-services-places:9.6.1' compile 'com.google.android.exoplayer:exoplayer:r2.3.1' compile 'org.whispersystems:jobmanager:1.0.2' compile 'org.whispersystems:libpastelog:1.0.7' compile 'org.whispersystems:signal-service-android:2.6.11' compile 'org.whispersystems:webrtc-android:M63' compile "me.leolin:ShortcutBadger:1.1.16" compile 'se.emilsjolander:stickylistheaders:2.7.0' compile 'com.jpardogo.materialtabstrip:library:1.0.9' compile 'org.apache.httpcomponents:httpclient-android:4.3.5' compile 'com.github.chrisbanes:PhotoView:2.1.3' compile 'com.github.bumptech.glide:glide:4.3.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.3.0' compile 'com.makeramen:roundedimageview:2.1.0' compile 'com.pnikosis:materialish-progress:1.5' compile 'org.greenrobot:eventbus:3.0.0' compile 'pl.tajchert:waitingdots:0.1.0' compile 'com.soundcloud.android:android-crop:0.9.10@aar' compile 'com.melnykov:floatingactionbutton:1.3.0' compile 'com.google.zxing:android-integration:3.1.0' compile 'com.squareup.dagger:dagger:1.2.2' compile ("com.doomonafireball.betterpickers:library:1.5.3") { exclude group: 'com.android.support', module: 'support-v4' } provided 'com.squareup.dagger:dagger-compiler:1.2.2' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'com.google.zxing:core:3.2.1' compile ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { exclude group: 'com.android.support', module: 'support-annotations' } compile ('cn.carbswang.android:NumberPickerView:1.0.9') { exclude group: 'com.android.support', module: 'appcompat-v7' } compile ('com.tomergoldst.android:tooltips:1.0.6') { exclude group: 'com.android.support', module: 'appcompat-v7' } compile ('com.klinkerapps:android-smsmms:4.0.1') { exclude group: 'com.squareup.okhttp', module: 'okhttp' exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection' } compile 'com.annimon:stream:1.1.8' compile ('com.takisoft.fix:colorpicker:0.9.1') { exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'recyclerview-v7' } compile 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4' compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3' testCompile 'junit:junit:4.12' testCompile 'org.assertj:assertj-core:1.7.1' testCompile 'org.mockito:mockito-core:1.9.5' testCompile 'org.powermock:powermock-api-mockito:1.6.1' testCompile 'org.powermock:powermock-module-junit4:1.6.1' testCompile 'org.powermock:powermock-module-junit4-rule:1.6.1' testCompile 'org.powermock:powermock-classloading-xstream:1.6.1' androidTestCompile 'com.android.support:multidex:1.0.2' androidTestCompile 'com.android.support:multidex-instrumentation:1.0.2' androidTestCompile 'com.google.dexmaker:dexmaker:1.2' androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' androidTestCompile ('org.assertj:assertj-core:1.7.1') { exclude group: 'org.hamcrest', module: 'hamcrest-core' } androidTestCompile ('com.squareup.assertj:assertj-android:1.1.1') { exclude group: 'org.hamcrest', module: 'hamcrest-core' exclude group: 'com.android.support', module: 'support-annotations' } } dependencyVerification { verify = [ 'com.android.support:appcompat-v7:9d44e7bf343dfd19a55e3e6f4c4e733b68d32509e0b0af5b32f2981f4f1dedd8', 'com.android.support:recyclerview-v7:389cb47a7dabca4fb8c23657ff7c85ebc651428580d3a5ea0349eeb43ddea94b', 'com.android.support:design:76f5fbb365bf2d622af5df8a4205904409250305685e38670bf654ac90c2494d', 'com.android.support:support-v13:fc7ba35b0502a6168b350342779c6943100ace19cd6dd573707bddfa8e9e78a2', 'com.android.support:cardview-v7:7ea56ed5560b629ee1c0f24af6693e32974fbc8b91b544052cd2c14b176c85e0', 'com.android.support:preference-v7:42672e51c06c6e26a40798d3379ede97ee42076c84592d670c4e5c96630c50f1', 'com.android.support:preference-v14:f340c88589184fd53ad46aebbba1ae5b88b5919f92ed085bf0f687a58d0e0e17', 'com.android.support:gridlayout-v7:6fe57dd164f2e1d99ad650a56f686ddecd02bfbfabbfbd451e81a23eada5e564', 'com.android.support:multidex:7cd48755c7cfdb6dd2d21cbb02236ec390f6ac91cde87eb62f475b259ab5301d', 'com.google.android.gms:play-services-gcm:312e61253a236f2d9b750b9c04fc92fd190d23b0b2755c99de6ce4a28b259dae', 'com.google.android.gms:play-services-maps:45e8021e7ddac4a44a82a0e9698991389ded3023d35c58f38dbd86d54211ec0e', 'com.google.android.gms:play-services-places:abf3a4a3b146ec7e6e753be62775e512868cf37d6f88ffe2d81167b33b57132b', 'com.google.android.exoplayer:exoplayer:955085aa611a8f7cf6c61b88ae03d1a392f4ad94c9bfbc153f3dedb9ffb14718', 'org.whispersystems:jobmanager:506f679fc2fcf7bb6d10f00f41d6f6ea0abf75c70dc95b913398661ad538a181', 'org.whispersystems:libpastelog:bb331d9a98240fc139101128ba836c1edec3c40e000597cdbb29ebf4cbf34d88', 'org.whispersystems:signal-service-android:89f8630cc1737c3d52178dc46926f0755d75fed3ac9b94d067c0a42e4e3169c9', 'org.whispersystems:webrtc-android:3f5c39b710797fbda9fe6015cb6a8667ab2fc14ef2c1eb9be832a53b368aa110', 'me.leolin:ShortcutBadger:e3cb3e7625892129b0c92dd5e4bc649faffdd526d5af26d9c45ee31ff8851774', 'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb', 'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa', 'org.apache.httpcomponents:httpclient-android:6f56466a9bd0d42934b90bfbfe9977a8b654c058bf44a12bdc2877c4e1f033f1', 'com.github.chrisbanes:PhotoView:ed06775308da260e1fd86d1d3288988fcd3d80db24ce0d7c9fcfedc39e622292', 'com.github.bumptech.glide:glide:cf770a66bdb42d90663672a3e44b8e4f4fb060073294af5ebd323c5db415b22f', 'com.makeramen:roundedimageview:1f5a1865796b308c6cdd114acc6e78408b110f0a62fc63553278fbeacd489cd1', 'com.pnikosis:materialish-progress:d71d80e00717a096784482aee21001a9d299fec3833e4ebd87739ed36cf77c54', 'org.greenrobot:eventbus:180d4212467df06f2fbc9c8d8a2984533ac79c87769ad883bc421612f0b4e17c', 'pl.tajchert:waitingdots:2835d49e0787dbcb606c5a60021ced66578503b1e9fddcd7a5ef0cd5f095ba2c', 'com.soundcloud.android:android-crop:ffd4b973cf6e97f7d64118a0dc088df50e9066fd5634fe6911dd0c0c5d346177', 'com.melnykov:floatingactionbutton:15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263', 'com.google.zxing:android-integration:89e56aadf1164bd71e57949163c53abf90af368b51669c0d4a47a163335f95c4', 'com.squareup.dagger:dagger:789aca24537022e49f91fc6444078d9de8f1dd99e1bfb090f18491b186967883', 'com.doomonafireball.betterpickers:library:132ecd685c95a99e7377c4e27bfadbb2d7ed0bea995944060cd62d4369fdaf3d', 'com.amulyakhare:com.amulyakhare.textdrawable:54c92b5fba38cfd316a07e5a30528068f45ce8515a6890f1297df4c401af5dcb', 'com.google.zxing:core:b4d82452e7a6bf6ec2698904b332431717ed8f9a850224f295aec89de80f2259', 'com.davemorrissey.labs:subsampling-scale-image-view:550c5baa07e0bb4ff0a18b705e96d34436d22619248bd8c08c08c730b1f55cfe', 'cn.carbswang.android:NumberPickerView:18b3c316d62c7c277978a8d4ed57a5b8f4e943762264960f579a8a549c756729', 'com.tomergoldst.android:tooltips:4c56697dd1ad64b8066535c61f961a6d901e7ae5d97ae27084ba40ad620349b6', 'com.klinkerapps:android-smsmms:e7c3328a0f3a8dd44daa8129de4e99996f3057a4546e47891b036b81e0ebf1d1', 'com.annimon:stream:5da6e2e3e0551d61a3ea7014f04312276549e3dd739cf637996e4cf43c5535b9', 'com.takisoft.fix:colorpicker:f5d0dbabe406a1800498ca9c1faf34db36e021d8488bf10360f29961fe3ab0d1', 'com.codewaves.stickyheadergrid:stickyheadergrid:5b4aa6a52a957cfd55f60f4220c11c0c371385a3cb9786cae03c260dcdef5794', 'com.github.dmytrodanylyk.circular-progress-button:library:635882453475181d737719b2adef658d80f9f85c9bdaf022f06cd22f387cdb16', 'com.android.support:support-annotations:99d6199ad5a09a0e5e8a49a4cc08f818483ddcfd7eedea2f9923412daf982309', 'com.android.support:support-v4:36d8385de1be7791231acb933b757198f97cb53bc7d046e8c4bc403d214caaca', 'com.android.support:support-vector-drawable:1151b7f0ea29c9a9a8fee042a1dbe82f196632d801c438d08b279e131c767118', 'com.android.support:animated-vector-drawable:d5905aee3c8a4ac75e069a73b914c0a41b9b36b0e6b04126719fca22659d3cc8', 'com.android.support:support-compat:7d6da01cf9766b1705c6c80cfc12274a895b406c4c287900b07a56145ca6c030', 'com.android.support:support-core-ui:82f538051599335ea881ec264407547cab52be750f16ce099cfb27754fc755ff', 'com.android.support:transition:c5d3d1204997f80af1f4a3a315a54b1a23543c554963cef831da726aac34b56f', 'com.google.android.gms:play-services-base:0ca636a8fc9a5af45e607cdcd61783bf5d561cbbb0f862021ce69606eee5ad49', 'com.google.android.gms:play-services-basement:95dd882c5ffba15b9a99de3fefb05d3a01946623af67454ca00055d222f85a8d', 'com.google.android.gms:play-services-iid:54e919f9957b8b7820da7ee9b83471d00d0cac1cf08ddea8b5b41aea80bb1a70', 'org.whispersystems:signal-protocol-android:5b8acded7f2a40178eb90ab8e8cbfec89d170d91b3ff5e78487d1098df6185a1', 'org.whispersystems:signal-service-java:ef89da56b915490bb907d848eae79efdf1218e985763e7dd2e8047c7ccb03c0c', 'com.github.bumptech.glide:gifdecoder:fe793861d4d4619b5041d3bd68186000b6151581292053e88c96a5d0b60e5337', 'com.github.bumptech.glide:disklrucache:b5cf8f76b423a6c86edbe82380958adbe6a2f1d5afbd6add23a9c8ad141eb406', 'com.github.bumptech.glide:annotations:10a910f62ee27de5f0e44a72acb7fe31ed1e45b3ffac82fb3a8ebada150765f1', 'com.nineoldandroids:library:68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a', 'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff', 'com.klinkerapps:logger:177e325259a8b111ad6745ec10db5861723c99f402222b80629f576f49408541', 'com.google.android:flexbox:a9989fd13ae2ee42765dfc515fe362edf4f326e74925d02a10369df8092a4935', 'android.arch.lifecycle:runtime:e4e34e5d02bd102e8d39ddbc29f9ead8a15a61e367993d02238196ac48509ad8', 'com.google.android.gms:play-services-tasks:69ec265168e601d0203d04cd42e34bb019b2f029aa1e16fabd38a5153eea2086', 'org.whispersystems:curve25519-android:82595394422b957d4a5b5f1b27b75ba25cf6dc4db4d312418ca38cd6fff279ca', 'org.whispersystems:signal-protocol-java:5152c2b01a25147967d6bf82e540f947901bdfa79260be3eb3e96b03f787d6b5', 'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', 'com.googlecode.libphonenumber:libphonenumber:be23ec6195df9f328364a3122ddd111e30f42d18a841dd06f84d2685c7fabb9f', 'com.fasterxml.jackson.core:jackson-databind:835097bcdd11f5bc8a08378c70d4c8054dfa4b911691cc2752063c75534d198d', 'com.squareup.okhttp3:okhttp:c1d57f913f74f61d424d4250a92723ba9a61affc12a0ab194d84cc179b472841', 'com.madgag.spongycastle:prov:b8c3fec3a59aac1aa04ccf4dad7179351e54ef7672f53f508151b614c131398a', 'android.arch.lifecycle:common:86bf301a20ad0cd0a391e22a52e6fbf90575c096ff83233fa9fd0d52b3219121', 'android.arch.core:common:5192934cd73df32e2c15722ed7fc488dde90baaec9ae030010dd1a80fb4e74e1', 'org.whispersystems:curve25519-java:7dd659d8822c06c3aea1a47f18fac9e5761e29cab8100030b877db445005f03e', 'com.fasterxml.jackson.core:jackson-annotations:0ca408c24202a7626ec8b861e99d85eca5e38b73311dd6dd12e3e9deecc3fe94', 'com.fasterxml.jackson.core:jackson-core:cbf4604784b4de226262845447a1ad3bb38a6728cebe86562e2c5afada8be2c0', 'com.squareup.okio:okio:734269c3ebc5090e3b23566db558f421f0b4027277c79ad5d176b8ec168bb850', 'com.madgag.spongycastle:core:8d6240b974b0aca4d3da9c7dd44d42339d8a374358aca5fc98e50a995764511f', 'com.android.support:support-media-compat:9d8cee7cd40eff22ebdeb90c8e70f5ee96c5bd25cb2c3e3b3940e27285a3e98a', 'com.android.support:support-core-utils:4fda6d4eb430971e3b1dad7456988333f374b0f4ba15f99839ca1a0ab5155c8a', 'com.android.support:support-fragment:a0ab3369ef40fe199160692f0463a5f63f1277ebfb64dd587c76fdb128d76b32', ] } android { compileSdkVersion 26 buildToolsVersion '25.0.2' useLibrary 'org.apache.http.legacy' dexOptions { javaMaxHeapSize "4g" } defaultConfig { versionCode 307 versionName "4.12.2" minSdkVersion 14 targetSdkVersion 22 multiDexEnabled true vectorDrawables.useSupportLibrary = true project.ext.set("archivesBaseName", "Signal"); buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L" buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service.whispersystems.org\"" buildConfigField "String", "SIGNAL_CDN_URL", "\"https://cdn.signal.org\"" buildConfigField "String", "GIPHY_PROXY_HOST", "\"giphy-proxy-production.whispersystems.org\"" buildConfigField "int", "GIPHY_PROXY_PORT", "80" buildConfigField "String", "USER_AGENT", "\"OWA\"" buildConfigField "boolean", "DEV_BUILD", "false" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } packagingOptions { exclude 'LICENSE.txt' exclude 'LICENSE' exclude 'NOTICE' exclude 'asm-license.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' } signingConfigs { release } buildTypes { debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-google-play-services.pro', 'proguard-dagger.pro', 'proguard-jackson.pro', 'proguard-sqlite.pro', 'proguard-appcompat-v7.pro', 'proguard-square-okhttp.pro', 'proguard-square-okio.pro', 'proguard-spongycastle.pro', 'proguard-rounded-image-view.pro', 'proguard-glide.pro', 'proguard-shortcutbadger.pro', 'proguard-retrofit.pro', 'proguard-webrtc.pro', 'proguard-klinker.pro', 'proguard-retrolambda.pro', 'proguard-okhttp.pro', 'proguard.cfg' testProguardFiles 'proguard-automation.pro', 'proguard.cfg' } release { minifyEnabled true proguardFiles = buildTypes.debug.proguardFiles signingConfig signingConfigs.release } } productFlavors { play { ext.websiteUpdateUrl = "null" buildConfigField "boolean", "PLAY_STORE_DISABLED", "false" buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl" } website { ext.websiteUpdateUrl = "https://updates.signal.org/android" buildConfigField "boolean", "PLAY_STORE_DISABLED", "true" buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\"" } } applicationVariants.all { variant -> variant.outputs.each { output -> output.outputFile = new File( output.outputFile.parent, output.outputFile.name.replace(".apk", "-${variant.versionName}.apk")) } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } androidTest { java.srcDirs = ['test/androidTest/java'] } test { java.srcDirs = ['test/unitTest/java'] } website.manifest.srcFile 'website/AndroidManifest.xml' } lintOptions { abortOnError false } } task assembleWebsiteDescriptor << { android.applicationVariants.all { variant -> if (variant.name.equals("websiteDebug") || variant.name.equals("websiteRelease")) { File file = new File(variant.outputs[0].outputFile.path) if (file.exists()) { MessageDigest md = MessageDigest.getInstance("SHA-256"); file.eachByte 4096, {bytes, size -> md.update(bytes, 0, size); } String digest = md.digest().collect {String.format "%02x", it}.join(); String url = variant.productFlavors.get(0).ext.websiteUpdateUrl String apkName = variant.outputs[0].outputFile.name String descriptor = "{" + "\"versionCode\" : $project.android.defaultConfig.versionCode," + "\"versionName\" : \"$project.android.defaultConfig.versionName\"," + "\"sha256sum\" : \"$digest\"," + "\"url\" : \"$url/$apkName\"" + "}" File descriptorFile = new File(variant.outputs[0].outputFile.parent, apkName.replace(".apk", ".json")) descriptorFile.write(descriptor) } } } } tasks.whenTaskAdded { task -> if (task.name.equals("lint")) { task.enabled = false } if (task.name.equals("assembleWebsiteDebug") || task.name.equals("assembleWebsiteRelease")) { task.finalizedBy assembleWebsiteDescriptor } } def getLastCommitTimestamp() { new ByteArrayOutputStream().withStream { os -> def result = exec { executable = 'git' args = ['log', '-1', '--pretty=format:%ct'] standardOutput = os } return os.toString() + "000" } } def Properties props = new Properties() def propFile = new File('signing.properties') if (propFile.canRead()){ props.load(new FileInputStream(propFile)) if (props !=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') && props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) { android.signingConfigs.release.storeFile = file(props['STORE_FILE']) android.signingConfigs.release.storePassword = props['STORE_PASSWORD'] android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] android.signingConfigs.release.keyPassword = props['KEY_PASSWORD'] } else { println 'signing.properties found but some entries are missing' android.buildTypes.release.signingConfig = null } }else { println 'signing.properties not found' android.buildTypes.release.signingConfig = null }