Remove support for building entirely from source
* Hard to keep both regular and source builds working and bug-free * Keep -PsourceDeps to package jars for libs which are not yet in jcenter * Use the libs packaged in jcenter the same way in both builds * Remove cleanBinaryDeps, can be done via the shell easily
This commit is contained in:
parent
13c90e6c4a
commit
3d749120a7
@ -1,8 +1,6 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
if (!hasProperty('sourceDeps')) {
|
if (!hasProperty('sourceDeps')) {
|
||||||
|
|
||||||
logger.info "Setting up *binary* dependencies for F-Droid (if you'd prefer to build from source, pass the -PsourceDeps argument to gradle while building)."
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
||||||
@ -25,9 +23,6 @@ if (!hasProperty('sourceDeps')) {
|
|||||||
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
|
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
|
||||||
compile 'cc.mvdan.accesspoint:library:0.1.1'
|
compile 'cc.mvdan.accesspoint:library:0.1.1'
|
||||||
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
||||||
|
|
||||||
// We use a slightly modified spongycastle, see
|
|
||||||
// openkeychain/spongycastle with some changes on top of 1.51.0.0
|
|
||||||
compile 'com.madgag.spongycastle:pkix:1.51.0.0'
|
compile 'com.madgag.spongycastle:pkix:1.51.0.0'
|
||||||
compile 'com.madgag.spongycastle:prov:1.51.0.0'
|
compile 'com.madgag.spongycastle:prov:1.51.0.0'
|
||||||
compile 'com.madgag.spongycastle:core:1.51.0.0'
|
compile 'com.madgag.spongycastle:core:1.51.0.0'
|
||||||
@ -60,49 +55,41 @@ if (!hasProperty('sourceDeps')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':extern:AndroidPinning')
|
compile 'com.android.support:support-v4:22.2.1'
|
||||||
compile project(':extern:UniversalImageLoader:library')
|
compile 'com.android.support:appcompat-v7:22.1.1'
|
||||||
compile project(':extern:libsuperuser:libsuperuser')
|
compile 'com.android.support:support-annotations:22.2.1'
|
||||||
compile project(':extern:nanohttpd:core')
|
|
||||||
compile project(':extern:jmdns')
|
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
|
||||||
compile project(':extern:zipsigner')
|
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
|
||||||
compile project(':extern:zxing-core')
|
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')) {
|
compile(project(':extern:support-v4-preferencefragment')) {
|
||||||
exclude module: 'support-v4'
|
exclude module: 'support-v4'
|
||||||
}
|
}
|
||||||
|
compile project(':extern:nanohttpd:core')
|
||||||
compile 'com.android.support:support-v4:22.2.1',
|
compile project(':extern:zipsigner')
|
||||||
'com.android.support:appcompat-v7:22.1.1',
|
compile project(':extern:jmdns')
|
||||||
'com.android.support:support-annotations:22.2.1'
|
|
||||||
|
|
||||||
androidTestCompile 'commons-io:commons-io:2.2'
|
androidTestCompile 'commons-io:commons-io:2.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
task cleanBinaryDeps(type: Delete) {
|
|
||||||
|
|
||||||
enabled = project.hasProperty('sourceDeps')
|
|
||||||
description = "Removes all .jar and .aar files from F-Droid/libs/. Requires the sourceDeps property to be set (\"gradle -PsourceDeps cleanBinaryDeps\")"
|
|
||||||
|
|
||||||
delete fileTree('libs/binaryDeps') {
|
|
||||||
include '*.aar'
|
|
||||||
include '*.jar'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') {
|
task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') {
|
||||||
|
|
||||||
enabled = project.hasProperty('sourceDeps')
|
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\")"
|
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/') {
|
from('../extern/') {
|
||||||
include 'support-v4-preferencefragment/build/outputs/aar/support-v4-preferencefragment-release.aar',
|
include 'support-v4-preferencefragment/build/outputs/aar/support-v4-preferencefragment-release.aar'
|
||||||
'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar',
|
include 'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar'
|
||||||
'zipsigner/build/libs/zipsigner.jar',
|
include 'zipsigner/build/libs/zipsigner.jar'
|
||||||
'jmdns/build/libs/jmdns.jar'
|
include 'jmdns/build/libs/jmdns.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
into 'libs/binaryDeps'
|
into 'libs/binaryDeps'
|
||||||
|
|
||||||
includeEmptyDirs false
|
includeEmptyDirs false
|
||||||
|
|
||||||
eachFile { FileCopyDetails details ->
|
eachFile { FileCopyDetails details ->
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
# Licenses
|
|
||||||
|
|
||||||
To see which license any one of these libraries is under, consult the extern/
|
|
||||||
directory. If you have checked out the source for all dependencies (`git
|
|
||||||
submodule update --init` from the root directory if there are any submodules),
|
|
||||||
then you should be able to find the relevant LICENSE file for each, or else
|
|
||||||
you can consult upstream.
|
|
||||||
|
|
||||||
|
|
||||||
# Building libraries from source
|
|
||||||
|
|
||||||
As a matter of principle, and also to comply with the GPLv3+, F-Droid should always be able to be built
|
|
||||||
from source, _including all of its dependencies_.
|
|
||||||
|
|
||||||
For practical reasons, developers often don't want the overhead of having to fetch the source of each
|
|
||||||
dependency though. Also, they may not want their build script to have to take the time to configure and
|
|
||||||
check that each subproject is up-to-date. Building from binary dependencies is _much_ faster, requires
|
|
||||||
less downloading of external source, and should import into Android Studio and other IDE's more easily.
|
|
||||||
|
|
||||||
To deal with these two goals (building dependencies from source, and relying on prebuilt binaries), the
|
|
||||||
build script can be run in two modes.
|
|
||||||
|
|
||||||
|
|
||||||
## Gradle commands
|
|
||||||
|
|
||||||
`gradle build` will build _F-Droid_ from source, but _not the depenencies_ from source. It will instead depend
|
|
||||||
on binaries from jcenter where possible, and .jar and .aar files in F-Droid/libs/binaryDeps elsewhere.
|
|
||||||
|
|
||||||
`gradle -PsourceDeps build` will include all dependencies and build the entire F-Droid binary
|
|
||||||
and all of its dependencies from source.
|
|
||||||
|
|
||||||
`gradle -PsourceDeps binaryDeps` will build all dependencies from source, and then copy the ones which
|
|
||||||
are not found in jcenter to F-Droid/libs/binaryDeps, making sure that the latest versions of the libraries are available
|
|
||||||
for developers wishing to build F-Droid from binary dependencies.
|
|
||||||
|
|
||||||
`gradle -PsourceDeps cleanBinaryDeps` will remove all binary dependencies. It shouldn't be neccesary,
|
|
||||||
because the `binaryDeps` will copy fresh .jar and .aar files to the F-Droid/libs/binaryDeps directory when they change.
|
|
||||||
It may be handy if you are updating the build script though, as a nice way to empty the F-Droid/libs/binaryDeps directory.
|
|
||||||
|
|
||||||
|
|
||||||
# Adding new dependencies
|
|
||||||
|
|
||||||
When adding a new dependency, *DON'T* copy the .jar or .aar file into F-Droid/libs/binaryDeps. This will get deleted
|
|
||||||
when somebody runs `gradle -PsourceDeps cleanBinaryDeps`. Also, the version of F-Droid built for distribution
|
|
||||||
on https://f-droid.org will be build from source depednencies, so adding a binary is not enough.
|
|
||||||
|
|
||||||
Instead, you should add the source repo as a submodule in the extern/ diretory. You will also need to modify
|
|
||||||
the F-Droid/build.gradle file, adding both the source dependency on the project in the extern/ directory, and
|
|
||||||
a dependency on its jcenter/mavenCentral artifact. If that artifact is not available, then you should add
|
|
||||||
the library to those to be copied using `gradler -PsourceDeps binaryDeps`. Then, you can commit that binary so that
|
|
||||||
anyone who clones the F-Droid repo will have all of the dependencies ready in either jcetner or the
|
|
||||||
F-Droid/libs/binaryDeps directory.
|
|
@ -20,11 +20,6 @@ Once you have checked out the version you wish to build, run:
|
|||||||
cd F-Droid
|
cd F-Droid
|
||||||
gradle assembleRelease
|
gradle assembleRelease
|
||||||
|
|
||||||
If you would like to build from source, add `-PsourceDeps`:
|
|
||||||
|
|
||||||
cd F-Droid
|
|
||||||
gradle assembleRelease -PsourceDeps
|
|
||||||
|
|
||||||
The resulting apk will be in `build/outputs/apk/`.
|
The resulting apk will be in `build/outputs/apk/`.
|
||||||
|
|
||||||
Android Studio
|
Android Studio
|
||||||
@ -140,4 +135,4 @@ Some icons are made by [Picol](http://www.flaticon.com/authors/picol),
|
|||||||
Other icons are from the
|
Other icons are from the
|
||||||
[Material Design Icon set](https://github.com/google/material-design-icons)
|
[Material Design Icon set](https://github.com/google/material-design-icons)
|
||||||
released under an
|
released under an
|
||||||
[Attribution 4.0 International license](http://creativecommons.org/licenses/by/4.0/).
|
[Attribution 4.0 International license](http://creativecommons.org/licenses/by/4.0/).
|
||||||
|
2
extern/AndroidPinning/build.gradle
vendored
2
extern/AndroidPinning/build.gradle
vendored
@ -12,7 +12,7 @@ apply plugin: 'android-library'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 17
|
compileSdkVersion 17
|
||||||
buildToolsVersion '22.0.1'
|
buildToolsVersion '23.0.1'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
buildToolsVersion "22.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 5
|
minSdkVersion 5
|
||||||
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 21
|
||||||
buildToolsVersion "22.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 4
|
minSdkVersion 4
|
||||||
|
@ -19,7 +19,7 @@ dependencies {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 19
|
||||||
buildToolsVersion '22.0.1'
|
buildToolsVersion '23.0.1'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 7
|
minSdkVersion 7
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
include ':F-Droid'
|
include ':F-Droid'
|
||||||
|
if (hasProperty('sourceDeps')) {
|
||||||
if ( hasProperty( 'sourceDeps' ) ) {
|
include ':extern:support-v4-preferencefragment'
|
||||||
include ':extern:AndroidPinning'
|
|
||||||
include ':extern:UniversalImageLoader:library'
|
|
||||||
include ':extern:libsuperuser:libsuperuser'
|
|
||||||
include ':extern:nanohttpd:core'
|
include ':extern:nanohttpd:core'
|
||||||
include ':extern:jmdns'
|
|
||||||
include ':extern:zipsigner'
|
include ':extern:zipsigner'
|
||||||
|
include ':extern:jmdns'
|
||||||
|
|
||||||
|
// Needed for zipsigner
|
||||||
include ':extern:spongycastle:core'
|
include ':extern:spongycastle:core'
|
||||||
include ':extern:spongycastle:pkix'
|
include ':extern:spongycastle:pkix'
|
||||||
include ':extern:spongycastle:prov'
|
include ':extern:spongycastle:prov'
|
||||||
include ':extern:zxing-core'
|
|
||||||
include ':extern:support-v4-preferencefragment'
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user