Upgrade support libs in client and helper libs, partially fix ProGuard issue

A release build can now be made (ProGuard no longer complains about duplicate
JARs), but the first build attempt after a clean fails because the I2P JARs
needed by the client library aren't on the javac classpath.
This commit is contained in:
str4d
2016-03-28 10:27:16 +00:00
parent 44fb246288
commit 5a9d943a6c
7 changed files with 74 additions and 69 deletions

View File

@ -52,8 +52,8 @@ android {
dependencies {
// Local dependencies
compile project(':routerjars')
compile project(':lib:client')
compile project(':routerjars')
// Android Support Repository dependencies
def supportVersion = '23.2.1'

View File

@ -25,10 +25,15 @@ android {
}
dependencies {
compile project(path: ':routerjars', configuration: 'client')
compile fileTree('libs') {
builtBy 'buildClient'
include 'i2p.jar'
include 'mstreaming.jar'
include 'streaming.jar'
}
// No direct dependencies on the helper lib, but this ensures consistent library behavior
compile project(':lib:helper')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-v4:23.2.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
@ -36,33 +41,21 @@ dependencies {
dependencyVerification {
verify = [
'com.android.support:support-v4:5c7dceb6c824089fe80f502e5206264048ef8bffa4e8ddeab180b81723e79b7f',
'com.android.support:support-v4:81ce890f26d35c75ad17d0f998a7e3230330c3b41e0b629566bc744bee89e448',
]
}
android.libraryVariants.all { variant ->
// Copy I2P client JARs into AAR
def copyClientLibsTask = tasks.create(name: "copy${variant.name.capitalize()}ClientLibs", type: Copy) {
from project(':routerjars').configurations.client.allArtifacts.collect { artifact ->
artifact.file
}
destinationDir file("${buildDir}/intermediates/bundles/${variant.dirName}/libs")
}
task buildClient(type: Exec) {
outputs.dir('libs')
commandLine 'ant', 'buildclient'
}
// Hook the copy task into the build
variant.processJavaResources.dependsOn copyClientLibsTask
copyClientLibsTask.mustRunAfter ':routerjars:buildClient'
clean.dependsOn cleanBuildClient
clean << {
exec {
commandLine 'ant', 'clean'
}
}
apply from: "${project.rootDir}/gradle/maven-push.gradle"
// Remove routerjars from dependencies
afterEvaluate { project ->
def deployer = uploadArchives.repositories.mavenDeployer
deployer*.pom*.whenConfigured { pom ->
pom.setDependencies(pom.dependencies.collect { dep ->
if (dep.groupId != 'i2p.android.base' && dep.artifactId != 'routerjars')
dep
})
}
}

50
lib/client/build.xml Executable file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="routerjars">
<property file="local.properties" />
<property name="jar.libs.dir" value="libs" />
<!-- override with i2psrc=path/to/source in local.properties -->
<property name="i2psrc" value="../../i2p.i2p" />
<property name="i2pbase" location="${i2psrc}" />
<available file="${i2pbase}" property="i2p.present" />
<fail message="I2P source directory ${i2pbase} was not found. Install it there or set i2psrc=/path/to/source in local.properties" >
<condition>
<not>
<isset property="i2p.present" />
</not>
</condition>
</fail>
<echo message="Using I2P source at ${i2pbase}" />
<property name="i2plib" location="${i2pbase}/build" />
<available property="have.streaming" file="${i2plib}/streaming.jar" />
<!-- builds core, ministreaming and streaming -->
<target name="buildStreaming" unless="have.streaming">
<ant dir="${i2pbase}" inheritall="false" useNativeBasedir="true" target="buildStreaming" />
</target>
<target name="buildclient" depends="buildStreaming">
<mkdir dir="${jar.libs.dir}" />
<!-- core -->
<!-- lots of unneeded stuff could be deleted here -->
<jar destfile="${jar.libs.dir}/i2p.jar" >
<zipfileset src="${i2plib}/i2p.jar" >
<exclude name="net/i2p/client/DomainSocketFactory.class" />
<exclude name="net/i2p/util/LogWriter.class" />
</zipfileset>
</jar>
<!-- streaming -->
<copy file="${i2plib}/mstreaming.jar" todir="${jar.libs.dir}" />
<copy file="${i2plib}/streaming.jar" todir="${jar.libs.dir}" />
</target>
<target name="clean">
<ant dir="${i2pbase}" target="distclean" />
<delete dir="${jar.libs.dir}" />
</target>
</project>

View File

@ -25,7 +25,7 @@ android {
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-v4:23.2.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
@ -33,7 +33,7 @@ dependencies {
dependencyVerification {
verify = [
'com.android.support:support-v4:5c7dceb6c824089fe80f502e5206264048ef8bffa4e8ddeab180b81723e79b7f',
'com.android.support:support-v4:81ce890f26d35c75ad17d0f998a7e3230330c3b41e0b629566bc744bee89e448',
]
}

View File

@ -1,15 +1,5 @@
apply plugin: 'java'
configurations {
client
}
configurations.default.extendsFrom configurations.client
task buildClient(type: Exec) {
outputs.dir('libs')
commandLine 'ant', 'buildclient'
}
task buildRouter(type: Exec) {
outputs.dir('libs')
commandLine 'ant', 'buildrouter'
@ -18,10 +8,6 @@ task buildRouter(type: Exec) {
// TODO an empty routerjars.jar is added to the classpath
artifacts {
client file: file('libs/i2p.jar'), builtBy: buildClient
client file: file('libs/mstreaming.jar'), builtBy: buildClient
client file: file('libs/streaming.jar'), builtBy: buildClient
'default' file: file('libs/router.jar'), builtBy: buildRouter
'default' file: file('libs/newsxml.jar'), builtBy: buildRouter
'default' file: file('libs/i2ptunnel.jar'), builtBy: buildRouter
@ -30,10 +16,10 @@ artifacts {
'default' file: file('libs/BOB.jar'), builtBy: buildRouter
}
clean.dependsOn cleanBuildClient, cleanBuildRouter
clean.dependsOn cleanBuildRouter
clean << {
exec {
commandLine 'ant', 'clean'
}
}
}

View File

@ -17,18 +17,12 @@
<echo message="Using I2P source at ${i2pbase}" />
<property name="i2plib" location="${i2pbase}/build" />
<available property="have.streaming" file="${i2plib}/streaming.jar" />
<available property="have.router" file="${i2plib}/router.jar" />
<available property="have.bob" file="${i2plib}/BOB.jar" />
<available property="have.newsxml" file="${i2pbase}/apps/routerconsole/java/build/newsxml.jar" />
<available property="have.i2ptunnel" file="${i2plib}/i2ptunnel-ui.jar" />
<available property="have.addressbook" file="${i2plib}/addressbook.jar" />
<!-- builds core, ministreaming and streaming -->
<target name="buildStreaming" unless="have.streaming">
<ant dir="${i2pbase}" inheritall="false" useNativeBasedir="true" target="buildStreaming" />
</target>
<target name="buildRouter" unless="have.router">
<ant dir="${i2pbase}" inheritall="false" useNativeBasedir="true" target="buildRouter" />
</target>
@ -47,24 +41,6 @@
<ant dir="${i2pbase}" inheritall="false" useNativeBasedir="true" target="buildBOB" />
</target>
<target name="buildclient" depends="buildStreaming">
<mkdir dir="${jar.libs.dir}" />
<!-- core -->
<!-- lots of unneeded stuff could be deleted here -->
<jar destfile="${jar.libs.dir}/i2p.jar" >
<zipfileset src="${i2plib}/i2p.jar" >
<exclude name="net/i2p/client/DomainSocketFactory.class" />
<exclude name="net/i2p/util/LogWriter.class" />
</zipfileset>
</jar>
<!-- streaming -->
<copy file="${i2plib}/mstreaming.jar" todir="${jar.libs.dir}" />
<copy file="${i2plib}/streaming.jar" todir="${jar.libs.dir}" />
</target>
<target name="buildrouter" depends="buildRouter, buildNewsXMLJar, buildI2PTunnelJar, buildAddressbook, buildBOB">
<mkdir dir="${jar.libs.dir}" />

View File

@ -1,4 +1,4 @@
include ':app', ':routerjars', ':lib:helper', ':lib:client'
include ':app', ':lib:helper', ':lib:client', ':routerjars'
//System.out.println("Do you want to access the network to download dependencies? (y/n)")
//useNet = (System.console().readLine().toLowerCase() == 'y')