Skip to content

Commit

Permalink
Merge pull request #123 from AngeloAvv/openjdk-17-jdk
Browse files Browse the repository at this point in the history
Added openjdk-17-jdk to the Dockerfile
  • Loading branch information
flolom authored Dec 1, 2023
2 parents 17b0203 + 73d9e5c commit eaf51cb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ENV LANG=en_US.UTF-8

## Install dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
openjdk-17-jdk \
openjdk-11-jdk \
openjdk-8-jdk \
git \
Expand Down Expand Up @@ -49,6 +50,7 @@ RUN mkdir $JENV_ROOT/versions
ENV JDK_ROOT "/usr/lib/jvm/"
RUN jenv add ${JDK_ROOT}/java-8-openjdk-amd64
RUN jenv add ${JDK_ROOT}/java-11-openjdk-amd64
RUN jenv add ${JDK_ROOT}/java-17-openjdk-amd64
RUN echo 'export PATH="$JENV_ROOT/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(jenv init -)"' >> ~/.bashrc

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ keep track of missing native libraries and add them to the next image version.

## JDK support
Images support multiple JDK, using [Jenv](https://www.jenv.be/).
The default JDK is JDK 11, but JDK 8 is also supported for Android API 30 or lower (use `jenv global 1.8`).
The default JDK is JDK 17, but JDK 11 and 8 are also supported (i.e. use `jenv global 1.8` to set JDK to verion 8).
To choose a JDK, make sure the script executes on a bash shell, then use Jenv to set the desired version:
```
jobs:
Expand Down
10 changes: 5 additions & 5 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ if [ "$gcloud" = true ]; then
fi

# Setup test app environment variables
export KOTLIN_VERSION="1.3.71"
export GRADLE_VERSION="7.3"
export ANDROID_GRADLE_TOOLS_VERSION="7.0.3"
export KOTLIN_VERSION="1.9.10"
export GRADLE_VERSION="8.3"
export ANDROID_GRADLE_TOOLS_VERSION="8.1.1"
export COMPILE_SDK_VERSION="$android_api"
export BUILD_TOOLS_VERSION="$android_build_tools"
export MIN_SDK_VERSION=21
export TARGET_SDK_VERSION="$android_api"
export NDK_VERSION="21.0.6113669"
jenv global 11
jenv global 17

setup_gradle_version() {
if grep -q "distributionUrl" ./gradle/wrapper/gradle-wrapper.properties; then
Expand Down Expand Up @@ -112,7 +112,7 @@ if (( "$android_api" < 31 )); then
jenv global 1.8
exec_test "$script_path"/test-app-jdk-8

jenv global 11
jenv global 17
fi

exit 0
14 changes: 13 additions & 1 deletion tests/test-app/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
namespace 'com.fabernovel.testapp'
compileSdkVersion System.getenv("COMPILE_SDK_VERSION") as Integer
buildToolsVersion System.getenv("BUILD_TOOLS_VERSION")

Expand All @@ -16,13 +16,25 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

}

dependencies {
Expand Down
4 changes: 1 addition & 3 deletions tests/test-app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fabernovel.testapp"
>
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down

0 comments on commit eaf51cb

Please sign in to comment.