1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-22 04:11:14 +00:00

Revert build script changes

This reverts commits 5749b98b92,
9559d0c2d9,
536c826fbb
This commit is contained in:
Felix Ableitner 2017-10-19 12:06:52 +09:00
parent 5749b98b92
commit 18c419b2ed
442 changed files with 441 additions and 221 deletions

23
.gitignore vendored
View file

@ -12,6 +12,7 @@
bin/
build/
gen/
src/main/jniLibs/
obj/
.gradle/
@ -19,6 +20,14 @@ obj/
local.properties
project.properties
# Eclipse project files
.settings/
.classpath
.project
# Proguard folder generated by Eclipse
proguard/
# Intellij project files
*.iml
*.ipr
@ -28,3 +37,17 @@ project.properties
# Gradle wrapper
gradle/wrapper/gradle/
gradle/wrapper/gradlew*
# Go native dependencies
ext/golang/dist
# Syncthing native dependencies
ext/syncthing/pkg/
ext/syncthing/src/code.google.com/
ext/syncthing/src/github.com/kr/
ext/syncthing/src/github.com/mattn/
ext/syncthing/src/github.com/tools/
ext/syncthing/src/golang.org/
# gradle-play-publisher
keys.json

13
.gitmodules vendored
View file

@ -1,3 +1,12 @@
[submodule "syncthing"]
path = syncthing/src/github.com/syncthing/syncthing
[submodule "ext/syncthing/src/github.com/syncthing/syncthing"]
path = ext/syncthing/src/github.com/syncthing/syncthing
url = https://github.com/syncthing/syncthing.git
ignore = dirty
[submodule "ext/golang/go"]
path = ext/golang/go
url = https://github.com/golang/go.git
ignore = dirty
[submodule "ext/golang/go1.4"]
path = ext/golang/go1.4
url = https://github.com/golang/go.git
ignore = dirty

View file

@ -1,7 +1,6 @@
sudo: required
language: android
jdk: oraclejdk8
dist: trusty
# Install Android SDK
android:
@ -14,18 +13,10 @@ android:
- android-26
- extra-android-m2repository
# Install Android NDK (apparently there is no easier way to do this)
# https://github.com/travis-ci/travis-ci/issues/5395
before_script:
- curl -L https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip -O
- unzip -q android-ndk-r15c-linux-x86_64.zip
- export ANDROID_NDK_HOME=`pwd`/android-ndk-r15c
# Install Golang
before_install:
- sudo add-apt-repository ppa:gophers/archive -y
- sudo apt-get update -qq
- sudo apt-get install golang-1.9-go -y
- sudo apt-get install golang -y
# Cache gradle dependencies
# https://docs.travis-ci.com/user/languages/android/#Caching
@ -38,5 +29,5 @@ cache:
- $HOME/.gradle/wrapper/
script:
- ./gradlew lintVitalRelease
- ./gradlew clean lint
- ./gradlew buildNative assembleDebug

View file

@ -2,29 +2,29 @@
host = https://www.transifex.com
[syncthing-android.stringsxml]
file_filter = app/src/main/res/values-<lang>/strings.xml
source_file = app/src/main/res/values/strings.xml
file_filter = src/main/res/values-<lang>/strings.xml
source_file = src/main/res/values/strings.xml
source_lang = en
type = ANDROID
lang_map = af_ZA: af-rZA, am_ET: am-rET, ar_AE: ar-rAE, ar_BH: ar-rBH, ar_DZ: ar-rDZ, ar_EG: ar-rEG, ar_IQ: ar-rIQ, ar_JO: ar-rJO, ar_KW: ar-rKW, ar_LB: ar-rLB, ar_LY: ar-rLY, ar_MA: ar-rMA, ar_OM: ar-rOM, ar_QA: ar-rQA, ar_SA: ar-rSA, ar_SY: ar-rSY, ar_TN: ar-rTN, ar_YE: ar-rYE, arn_CL: arn-rCL, as_IN: as-rIN, az_AZ: az-rAZ, ba_RU: ba-rRU, be_BY: be-rBY, bg_BG: bg-rBG, bn_BD: bn-rBD, bn_IN: bn-rIN, bo_CN: bo-rCN, br_FR: br-rFR, bs_BA: bs-rBA, ca_ES: ca-rES, co_FR: co-rFR, cs_CZ: cs-rCZ, cy_GB: cy-rGB, da_DK: da-rDK, de_AT: de-rAT, de_CH: de-rCH, de_DE: de-rDE, de_LI: de-rLI, de_LU: de-rLU, dsb_DE: dsb-rDE, dv_MV: dv-rMV, el_GR: el-rGR, en_AU: en-rAU, en_BZ: en-rBZ, en_CA: en-rCA, en_GB: en-rGB, en_IE: en-rIE, en_IN: en-rIN, en_JM: en-rJM, en_MY: en-rMY, en_NZ: en-rNZ, en_PH: en-rPH, en_SG: en-rSG, en_TT: en-rTT, en_US: en-rUS, en_ZA: en-rZA, en_ZW: en-rZW, es_AR: es-rAR, es_BO: es-rBO, es_CL: es-rCL, es_CO: es-rCO, es_CR: es-rCR, es_DO: es-rDO, es_EC: es-rEC, es_ES: es-rES, es_GT: es-rGT, es_HN: es-rHN, es_MX: es-rMX, es_NI: es-rNI, es_PA: es-rPA, es_PE: es-rPE, es_PR: es-rPR, es_PY: es-rPY, es_SV: es-rSV, es_US: es-rUS, es_UY: es-rUY, es_VE: es-rVE, et_EE: et-rEE, eu_ES: eu-rES, fa_IR: fa-rIR, fi_FI: fi-rFI, fil_PH: fil-rPH, fo_FO: fo-rFO, fr_BE: fr-rBE, fr_CA: fr-rCA, fr_CH: fr-rCH, fr_FR: fr-rFR, fr_LU: fr-rLU, fr_MC: fr-rMC, fy_NL: fy-rNL, ga_IE: ga-rIE, gd_GB: gd-rGB, gl_ES: gl-rES, gsw_FR: gsw-rFR, gu_IN: gu-rIN, ha_NG: ha-rNG, hi_IN: hi-rIN, hr_BA: hr-rBA, hr_HR: hr-rHR, hsb_DE: hsb-rDE, hu_HU: hu-rHU, hy_AM: hy-rAM, id_ID: id-rID, ig_NG: ig-rNG, ii_CN: ii-rCN, is_IS: is-rIS, it_CH: it-rCH, it_IT: it-rIT, iu_CA: iu-rCA, ja_JP: ja-rJP, ka_GE: ka-rGE, kk_KZ: kk-rKZ, kl_GL: kl-rGL, km_KH: km-rKH, kn_IN: kn-rIN, ko_KR: ko-rKR, kok_IN: kok-rIN, ky_KG: ky-rKG, lb_LU: lb-rLU, lo_LA: lo-rLA, lt_LT: lt-rLT, lv_LV: lv-rLV, mi_NZ: mi-rNZ, mk_MK: mk-rMK, ml_IN: ml-rIN, mn_CN: mn-rCN, mn_MN: mn-rMN, moh_CA: moh-rCA, mr_IN: mr-rIN, ms_BN: ms-rBN, ms_MY: ms-rMY, mt_MT: mt-rMT, nb_NO: nb-rNO, ne_NP: ne-rNP, nl_BE: nl-rBE, nl_NL: nl-rNL, nn_NO: nn-rNO, nso_ZA: nso-rZA, oc_FR: oc-rFR, or_IN: or-rIN, pa_IN: pa-rIN, pl_PL: pl-rPL, prs_AF: prs-rAF, ps_AF: ps-rAF, pt_BR: pt-rBR, pt_PT: pt-rPT, qut_GT: qut-rGT, quz_BO: quz-rBO, quz_EC: quz-rEC, quz_PE: quz-rPE, rm_CH: rm-rCH, ro_RO: ro-rRO, ru_RU: ru-rRU, rw_RW: rw-rRW, sa_IN: sa-rIN, sah_RU: sah-rRU, se_FI: se-rFI, se_NO: se-rNO, se_SE: se-rSE, si_LK: si-rLK, sk_SK: sk-rSK, sl_SI: sl-rSI, sma_NO: sma-rNO, sma_SE: sma-rSE, smj_NO: smj-rNO, smj_SE: smj-rSE, smn_FI: smn-rFI, sms_FI: sms-rFI, sq_AL: sq-rAL, sr_BA: sr-rBA, sr_CS: sr-rCS, sr_ME: sr-rME, sr_RS: sr-rRS, sv_FI: sv-rFI, sv_SE: sv-rSE, sw_KE: sw-rKE, syr_SY: syr-rSY, ta_IN: ta-rIN, te_IN: te-rIN, tg_TJ: tg-rTJ, th_TH: th-rTH, tk_TM: tk-rTM, tn_ZA: tn-rZA, tr_TR: tr-rTR, tt_RU: tt-rRU, tzm_DZ: tzm-rDZ, ug_CN: ug-rCN, uk_UA: uk-rUA, ur_PK: ur-rPK, uz_UZ: uz-rUZ, vi_VN: vi-rVN, wo_SN: wo-rSN, xh_ZA: xh-rZA, yo_NG: yo-rNG, zh_CN: zh-rCN, zh_HK: zh-rHK, zh_MO: zh-rMO, zh_SG: zh-rSG, zh_TW: zh-rTW, zu_ZA: zu-rZA, no_NO: no-rNO, he_IL: iw-rIL, he: iw, id:in
[syncthing-android.description_fulltxt]
file_filter = app/src/main/play/<lang>/listing/fulldescription
source_file = app/src/main/play/en-GB/listing/fulldescription
file_filter = src/main/play/<lang>/listing/fulldescription
source_file = src/main/play/en-GB/listing/fulldescription
source_lang = en_GB
type = TXT
lang_map = ja: ja-JP, sv: sv-SE, da: da-DK, de: de-DE, el: el-EL, es: es-ES, fi: fi-FI, it: it-IT, pl: pl-PL, nl: nl-NL, ru: ru-RU, no: no-NO, pt: pt-PT, ko: ko-KR, cs: cs-CZ, hu: hu-HU, fr: fr-FR, tr: tr-TR
[syncthing-android.description_shorttxt]
file_filter = app/src/main/play/<lang>/listing/shortdescription
source_file = app/src/main/play/en-GB/listing/shortdescription
file_filter = src/main/play/<lang>/listing/shortdescription
source_file = src/main/play/en-GB/listing/shortdescription
source_lang = en_GB
type = TXT
lang_map = ja: ja-JP, sv: sv-SE, da: da-DK, de: de-DE, el: el-EL, es: es-ES, fi: fi-FI, it: it-IT, pl: pl-PL, nl: nl-NL, ru: ru-RU, no: no-NO, pt: pt-PT, ko: ko-KR, cs: cs-CZ, hu: hu-HU, fr: fr-FR, tr: tr-TR
[syncthing-android.titletxt]
file_filter = app/src/main/play/<lang>/listing/title
source_file = app/src/main/play/en-GB/listing/title
file_filter = src/main/play/<lang>/listing/title
source_file = src/main/play/en-GB/listing/title
source_lang = en_GB
type = TXT
lang_map = ja: ja-JP, sv: sv-SE, da: da-DK, de: de-DE, el: el-EL, es: es-ES, fi: fi-FI, it: it-IT, pl: pl-PL, nl: nl-NL, ru: ru-RU, no: no-NO, pt: pt-PT, ko: ko-KR, cs: cs-CZ, hu: hu-HU, fr: fr-FR, tr: tr-TR

View file

@ -16,30 +16,37 @@ A wrapper of [Syncthing](https://github.com/syncthing/syncthing) for Android.
The project is translated on [Transifex](https://www.transifex.com/projects/p/syncthing-android/).
Translations can be updated using the [Transifex client](http://docs.transifex.com/developer/client/), using commands `tx push -s` and `tx pull -a`.
# Building
### Dependencies
- Android SDK (you can skip this if you are using Android Studio)
- Android NDK (`$ANDROID_NDK_HOME` should point at the root directory of your NDK)
- Go (see [here](https://docs.syncthing.net/dev/building.html#prerequisites) for the required version)
### Requirements
- Android SDK Platform (for the `compileSdkVersion` specified in [build.gradle](build.gradle))
- Android NDK Platform
- Android Support Repository
### Build instructions
Make sure you clone the project with
`git clone https://github.com/syncthing/syncthing-android.git --recursive`. Alternatively, run
`git submodule init && git submodule update` in the project folder.
This repository is using external dependencies so you have to initialize all submodules with --recursive option first time: `git clone https://github.com/syncthing/syncthing-android.git --recursive`.
Set the `ANDROID_NDK` environment variable to the Android NDK folder (e.g. `export ANDROID_NDK=/opt/android_ndk`).
Build Go and Syncthing using `./make-all.bash`.
Use `./gradlew assembleDebug` in the project directory to compile the APK.
To prepare a new release, execute `./prepare-release.bash`, and follow the instructions.
To check for updated gradle dependencies, run `gradle dependencyUpdates`. Additionally, the git submodule in `ext/syncthing/src/github.com/syncthing/syncthing` may need to be updated.
Build Syncthing using `./syncthing/build-syncthing.bash`. Then use `./gradlew assembleDebug` or
Android Studio to build the apk.
### Building on Windows
To build the Syncthing app on Windows we need to have cygwin installed.
From a cygwin shell in the project directory, build Syncthing using `./syncthing/build-syncthing.bash`
From a cygwin shell in the project directory, build Go using `./make-go.bash [arch]`
After Go is built, compile syncthing using `./make-syncthing.bash [arch]`
Lastly, use `./gradlew assembleDebug` in the project directory to compile the APK, or use Android
Studio to build/deploy the APK.
Lastly, use `./gradlew assembleDebug` in the project directory to compile the APK,
or use Android Studio to build/deploy the APK.
# License

6
app/.gitignore vendored
View file

@ -1,6 +0,0 @@
# generated files
/build
/src/main/jniLibs
# gradle-play-publisher
keys.json

View file

@ -1,78 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.triplet.play'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
compile 'eu.chainfire:libsuperuser:1.0.0.201704021214'
compile 'com.android.support:design:26.1.0'
compile 'com.google.zxing:android-integration:3.3.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'org.mindrot:jbcrypt:0.4'
compile 'com.google.guava:guava:20.0'
compile 'com.annimon:stream:1.1.9'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"
androidTestCompile 'com.android.support.test:rules:1.0.1'
androidTestCompile 'com.android.support:support-annotations:26.1.0'
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
buildTypes.debug.applicationIdSuffix ".debug"
dataBinding.enabled = true
playAccountConfigs {
defaultAccountConfig {
jsonFile = file('keys.json')
}
}
defaultConfig {
applicationId "com.nutomic.syncthingandroid"
minSdkVersion 14
targetSdkVersion 26
versionCode 4126
versionName "0.9.16"
testApplicationId 'com.nutomic.syncthingandroid.test'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
playAccountConfig = playAccountConfigs.defaultAccountConfig
}
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword System.getenv("SIGNING_PASSWORD") ?: ""
keyAlias RELEASE_KEY_ALIAS
keyPassword System.getenv("SIGNING_PASSWORD") ?: ""
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
play {
jsonFile = file('keys.json')
uploadImages = false
track = 'production'
}
/**
* Some languages are not supported by Google Play, so we ignore them.
*/
task deleteUnsupportedPlayTranslations(type: Delete) {
delete 'src/main/play/nn'
delete 'src/main/play/el-EL'
delete 'src/main/play/nb'
delete 'src/main/play/en/'
}

View file

@ -1,29 +1,109 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
}
}
allprojects {
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.triplet.play'
apply plugin: 'me.tatarka.retrolambda'
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
compile 'eu.chainfire:libsuperuser:1.0.0.201704021214'
compile 'com.android.support:design:26.1.0'
compile 'com.google.zxing:android-integration:3.3.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'org.mindrot:jbcrypt:0.4'
compile 'com.google.guava:guava:20.0'
compile 'com.annimon:stream:1.1.9'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"
androidTestCompile 'com.android.support.test:rules:1.0.1'
androidTestCompile 'com.android.support:support-annotations:26.1.0'
}
task clean(type: Delete) {
delete rootProject.buildDir
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
buildTypes.debug.applicationIdSuffix ".debug"
dataBinding.enabled = true
playAccountConfigs {
defaultAccountConfig {
jsonFile = file('keys.json')
}
}
defaultConfig {
applicationId "com.nutomic.syncthingandroid"
minSdkVersion 14
targetSdkVersion 26
versionCode 4126
versionName "0.9.16"
testApplicationId 'com.nutomic.syncthingandroid.test'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
playAccountConfig = playAccountConfigs.defaultAccountConfig
}
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword System.getenv("SIGNING_PASSWORD") ?: ""
keyAlias RELEASE_KEY_ALIAS
keyPassword System.getenv("SIGNING_PASSWORD") ?: ""
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
task buildNative(type: Exec) {
outputs.upToDateWhen { false }
executable = './make-all.bash'
}
task cleanNative(type: Delete) {
delete 'src/main/jniLibs/'
delete 'ext/syncthing/bin/'
delete 'ext/syncthing/pkg/'
}
play {
jsonFile = file('keys.json')
uploadImages = false
track = 'production'
}
/**
* Some languages are not supported by Google Play, so we ignore them.
*/
task deleteUnsupportedPlayTranslations(type: Delete) {
delete 'src/main/play/nn'
delete 'src/main/play/el-EL'
delete 'src/main/play/nb'
delete 'src/main/play/en/'
}

1
ext/golang/go Submodule

@ -0,0 +1 @@
Subproject commit cd6b6202dd1559b3ac63179b45f1833fcfbe7eca

1
ext/golang/go1.4 Submodule

@ -0,0 +1 @@
Subproject commit 50eb39bb23e8b03e823c38e844f0410d0b5325d2

@ -0,0 +1 @@
Subproject commit 5aade9a4a5506e5b71b2a9ab863790dca488700e

12
make-all.bash Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash -e
# Build the syncthing library
./make-go.bash arm
./make-syncthing.bash arm
./make-go.bash 386
./make-syncthing.bash 386
./make-go.bash arm64
./make-syncthing.bash arm64

96
make-go.bash Executable file
View file

@ -0,0 +1,96 @@
#!/usr/bin/env bash
set -e
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export CGO_ENABLED=0
if [ -z "$GOROOT_BOOTSTRAP" ]; then
# We need Go 1.4 to bootstrap Go 1.5
if [ -z $GOROOT ] || [[ $(go version) != go\ version\ go1.4* ]] ; then
git submodule update --init ext/golang/go1.4
# Build Go 1.4 for host
pushd ext/golang/go1.4/src
./make.bash --no-clean
popd
# Add Go 1.4 to the environment
export GOROOT="$(pwd)/ext/golang/go1.4"
fi
# Add Go 1.4 compiler to PATH
export GOROOT_BOOTSTRAP=$GOROOT
fi
case "$1" in
arm)
export GOOS=linux
export GOARCH=arm
export GOARM=5
;;
arm64)
export GOOS=linux
export GOARCH=arm64
unset GOARM
;;
386)
export GOOS=linux
export GOARCH=386
export GO386=387
;;
*)
echo "Invalid architecture"
exit 1
esac
unset GOPATH
export GOROOT_FINAL=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
if [ -d "$GOROOT_FINAL" ]; then
rm -r "$GOROOT_FINAL"
fi
mkdir -p "$GOROOT_FINAL"
pushd ext/golang/go/src
git reset --hard HEAD
# Apply patches to Golang
for PATCH in $MYDIR/patches/golang/all/*.patch; do
echo "Applying $PATCH"
patch -p1 <$PATCH
done
set +e
./clean.bash
rm -r ../bin
rm -r ../pkg
set -e
if [ ! -e ../VERSION ]; then
echo "$(git describe --tags)" > ../VERSION
fi
BUILDER_EXT=bash
case "$(uname)" in
*MINGW* | *WIN32* | *CYGWIN*)
BUILDER_EXT=bat
;;
esac
./make.${BUILDER_EXT} --no-banner
cp -a ../bin "${GOROOT_FINAL}"/
cp -a ../pkg "${GOROOT_FINAL}"/
cp -a ../src "${GOROOT_FINAL}"/
if [[ -e ./make.${BUILDER_EXT} ]]; then
pushd ../
git clean -f
popd
fi
popd
echo "Complete"

73
make-syncthing.bash Executable file
View file

@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -e
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
JNIDIR="/src/main/jniLibs"
case "$1" in
arm)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm
export GOARM=5
export TARGETDIR=$MYDIR$JNIDIR/armeabi
;;
arm64)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm64
unset GOARM
export TARGETDIR=$MYDIR$JNIDIR/arm64-v8a
;;
386)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=386
export GO386=387
export TARGETDIR=$MYDIR$JNIDIR/x86
;;
*)
echo "Invalid architecture"
exit 1
esac
unset GOPATH #Set by build.go
export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
export PATH=${GOROOT}/bin:${PATH}
case "$(uname)" in
*CYGWIN*)
export GOROOT=`cygpath -w $GOROOT`
;;
esac
pushd ext/syncthing/src/github.com/syncthing/syncthing
_GOOS=$GOOS
unset GOOS
_GOARCH=$GOARCH
unset GOARCH
# Make sure all tags are available for git describe
# https://github.com/syncthing/syncthing-android/issues/872
git fetch --tags
go run build.go -goos=${_GOOS} -goarch=${_GOARCH} clean
go run build.go -goos=${_GOOS} -goarch=${_GOARCH} -no-upgrade build
export GOOS=$_GOOS
export GOARCH=$_GOARCH
mkdir -p ${TARGETDIR}
mv syncthing ${TARGETDIR}/libsyncthing.so
chmod 644 ${TARGETDIR}/libsyncthing.so
if [[ -e ./build.go ]]; then
git clean -f
fi
popd
echo "Build Complete"

View file

@ -0,0 +1,90 @@
--- /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
+++ /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
@@ -9,16 +9,59 @@
package net
import (
+ "fmt"
"os"
+ "os/exec"
+ "strings"
"sync/atomic"
"time"
)
var (
- defaultNS = []string{"127.0.0.1:53", "[::1]:53"}
+ currentNS []string
getHostname = os.Hostname // variable for testing
)
+func getDefaultNS() []string {
+ var servers []string
+ for _, prop := range []string{"net.dns1", "net.dns2"} {
+ cmd := exec.Command("getprop", prop)
+ outputBytes, err := cmd.Output()
+ if err != nil {
+ continue
+ }
+ output := strings.Trim(string(outputBytes), "\n")
+ if ParseIP(output) != nil {
+ servers = append(servers, JoinHostPort(output, "53"))
+ }
+ }
+
+ if len(servers) == 0 {
+ servers = []string{"8.8.8.8:53", "8.8.4.4:53", "4.2.2.1:53"}
+ }
+
+ if !slicesEqual(currentNS, servers) {
+ fmt.Println("Using DNS servers:", servers)
+ currentNS = servers
+ }
+
+ return currentNS
+}
+
+func slicesEqual(a, b []string) bool {
+ if len(a) != len(b) {
+ return false
+ }
+
+ for i := range a {
+ if a[i] != b[i] {
+ return false
+ }
+ }
+
+ return true
+}
+
type dnsConfig struct {
servers []string // server addresses (in host:port form) to use
search []string // rooted suffixes to append to local name
@@ -42,7 +85,7 @@ func dnsReadConfig(filename string) *dnsConfig {
}
file, err := open(filename)
if err != nil {
- conf.servers = defaultNS
+ conf.servers = getDefaultNS()
conf.search = dnsDefaultSearch()
conf.err = err
return conf
@@ -51,7 +94,7 @@ func dnsReadConfig(filename string) *dnsConfig {
if fi, err := file.file.Stat(); err == nil {
conf.mtime = fi.ModTime()
} else {
- conf.servers = defaultNS
+ conf.servers = getDefaultNS()
conf.search = dnsDefaultSearch()
conf.err = err
return conf
@@ -130,7 +173,7 @@ func dnsReadConfig(filename string) *dnsConfig {
}
}
if len(conf.servers) == 0 {
- conf.servers = defaultNS
+ conf.servers = getDefaultNS()
}
if len(conf.search) == 0 {
conf.search = dnsDefaultSearch()

View file

@ -3,7 +3,7 @@
set -e
NEW_VERSION_NAME=$1
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}')
OLD_VERSION_NAME=$(grep "versionName" "build.gradle" | awk '{print $2}')
if [[ -z ${NEW_VERSION_NAME} ]]
then
echo "New version name is empty. Please set a new version. Current version: $OLD_VERSION_NAME"
@ -16,7 +16,7 @@ Checking for Syncthing Update
-----------------------------
"
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "syncthing/src/github.com/syncthing/syncthing/"
cd "ext/syncthing/src/github.com/syncthing/syncthing/"
git fetch
CURRENT_TAG=$(git describe)
LATEST_TAG=$(git tag --sort=taggerdate | awk '!/rc/' | tail -1)
@ -24,7 +24,7 @@ if [ ${CURRENT_TAG} != ${LATEST_TAG} ]
then
git checkout -f ${LATEST_TAG}
cd ${PROJECT_DIR}
git add "syncthing/src/github.com/syncthing/syncthing/"
git add "ext/syncthing/src/github.com/syncthing/syncthing"
git commit -m "Updated Syncthing to $LATEST_TAG"
./gradlew cleanNative buildNative
fi
@ -41,8 +41,8 @@ tx push -s
# contents. So if a file was `touch`ed, it won't be updated by default.
tx pull -a -f
./gradlew deleteUnsupportedPlayTranslations
git add -A "app/src/main/play/"
git add -A "app/src/main/res/values-*/strings.xml"
git add -A "src/main/play/"
git add -A "src/main/res/values-*/strings.xml"
if ! git diff --cached --exit-code;
then
git commit -m "Imported translations"
@ -66,20 +66,20 @@ touch ${changelog_file}
nano ${changelog_file}
cat ${changelog_file}
mv ${changelog_file} "app/src/main/play/en-GB/whatsnew"
mv ${changelog_file} "src/main/play/en-GB/whatsnew"
echo "
Updating Version
-----------------------------
"
OLD_VERSION_CODE=$(grep "versionCode" "app/build.gradle" -m 1 | awk '{print $2}')
OLD_VERSION_CODE=$(grep "versionCode" "build.gradle" -m 1 | awk '{print $2}')
NEW_VERSION_CODE=$(($OLD_VERSION_CODE + 1))
sed -i "s/versionCode $OLD_VERSION_CODE/versionCode $NEW_VERSION_CODE/" "app/build.gradle"
sed -i "s/versionCode $OLD_VERSION_CODE/versionCode $NEW_VERSION_CODE/" build.gradle
OLD_VERSION_NAME=$(grep "versionName" "app/build.gradle" | awk '{print $2}')
OLD_VERSION_NAME=$(grep "versionName" "build.gradle" | awk '{print $2}')
sed -i "s/$OLD_VERSION_NAME/\"$1\"/" build.gradle
git add "app/build.gradle" "app/src/main/play/en-GB/whatsnew"
git add "build.gradle" "src/main/play/en-GB/whatsnew"
git commit -m "Bumped version to $NEW_VERSION_NAME"
git tag ${NEW_VERSION_NAME}

View file

@ -1 +0,0 @@
include ':app', ':syncthing'

Some files were not shown because too many files have changed in this diff Show more