1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-23 21:02:09 +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/pom.xml
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 ###
*~*
@ -99,3 +90,13 @@ proguard/
# Android Studio Stuff
.navigation/
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
jdk:
- 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
jdk: oraclejdk8
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:
directories:
# Android SDK
- $HOME/android-sdk-dl
- $HOME/android-sdk
# Gradle dependencies
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
script: "./gradlew $TASK"
env:
- TASK="lintFlavorDefaultDebug"
- TASK="build check --stacktrace"
# Android build cache (see http://tools.android.com/tech-docs/build-cache)
- $HOME/.android/build-cache
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:
except:
- l10n_master
- l10n_master2
- 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
- gh-pages
- l10n_master
- crowdin
after_success:
- bash <(curl -s https://codecov.io/bash)
env:
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 {
version_sdk = [
compileSdk : 24,
buildTools : "26.0.1",
minSdk : 17,
//targetSdk: compileSdk,
compileSdk: 27,
minSdk : 17,
]
version_sdk.targetSdk = version_sdk.compileSdk
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
butterknife : "8.4.0",
netcipher : "2.0.0-alpha1",
appcompat: "27.0.0",
butterknife: "8.8.1",
netcipher: "2.0.0-alpha1",
]
}
android {
compileSdkVersion version_sdk.compileSdk
buildToolsVersion version_sdk.buildTools
flavorDimensions "default"
defaultConfig {
minSdkVersion version_sdk.minSdk
targetSdkVersion version_sdk.targetSdk
versionCode 27
versionName "1.0.7"
applicationId "com.github.dfa.diaspora_android"
resValue 'string', 'app_name', "dandelion*"
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
targetSdkVersion version_sdk.compileSdk
buildConfigField "boolean", "IS_TEST_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
resValue 'string', 'app_name', "dandelion*"
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
@ -46,13 +52,9 @@ android {
productFlavors {
flavorDefault {
}
/*
flavorGplay {
/*flavorGplay {
buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
}
*/
}*/
flavorTest {
applicationId "com.github.dfa.secondlion"
resValue 'string', 'app_name', "secondlion*"
@ -69,61 +71,26 @@ android {
dependencies {
// Sub-Projects
//compile project(':subprojectFromRoot')
//implementation project(':subprojectFromRoot')
// Jars
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
// Android standard libs
compile "com.android.support:appcompat-v7:${version_lib.appcompat}"
compile "com.android.support:design:${version_lib.appcompat}"
compile "com.android.support:support-v4:${version_lib.appcompat}"
compile "com.android.support:customtabs:${version_lib.appcompat}"
compile "com.android.support:cardview-v7:${version_lib.appcompat}"
implementation "com.android.support:appcompat-v7:${version_lib.appcompat}"
implementation "com.android.support:design:${version_lib.appcompat}"
implementation "com.android.support:support-v4:${version_lib.appcompat}"
implementation "com.android.support:customtabs:${version_lib.appcompat}"
implementation "com.android.support:cardview-v7:${version_lib.appcompat}"
// UI libraries
compile "com.github.DASAR:ShiftColorPicker:v0.5"
implementation "com.github.DASAR:ShiftColorPicker:v0.5"
// Tool libraries
compile "com.jakewharton:butterknife:${version_lib.butterknife}"
compile "info.guardianproject.netcipher:netcipher:${version_lib.netcipher}"
compile "info.guardianproject.netcipher:netcipher-webkit:${version_lib.netcipher}"
implementation "com.jakewharton:butterknife:${version_lib.butterknife}"
implementation "info.guardianproject.netcipher:netcipher:${version_lib.netcipher}"
implementation "info.guardianproject.netcipher:netcipher-webkit:${version_lib.netcipher}"
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 {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -25,3 +26,35 @@ allprojects {
task clean(type: Delete) {
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()
}

46
gradle.properties Normal file → Executable file
View file

@ -1,18 +1,28 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# 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
# org.gradle.parallel=true
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
# For more details on how to configure your build environment visit
# 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.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# 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
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
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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