Files
i2p.android.base/app/build.gradle

245 lines
9.4 KiB
Groovy
Raw Normal View History

2014-10-27 21:37:52 +00:00
apply plugin: 'com.android.application'
apply plugin: 'witness'
2014-06-27 15:11:49 +00:00
android {
2015-04-13 12:05:23 +00:00
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION as String)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION as String
2014-06-27 15:11:49 +00:00
defaultConfig {
2017-03-27 03:31:16 +00:00
versionCode 4745236
2017-03-27 01:20:24 +00:00
versionName "$I2P_VERSION"
2014-06-27 15:15:15 +00:00
minSdkVersion 9
2015-04-13 12:05:23 +00:00
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
2015-04-02 12:17:06 +00:00
// For Espresso
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2014-06-27 15:11:49 +00:00
}
2014-06-27 16:29:43 +00:00
signingConfigs {
release
}
2014-06-27 15:11:49 +00:00
buildTypes {
release {
signingConfig signingConfigs.release
2015-11-22 03:39:54 +00:00
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2014-06-27 15:11:49 +00:00
}
debug {
2016-05-29 11:50:34 +00:00
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
}
2014-06-27 15:11:49 +00:00
}
2015-02-28 00:46:49 +00:00
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
2014-06-27 16:34:01 +00:00
lintOptions {
abortOnError false
}
2015-04-02 12:17:06 +00:00
packagingOptions {
exclude 'LICENSE.txt'
}
productFlavors {
free {
applicationId 'net.i2p.android'
}
donate {
applicationId 'net.i2p.android.donate'
}
legacy {
applicationId 'net.i2p.android.router'
}
}
2014-06-27 15:11:49 +00:00
}
dependencies {
2015-04-02 12:17:06 +00:00
// Local dependencies
2015-11-23 03:04:43 +00:00
compile project(':lib:client')
compile project(':lib:helper')
compile project(':routerjars')
2015-04-02 12:17:06 +00:00
// Android Support Repository dependencies
def supportVersion = '25.3.1'
compile "com.android.support:support-v4:$supportVersion"
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:preference-v7:$supportVersion"
compile "com.android.support:preference-v14:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
2015-04-02 12:17:06 +00:00
// Remote dependencies
2017-03-27 00:40:05 +00:00
compile 'com.androidplot:androidplot-core:1.4.1'
compile 'com.eowise:recyclerview-stickyheaders:0.5.2@aar'
2017-03-27 00:40:05 +00:00
compile 'com.inkapplications.viewpageindicator:library:2.4.4'
compile 'com.pnikosis:materialish-progress:1.7'
2017-03-27 01:20:24 +00:00
compile "net.i2p:router:$I2P_VERSION"
compile 'net.i2p.android.ext:floatingactionbutton:1.10.1'
2017-03-27 00:40:05 +00:00
compile 'org.sufficientlysecure:html-textview:3.1'
2015-04-02 12:17:06 +00:00
// Testing-only dependencies
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude group: 'com.android.support', module: 'support-annotations'
}
2014-06-27 15:11:49 +00:00
}
2014-06-27 16:29:43 +00:00
dependencyVerification {
verify = [
'com.android.support:support-v4:07d389154bcf73b47e514964df1578136b26cba78257b8a577a3ccb54beff0ae',
'com.android.support:appcompat-v7:ac1ebbc46589195dda3e0b1becfe410bafd75bdf3edd1cd9acf04850f3895830',
'com.android.support:preference-v7:b37d8193c65cf8eb3c4ba9cbfc6d5c96042177901622717fb089290bef784a58',
'com.android.support:preference-v14:970904d676ea886d0be459e7e5e36c0db650daefea5bbe80cc59146091905be5',
'com.android.support:recyclerview-v7:375974a8724e359d97d77fa8522c614f813a3ac4583c1807f154a3f9a054b0a1',
2017-03-27 00:40:05 +00:00
'com.androidplot:androidplot-core:7670da5838ce2ae2b0b5faabeb9d6a1f2787d30d3fe9f0952adc5611910d18c0',
'com.eowise:recyclerview-stickyheaders:7b236da49b33b840e9ba6e7e4182218d1a2d9047236fdbc3ca947352f9b0883b',
2017-03-27 00:40:05 +00:00
'com.inkapplications.viewpageindicator:library:77b26a7723cd10fa5e29480be239e8d68f431f4bc20d9144169c9ce06ebac2bf',
'com.pnikosis:materialish-progress:da089a90d1dab61e9b50038c09081019398f81190d12b0b567ce94b83ef8cf93',
'net.i2p:router:ffbc2ca2817ad5822c924822ce94e60929dd0caa4d9f4c97a1e324b7bc203b80',
'net.i2p.android.ext:floatingactionbutton:09d43e2d4ac04a91bf7a37e1ec48a8d220204e3a55dca72cd36cd9fa27461ade',
2017-03-27 00:40:05 +00:00
'org.sufficientlysecure:html-textview:ed740adf05cae2373999c7a3047c803183d9807b2cf66162902090d7c112a832',
]
}
project.ext.i2pbase = '../i2p.i2p'
2014-06-27 16:29:43 +00:00
def Properties props = new Properties()
2014-06-28 02:03:39 +00:00
def propFile = new File(project(':routerjars').projectDir, 'local.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null &&
props.containsKey('i2psrc')) {
i2pbase = props['i2psrc']
} else {
println 'local.properties found but some entries are missing'
}
} else {
println 'local.properties not found'
}
task certificatesZip(type: Zip) {
archiveName = 'certificates_zip'
from files('' + i2pbase + '/installer/resources/certificates')
}
2014-12-12 13:17:48 +00:00
task copyI2PResources(type: Copy) {
// Force this to always run: Copy only detects source changes, not if missing in destination
outputs.upToDateWhen { false }
into 'src/main/res'
into('drawable') {
from file(i2pbase + '/installer/resources/themes/console/images/i2plogo.png')
}
into('raw') {
from(i2pbase + '/installer/resources/blocklist.txt') { rename { 'blocklist_txt' } }
from(i2pbase + '/installer/resources/hosts.txt') { rename { 'hosts_txt' } }
from(i2pbase + '/installer/resources/proxy') {
include { elem ->
elem.name.endsWith('.ht')
}
rename { String name ->
name.toLowerCase(Locale.US).replace('-', '_').replace('.', '_')
}
filter { String line ->
// Remove links to routerconsole
def m = line =~ /127.0.0.1:7657/
if (m.getCount()) {
// Links around content
line = line.replaceAll(/<a href="http:\/\/127.0.0.1:7657[^>]*>(.+?)<\/a>/) { fullmatch, content ->
content
}
// Links in translation substitutions
line = line.replaceAll(/"<a href=\\"http:\/\/127.0.0.1:7657[^>]*>", "<\/a>"/, '"", ""')
}
// Remove "Configuration - Help - Addressbook" heading
def n = line =~ /Configuration.+Help.+Addressbook/
if (n.getCount())
""
else
line
}
}
2014-12-12 13:17:48 +00:00
from('../LICENSE.txt') { rename { 'license_app_txt' } }
from('../licenses/LICENSE-Apache2.0.txt') { rename { 'license_apache20_txt' } }
from(i2pbase + '/licenses') {
include { elem ->
elem.name in [
'LICENSE-ElGamalDSA.txt',
'LICENSE-SHA256.txt',
'LICENSE-BSD.txt',
'LICENSE-SNTP.txt',
'LICENSE-LGPLv2.1.txt',
'LICENSE-InstallCert.txt',
'LICENSE-BlockFile.txt',
'LICENSE-GPLv2.txt',
'LICENSE-GPLv3.txt',
'LICENSE-LGPLv3.txt',
'LICENSE-FatCowIcons.txt',
'LICENSE-Addressbook.txt',
]
}
rename { String name ->
name.toLowerCase(Locale.US).replace('-', '_').replace('.', '_')
2014-12-12 13:17:48 +00:00
}
2014-06-28 02:03:39 +00:00
}
2014-12-12 13:17:48 +00:00
from certificatesZip
2014-08-22 11:50:53 +00:00
}
}
// For peers WebView
2014-12-12 13:17:48 +00:00
task copyI2PAssets(type: Copy) {
// Force this to always run: Copy only detects source changes, not if missing in destination
outputs.upToDateWhen { false }
into 'src/main/assets/themes/console'
into('images') {
from file(i2pbase + '/installer/resources/themes/console/images/i2plogo.png')
from file(i2pbase + '/installer/resources/themes/console/images/inbound.png')
from file(i2pbase + '/installer/resources/themes/console/images/outbound.png')
}
into('light') {
from file(i2pbase + '/installer/resources/themes/console/light/console.css')
}
into('light/images') {
from file(i2pbase + '/installer/resources/themes/console/light/images/header.png')
}
}
preBuild.dependsOn copyI2PResources
preBuild.dependsOn copyI2PAssets
2014-06-28 02:03:39 +00:00
task cleanI2PResources(type: Delete) {
delete file('src/main/res/drawable/i2plogo.png')
delete fileTree('src/main/res/raw') {
include 'blocklist_txt'
include 'hosts_txt'
include '*_ht'
2014-06-28 02:03:39 +00:00
include 'license_*'
include 'certificates_zip'
}
}
task cleanI2PAssets(type: Delete) {
2014-08-22 11:50:53 +00:00
delete fileTree('src/main/assets/themes/console/images')
delete file('src/main/assets/themes/console/light/console.css')
delete file('src/main/assets/themes/console/light/images/header.png')
2014-06-28 02:03:39 +00:00
}
2014-06-28 02:03:39 +00:00
clean.dependsOn cleanI2PResources
clean.dependsOn cleanI2PAssets
2014-06-28 02:03:39 +00:00
props = new Properties()
propFile = new File(project.rootDir, 'signing.properties')
2014-06-27 16:29:43 +00:00
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
}