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

237 lines
8.4 KiB
Groovy
Raw Normal View History

2014-10-27 21:37:52 +00:00
apply plugin: 'com.android.application'
repositories {
mavenLocal()
mavenCentral()
}
2014-06-27 15:11:49 +00:00
android {
2019-05-10 22:26:04 +00:00
compileSdkVersion 28
2014-06-27 15:11:49 +00:00
defaultConfig {
versionCode 4745262
2017-03-27 01:20:24 +00:00
versionName "$I2P_VERSION"
minSdkVersion 14
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 {
2017-05-20 10:39:14 +00:00
debuggable true
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
disable 'MissingDefaultResource'
2014-06-27 16:34:01 +00:00
}
2015-04-02 12:17:06 +00:00
packagingOptions {
exclude 'LICENSE.txt'
}
flavorDimensions 'tier'
productFlavors {
free {
dimension 'tier'
applicationId 'net.i2p.android'
}
donate {
dimension 'tier'
applicationId 'net.i2p.android.donate'
}
legacy {
dimension 'tier'
applicationId 'net.i2p.android.router'
}
}
buildToolsVersion '28.0.3'
2014-06-27 15:11:49 +00:00
}
dependencies {
2015-04-02 12:17:06 +00:00
// Local dependencies
implementation project(':lib:client')
implementation project(':lib:helper')
implementation project(path: ':routerjars', configuration: 'routerjars')
2015-04-02 12:17:06 +00:00
// Android Support Repository dependencies
def supportVersion = '28.0.0'
implementation "com.android.support:support-v4:$supportVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:preference-v7:$supportVersion"
implementation "com.android.support:preference-v14:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
2015-04-02 12:17:06 +00:00
// Remote dependencies
implementation 'com.androidplot:androidplot-core:1.4.1'
implementation 'com.eowise:recyclerview-stickyheaders:0.5.2@aar'
implementation 'com.inkapplications.viewpageindicator:library:2.4.4'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation "net.i2p:router:$I2P_VERSION"
implementation "net.i2p:i2p:$I2P_VERSION"
implementation "net.i2p.client:mstreaming:$I2P_VERSION"
implementation "net.i2p.client:streaming:$I2P_VERSION"
implementation 'net.i2p.android.ext:floatingactionbutton:1.10.1'
implementation 'org.sufficientlysecure:html-textview:3.1'
2015-04-02 12:17:06 +00:00
// Testing-only dependencies
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.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
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 + '/apps/routerconsole/jsp/themes/console/images/i2plogo.png')
2014-12-12 13:17:48 +00:00
}
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 + '/apps/routerconsole/jsp/themes/console/images/i2plogo.png')
from file(i2pbase + '/apps/routerconsole/jsp/themes/console/images/inbound.png')
from file(i2pbase + '/apps/routerconsole/jsp/themes/console/images/outbound.png')
2014-12-12 13:17:48 +00:00
}
into('light') {
from file(i2pbase + '/apps/routerconsole/jsp/themes/console/light/console.css')
2014-12-12 13:17:48 +00:00
}
into('light/images') {
from file(i2pbase + '/apps/routerconsole/jsp/themes/console/light/images/header.png')
2014-12-12 13:17:48 +00:00
}
}
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
}