Split resulting test jar into small ones (1000 files per jar)

Dex on teamcity has memory problems with large jar
This commit is contained in:
Mikhael Bogdanov
2017-04-08 14:29:35 +05:00
parent c6cdbe7eed
commit a4fef1371f
11 changed files with 32 additions and 158 deletions
@@ -1,18 +0,0 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
tested.project.dir=tested-module
@@ -64,12 +64,27 @@ android {
dexOptions {
dexInProcess false
javaMaxHeapSize "700m"
javaMaxHeapSize "300m"
//default is 4 and Total Memory = maxProcessCount * javaMaxHeapSize
maxProcessCount 2
maxProcessCount 1
additionalParameters "--debug"
}
}
task jarTestFolders() {
println "Jar folders..."
new File("${projectDir}/libs/").listFiles().each { File file ->
if (file.isDirectory()) {
println "Jar '${file.name}' folder..."
ant.jar(basedir: "libs/${file.name}/", destfile: "libs/" + file.name + ".jar")
}
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn jarTestFolders
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="testsForAndroid" default="help" basedir="">
<property file="local.properties"/>
<property file="ant.properties"/>
<loadproperties srcFile="project.properties"/>
<import file="custom_rules.xml" optional="true"/>
<import file="${sdk.dir}/tools/ant/build.xml"/>
<target name="pack_libraries">
<jar basedir="libs/codegen-test-output" destfile="libs/test.jar"/>
<delete dir="libs/codegen-test-output"/>
</target>
</project>
@@ -0,0 +1,2 @@
#don't try to download android specific tools within gradle: licence acceptance will be required
android.builder.sdkDownload=false