BobStore/F-Droid/build.gradle
Hans-Christoph Steiner 8d20135779 swap: close resources reported by StrictMode
This required rebuilding the zipsigner.jar, since there was once issue to
be fixed in kellingwood.security.zipsigner.ZipSigner.

Here are the stacktraces:

            StrictMode  E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'close' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.io.FileOutputStream.<init>(FileOutputStream.java:90)
                        E      at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
                        E      at java.io.FileWriter.<init>(FileWriter.java:42)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)
                        E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'close' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128)
                        E      at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57)
                        E      at kellinwood.zipio.ZipInput.read(ZipInput.java:75)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)
                        E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'end' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.util.zip.Inflater.<init>(Inflater.java:82)
                        E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475)
                        E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445)
                        E      at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)

StrictMode  E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'close' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.io.FileOutputStream.<init>(FileOutputStream.java:90)
            E      at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
            E      at java.io.FileWriter.<init>(FileWriter.java:42)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
            E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'close' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128)
            E      at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57)
            E      at kellinwood.zipio.ZipInput.read(ZipInput.java:75)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646)
            E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
            E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'end' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.util.zip.Inflater.<init>(Inflater.java:82)
            E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475)
            E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445)
            E      at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647)
            E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
2015-09-10 18:42:35 +02:00

197 lines
7.0 KiB
Groovy

apply plugin: 'com.android.application'
if (!hasProperty('sourceDeps')) {
repositories {
jcenter()
// This is here until we sort out all dependencies from mavenCentral/jcenter. Once all of
// the dependencies below have been sorted out, this can be removed.
flatDir {
dirs 'libs/binaryDeps'
}
}
dependencies {
compile project(':privileged-api-lib')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.zxing:core:3.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
compile 'cc.mvdan.accesspoint:library:0.1.2'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'com.madgag.spongycastle:pkix:1.51.0.0'
compile 'com.madgag.spongycastle:prov:1.51.0.0'
compile 'com.madgag.spongycastle:core:1.51.0.0'
// Upstream doesn't have a binary on mavenCentral/jcenter yet:
// https://github.com/kolavar/android-support-v4-preferencefragment/issues/13
compile(name: 'support-v4-preferencefragment-release', ext: 'aar')
// Fork for F-Droid, including support for https. Not merged into upstream
// yet (seems to be a little unsupported as of late), so not using mavenCentral/jcenter.
compile(name: 'nanohttpd-2.1.0')
// Upstream doesn't have a binary on mavenCentral, and it is an SVN repo on
// Google Code. We include this code directly in this repo, and have made
// modifications that should be pushed to anyone who wants to maintain it.
compile(name: 'zipsigner')
// Project semi-abandoned, 3.4.1 is from 2011 and we use trunk from 2013
// TODO: active again and 3.4.2 now released, switch when available in jcenter:
// https://github.com/openhab/jmdns/issues/6
compile(name: 'jmdns')
androidTestCompile 'commons-io:commons-io:2.2'
}
} else {
logger.info "Setting up *source* dependencies for F-Droid (because you passed in the -PsourceDeps argument to gradle while building)."
repositories {
jcenter()
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.1'
compile project(':privileged-api-lib')
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.zxing:core:3.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
compile 'cc.mvdan.accesspoint:library:0.1.1'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile(project(':extern:support-v4-preferencefragment')) {
exclude module: 'support-v4'
}
compile project(':extern:nanohttpd:core')
compile project(':extern:zipsigner')
compile project(':extern:jmdns')
androidTestCompile 'commons-io:commons-io:2.2'
}
}
task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') {
enabled = project.hasProperty('sourceDeps')
description = "Copies .jar and .aar files from subproject dependencies in extern/ to F-Droid/libs. Requires the sourceDeps property to be set (\"gradle -PsourceDeps binaryDeps\")"
from('../extern/') {
include 'support-v4-preferencefragment/build/outputs/aar/support-v4-preferencefragment-release.aar'
include 'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar'
include 'zipsigner/build/libs/zipsigner.jar'
include 'jmdns/build/libs/jmdns.jar'
}
into 'libs/binaryDeps'
includeEmptyDirs false
eachFile { FileCopyDetails details ->
// Don't copy to a sub folder such as libs/binaryDeps/Project/build/outputs/aar/project.aar, but
// rather libs/binaryDeps/project.aar.
details.path = details.name
}
}
android {
compileSdkVersion 22
buildToolsVersion '23.0.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
androidTest.setRoot('test')
androidTest {
manifest.srcFile 'test/AndroidManifest.xml'
java.srcDirs = ['test/src']
resources.srcDirs = ['test/src']
aidl.srcDirs = ['test/src']
renderscript.srcDirs = ['test/src']
res.srcDirs = ['test/res']
assets.srcDirs = ['test/assets']
}
}
buildTypes {
all {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
compileOptions {
compileOptions.encoding = "UTF-8"
// Use Java 1.7, requires minSdk 8
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
checkReleaseBuilds false
abortOnError false
htmlReport true
xmlReport false
textReport false
// Our translations are crowd-sourced
disable 'MissingTranslation'
}
}
// This person took the example code below from another blogpost online, however
// I lost the reference to it:
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
android.applicationVariants.all { variant ->
task("generate${variant.name}Javadoc", type: Javadoc) {
title = "$name $version API"
description "Generates Javadoc for F-Droid."
source = variant.javaCompile.source
def sdkDir
Properties properties = new Properties()
File localProps = project.rootProject.file('local.properties')
if (localProps.exists()) {
properties.load(localProps.newDataInputStream())
sdkDir = properties.getProperty('sdk.dir')
} else {
sdkDir = System.getenv('ANDROID_HOME')
}
if (!sdkDir) {
throw new ProjectConfigurationException("Cannot find android sdk. Make sure sdk.dir is defined in local.properties or the environment variable ANDROID_HOME is set.", null)
}
ext.androidJar = "${sdkDir}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
options.links("http://docs.oracle.com/javase/7/docs/api/");
options.links("http://d.android.com/reference/");
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
}