Skip to content

Commit

Permalink
Merge pull request #31 from Umweltzone/project-setup
Browse files Browse the repository at this point in the history
Update project setup (Kotlin 1.6.10, Dokka 1.6.10, ConstraintLayout 2.1.3, AGP 7.1.2, JDK 11, Gradle 7.4.1, SDK 31)
  • Loading branch information
johnjohndoe authored Mar 26, 2022
2 parents d8f942d + c0c7a89 commit d0673cf
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
java-version: '11'

- name: Build the app
run: ./gradlew assembleDebug
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
java-version: '11'

- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
80 changes: 46 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
sudo: false
dist: focal

dist: trusty
language: java

language: android
jdk: openjdk11

jdk: oraclejdk8
env:
global:
# Android command line tools, check for updates here https://developer.android.com/studio/#command-tools
- COMMAND_LINE_TOOLS_VERSION=7583922
- ANDROID_HOME=$HOME/android-sdk
- TARGET_SDK_VERSION=`grep -H targetSdk buildSrc/src/main/kotlin/info/metadude/kotlin/library/roadsigns/Dependencies.kt | grep -Po "\d+"`
- BUILD_TOOLS_VERSION=`grep -H buildToolsVersion buildSrc/src/main/kotlin/info/metadude/kotlin/library/roadsigns/Dependencies.kt | grep -Po "\d+.\d+.\d+"`

branches:
except:
- /^v\..*$/ # Exclude version tags

notifications:
email: true

before_script:
- android-wait-for-emulator
- adb shell input keyevent 82

install:
- ./gradlew clean assembleDebug testDebug assembleAndroidTest --stacktrace -PdisablePreDex

script:
- ./gradlew testDebug connectedCheck --stacktrace -PdisablePreDex

before_cache:
- rm -f $TRAVIS_BUILD_DIR/.gradle/caches/modules-2/modules-2.lock
- rm -fr $TRAVIS_BUILD_DIR/.gradle/caches/*/plugin-resolution/
# 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:
- $TRAVIS_BUILD_DIR/.gradle/caches/
- $TRAVIS_BUILD_DIR/.gradle/wrapper/
- $TRAVIS_BUILD_DIR/.android/build-cache
# Android
- $HOME/android-cmdline-tools
- $HOME/android-sdk
- $HOME/.android/build-cache

before_install:
# Reduce memory usage / avoid OutOfMemoryError with Gradle 4.10.3+
- echo "org.gradle.jvmargs=-Xmx2048m -Xms512m -XX:MaxPermSize=768m" >> gradle.properties
# Make Gradle wrapper executable.
# Gradle
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

install:
- mkdir -p $HOME/android-cmdline-tools
# Download and unzip the Android command line tools (if not already there thanks to the cache mechanism)
- if test ! -e $HOME/android-cmdline-tools/cmdline-tools.zip ; then curl "https://dl.google.com/android/repository/commandlinetools-linux-${COMMAND_LINE_TOOLS_VERSION}_latest.zip" > $HOME/android-cmdline-tools/cmdline-tools.zip ; fi
- unzip -qq -n $HOME/android-cmdline-tools/cmdline-tools.zip -d $HOME/android-cmdline-tools
- echo y | $HOME/android-cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk "platform-tools"
- echo y | $HOME/android-cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk "build-tools;${BUILD_TOOLS_VERSION}"
- echo y | $HOME/android-cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk "platforms;android-${TARGET_SDK_VERSION}"

before_script:
# To see if the correct values have been extracted.
- echo TARGET_SDK_VERSION=$TARGET_SDK_VERSION
- echo BUILD_TOOLS_VERSION=$BUILD_TOOLS_VERSION

# Ensure Gradle wrapper is executable
- chmod +x gradlew
# Install SDK license so Android Gradle plugin can install dependencies.
- mkdir "$ANDROID_HOME/licenses" || true
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" >> "$ANDROID_HOME/licenses/android-sdk-license"
# Install the rest of tools (e.g., avdmanager)
- sdkmanager tools
# Install the system image
- sdkmanager "system-images;android-18;default;armeabi-v7a"
# Create and start emulator for the script. Meant to race the install task.
- echo no | avdmanager create avd --force -n test -k "system-images;android-18;default;armeabi-v7a"
- $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window &

# Reduce memory usage / avoid OutOfMemoryError with Gradle 4.10.3
- echo "org.gradle.jvmargs=-Xmx2048m -Xms512m -XX:MaxPermSize=768m" >> gradle.properties

script:
- ./gradlew clean testDebug assembleDebug -PdisablePreDex
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Road signs changelog

## NEXT

* Not published yet

### Changes

* Use Kotlin v.1.6.10.
* Use targetSdkVersion 31, compileSdkVersion 31.
* Target JDK 11.
* Use Android plugin for Gradle v.7.1.2.


## [v.4.2.0](https://github.com/Umweltzone/roadsigns/releases/tag/v.4.2.0)

* Published: 2021-11-14
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ build the sources directly from [this repository][github-roadsigns].

## License

Copyright 2019-2021 Tobias Preuss
Copyright 2019-2022 Tobias Preuss

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
15 changes: 10 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ apply plugin: "com.android.application"
apply plugin: "kotlin-android"

android {
compileSdkVersion Android.compileSdkVersion
buildToolsVersion Android.buildToolsVersion
compileSdk Android.compileSdkVersion

defaultConfig {
applicationId "${project.groupId}.demo"
minSdkVersion Android.minSdkVersion
targetSdkVersion Android.targetSdkVersion
minSdk Android.minSdkVersion
targetSdk Android.targetSdkVersion
versionCode Integer.valueOf(project.versionCode)
versionName project.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}

sourceSets {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name=".DemoActivity">
<activity
android:name=".DemoActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
repositories {
google()
mavenCentral()
jcenter()
gradlePluginPortal()
}

Expand All @@ -23,6 +22,5 @@ allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
package info.metadude.kotlin.library.roadsigns

object Android {
const val compileSdkVersion = 30
const val buildToolsVersion = "30.0.3"
const val compileSdkVersion = 31
const val minSdkVersion = 14
const val targetSdkVersion = 30
const val targetSdkVersion = 31
}

object Plugins {

private object Versions {
const val android = "4.2.2"
const val dokka = "1.5.31"
const val kotlin = "1.5.31"
const val versions = "0.39.0"
const val android = "7.1.2"
const val dokka = "1.6.10"
const val kotlin = "1.6.10"
const val versions = "0.42.0"
}

const val android = "com.android.tools.build:gradle:${Versions.android}"
Expand All @@ -27,8 +28,8 @@ object Libs {

private object Versions {
const val annotation = "1.3.0"
const val appCompat = "1.3.1"
const val constraintLayout = "2.1.1"
const val appCompat = "1.4.1"
const val constraintLayout = "2.1.3"
const val espresso = "3.4.0"
const val testExtJunit = "1.1.3"
const val vectorDrawable = "1.1.0"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 9 additions & 5 deletions roadsigns/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ apply plugin: "signing"
apply plugin: "org.jetbrains.dokka"

android {
compileSdkVersion Android.compileSdkVersion
compileSdk Android.compileSdkVersion

defaultConfig {
minSdkVersion Android.minSdkVersion
targetSdkVersion Android.targetSdkVersion
minSdk Android.minSdkVersion
targetSdk Android.targetSdkVersion
versionCode Integer.valueOf(project.versionCode)
versionName project.versionName
vectorDrawables.useSupportLibrary = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}

sourceSets {
Expand Down

0 comments on commit d0673cf

Please sign in to comment.