1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-21 20:02:07 +01:00

Update Gradle to 3.0/4.1 ; SDK 27

This commit is contained in:
Gregor Santner 2017-10-29 11:01:27 +01:00
parent 496faa7945
commit cb811d8236
7 changed files with 158 additions and 131 deletions

6
.atomignore Normal file → Executable file
View file

@ -15,3 +15,9 @@ app/build
app/.gitignore app/.gitignore
app/pom.xml app/pom.xml
app/proguard-rules.pro app/proguard-rules.pro
.hidden
.travis.yml
circle.yml
CODE_OF_CONDUCT*
gradle.properties
LICENSE*

19
.gitignore vendored
View file

@ -1,12 +1,3 @@
##############
### Project ##
app/src/main/res/raw/changelog.*
app/src/main/res/raw/contributors.*
app/src/main/res/raw/license.*
app/src/main/res/raw/readme.*
app/src/main/res/raw/contributors.*
#app/src/main/res/raw/podlist.json
############## ##############
### Common ### ### Common ###
*~* *~*
@ -99,3 +90,13 @@ proguard/
# Android Studio Stuff # Android Studio Stuff
.navigation/ .navigation/
gen-external-apklibs gen-external-apklibs
### Project ##
app/src/main/res/raw/changelog.*
app/src/main/res/raw/license.*
app/src/main/res/raw/readme.*
app/src/main/res/raw/contributors.*
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

View file

@ -1,38 +1,48 @@
language: android language: android
jdk: jdk: oraclejdk8
- oraclejdk8
android:
components:
- tools
- tools # TODO https://github.com/travis-ci/travis-ci/issues/6193
- platform-tools
- build-tools-24.0.3
- android-24
- extra-android-m2repository
before_cache: before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock # Do not cache a few Gradle files/directories (see https://docs.travis-ci.com/user/languages/java/#Caching)
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache: cache:
directories: directories:
# Android SDK
- $HOME/android-sdk-dl
- $HOME/android-sdk
# Gradle dependencies
- $HOME/.gradle/caches/ - $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/ - $HOME/.gradle/wrapper/
script: "./gradlew $TASK"
env: # Android build cache (see http://tools.android.com/tech-docs/build-cache)
- TASK="lintFlavorDefaultDebug" - $HOME/.android/build-cache
- TASK="build check --stacktrace"
install:
# Download and unzip the Android SDK tools (if not already there thanks to the cache mechanism)
# Latest version available here: https://developer.android.com/studio/index.html#downloads
- if test ! -e $HOME/android-sdk-dl/sdk-tools.zip ; then curl https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip > $HOME/android-sdk-dl/sdk-tools.zip ; fi
- unzip -qq -n $HOME/android-sdk-dl/sdk-tools.zip -d $HOME/android-sdk
# Install or update Android SDK components (will not do anything if already up to date thanks to the cache mechanism)
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'tools' > /dev/null
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platform-tools' > /dev/null
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'build-tools;26.0.2' > /dev/null
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'platforms;android-27' > /dev/null
- echo y | $HOME/android-sdk/tools/bin/sdkmanager 'extras;google;m2repository' > /dev/null
branches: branches:
except: except:
- l10n_master - gh-pages
- l10n_master2 - l10n_master
- crowdin - crowdin
notifications:
webhooks:
urls:
- "https://webhooks.gitter.im/e/e462044d3105a7bb4b4f"
- "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGdzYW50bmVyJTNBbWF0cml4Lm9yZy8lMjFNUERTYURTaVBMZXdSQXBxa24lM0FtYXRyaXgub3Jn"
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
after_success: env:
- bash <(curl -s https://codecov.io/bash) global:
- ANDROID_HOME=$HOME/android-sdk
matrix:
- TASK="lintFlavorDefaultDebug --stacktrace"
- TASK="build check --stacktrace"
script: "./gradlew --no-daemon --parallel $TASK"

View file

@ -2,40 +2,46 @@ apply plugin: 'com.android.application'
ext { ext {
version_sdk = [ version_sdk = [
compileSdk : 24, compileSdk: 27,
buildTools : "26.0.1", minSdk : 17,
minSdk : 17,
//targetSdk: compileSdk,
] ]
version_sdk.targetSdk = version_sdk.compileSdk
version_lib = [ version_lib = [
appcompat : "24.1.0", // Broken after 24.1.0, Fix announced at 26.0.0, but still not fixed... See https://issuetracker.google.com/issues/37118105 appcompat: "27.0.0",
butterknife : "8.4.0", butterknife: "8.8.1",
netcipher : "2.0.0-alpha1", netcipher: "2.0.0-alpha1",
] ]
} }
android { android {
compileSdkVersion version_sdk.compileSdk compileSdkVersion version_sdk.compileSdk
buildToolsVersion version_sdk.buildTools flavorDimensions "default"
defaultConfig { defaultConfig {
minSdkVersion version_sdk.minSdk minSdkVersion version_sdk.minSdk
targetSdkVersion version_sdk.targetSdk targetSdkVersion version_sdk.compileSdk
versionCode 27
versionName "1.0.7"
applicationId "com.github.dfa.diaspora_android"
resValue 'string', 'app_name', "dandelion*"
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
buildConfigField "boolean", "IS_TEST_BUILD", "false" buildConfigField "boolean", "IS_TEST_BUILD", "false"
buildConfigField "boolean", "IS_GPLAY_BUILD", "false" buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {"\"${it}\""}.join(",") + '}') buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {
"\"${it}\""
}.join(",") + '}')
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
applicationId "com.github.dfa.diaspora_android"
versionName "1.0.7"
versionCode 27
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
resValue 'string', 'app_name', "dandelion*"
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
@ -46,13 +52,9 @@ android {
productFlavors { productFlavors {
flavorDefault { flavorDefault {
} }
/*flavorGplay {
/*
flavorGplay {
buildConfigField "boolean", "IS_GPLAY_BUILD", "true" buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
} }*/
*/
flavorTest { flavorTest {
applicationId "com.github.dfa.secondlion" applicationId "com.github.dfa.secondlion"
resValue 'string', 'app_name', "secondlion*" resValue 'string', 'app_name', "secondlion*"
@ -69,61 +71,26 @@ android {
dependencies { dependencies {
// Sub-Projects // Sub-Projects
//compile project(':subprojectFromRoot') //implementation project(':subprojectFromRoot')
// Jars // Jars
compile fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
// Android standard libs // Android standard libs
compile "com.android.support:appcompat-v7:${version_lib.appcompat}" implementation "com.android.support:appcompat-v7:${version_lib.appcompat}"
compile "com.android.support:design:${version_lib.appcompat}" implementation "com.android.support:design:${version_lib.appcompat}"
compile "com.android.support:support-v4:${version_lib.appcompat}" implementation "com.android.support:support-v4:${version_lib.appcompat}"
compile "com.android.support:customtabs:${version_lib.appcompat}" implementation "com.android.support:customtabs:${version_lib.appcompat}"
compile "com.android.support:cardview-v7:${version_lib.appcompat}" implementation "com.android.support:cardview-v7:${version_lib.appcompat}"
// UI libraries // UI libraries
compile "com.github.DASAR:ShiftColorPicker:v0.5" implementation "com.github.DASAR:ShiftColorPicker:v0.5"
// Tool libraries // Tool libraries
compile "com.jakewharton:butterknife:${version_lib.butterknife}" implementation "com.jakewharton:butterknife:${version_lib.butterknife}"
compile "info.guardianproject.netcipher:netcipher:${version_lib.netcipher}" implementation "info.guardianproject.netcipher:netcipher:${version_lib.netcipher}"
compile "info.guardianproject.netcipher:netcipher-webkit:${version_lib.netcipher}" implementation "info.guardianproject.netcipher:netcipher-webkit:${version_lib.netcipher}"
annotationProcessor "com.jakewharton:butterknife-compiler:${version_lib.butterknife}" annotationProcessor "com.jakewharton:butterknife-compiler:${version_lib.butterknife}"
} }
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"])
static String[] getUsedAndroidLanguages() {
Set<String> langs = new HashSet<>()
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
final foldername = it.name
if (foldername.startsWith('values-') && !it.canonicalPath.contains("build" + File.separator + "intermediates")) {
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
langs.add(foldername.replace("values-", ""))
}
}
}
}
return langs.toArray(new String[langs.size()])
}
// #####################
// Groovy Coding Area
// #####################
final String RAW_DIR = "app/src/main/res/raw"
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "LICENSE.md", "CHANGELOG.md", "CONTRIBUTORS.md"]
// Called before building
task copyRepoFiles(type: Copy) {
// Copy files over to raw dir
from rootProject.files(ROOT_TO_RAW_COPYFILES)
into RAW_DIR.replaceFirst("app/", "")
rename { String fileName ->
fileName.replace(fileName, fileName.toLowerCase())
}
}
tasks.copyRepoFiles.execute()

View file

@ -3,10 +3,11 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -25,3 +26,35 @@ allprojects {
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "LICENSE.md", "CHANGELOG.md", "CONTRIBUTORS.md"]
task copyRepoFiles(type: Copy) {
from rootProject.files(ROOT_TO_RAW_COPYFILES)
into "app/src/main/res/raw"
rename { String fileName -> fileName.replace(fileName, fileName.toLowerCase()) }
} ; tasks.copyRepoFiles.execute()
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
static String[] getUsedAndroidLanguages() {
Set<String> langs = new HashSet<>()
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
final foldername = it.name
if (foldername.startsWith('values-') && !it.canonicalPath.contains("build" + File.separator + "intermediates")) {
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
langs.add(foldername.replace("values-", ""))
}
}
}
}
return langs.toArray(new String[langs.size()])
}
ext.getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}

18
gradle.properties Normal file → Executable file
View file

@ -1,18 +1,28 @@
# Project-wide Gradle settings. # Project-wide Gradle settings.
# IDE (e.g. Android Studio) users: # IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override* # Settings specified in this file will override any Gradle settings
# any settings specified in this file. # configured through the IDE.
# For more details on how to configure your build environment visit # For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m # Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true org.gradle.parallel=true
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

View file

@ -1,6 +1,6 @@
#Fri May 26 17:46:57 CEST 2017 #Thu Oct 26 13:46:14 CEST 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip