Skip to content

Commit

Permalink
Merge pull request #367 from apivideo/feature/java_upgrade_gradle
Browse files Browse the repository at this point in the history
chore(java): upgrade to gradle 8.2.2
  • Loading branch information
ThibaultBee authored Feb 12, 2024
2 parents 4732074 + 9a39f18 commit 8bc8d12
Show file tree
Hide file tree
Showing 27 changed files with 139 additions and 63 deletions.
4 changes: 4 additions & 0 deletions config/android-uploader.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
changelog:
- 1.3.4 (2024-01-08):
- Upgrade dependencies, gradle and Kotlin
- 1.3.3 (2023-12-14):
- Add support for API level >= 34 for WorkManager
- 1.3.2 (2023-09-26):
Expand Down Expand Up @@ -160,3 +162,5 @@ files:
android/work/DataExtensions.mustache:
folder: src/main/java/video/api/uploader/api/work
destinationFilename: DataExtensions.kt
consumer-rules.mustache:
destinationFilename: consumer-rules.pro
6 changes: 5 additions & 1 deletion config/android.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
changelog:
- 1.5.4 (2024-01-08):
- Upgrade dependencies, gradle and Kotlin
- 1.5.3 (2023-12-14):
- Add support for API level >= 34 for WorkManager
- 1.5.2 (2023-09-26):
Expand Down Expand Up @@ -178,4 +180,6 @@ files:
destinationFilename: WorkManagerExtensions.kt
android/work/DataExtensions.mustache:
folder: src/main/java/video/api/client/api/work
destinationFilename: DataExtensions.kt
destinationFilename: DataExtensions.kt
consumer-rules.mustache:
destinationFilename: consumer-rules.pro
28 changes: 28 additions & 0 deletions templates/java/consumer-rules.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Workaround for internal missing proguard rules
-dontwarn aQute.bnd.annotation.spi.ServiceProvider
-dontwarn jakarta.validation.valueextraction.UnwrapByDefault
-dontwarn jakarta.validation.valueextraction.ValueExtractor
-dontwarn javax.validation.valueextraction.UnwrapByDefault
-dontwarn javax.validation.valueextraction.ValueExtractor
2 changes: 1 addition & 1 deletion templates/java/gradle-wrapper.properties.mustache
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.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions templates/java/gradle.properties.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{#android}}
target = android
android.useAndroidX=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
{{/android}}
51 changes: 30 additions & 21 deletions templates/java/libraries/okhttp-gson/build.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ buildscript {
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1'
{{#android}}
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21'
classpath 'com.android.tools.build:gradle:8.2.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22'
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1'
{{/android}}
}
Expand All @@ -37,13 +37,16 @@ if(hasProperty('target') && target == 'android') {
apply from: 'maven-push.gradle'
android {
compileSdkVersion 33
buildToolsVersion '30.0.3'
compileSdk 34
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
minSdk 21
targetSdk 34
multiDexEnabled true
consumerProguardFiles 'consumer-rules.pro'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument("runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder")
testInstrumentationRunnerArgument("environmentVariables", "INTEGRATION_TESTS_API_KEY=${System.getenv("INTEGRATION_TESTS_API_KEY")}")
Expand All @@ -53,6 +56,12 @@ if(hasProperty('target') && target == 'android') {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

namespace "{{invokerPackage}}"
}

} else {
Expand Down Expand Up @@ -89,12 +98,12 @@ if(hasProperty('target') && target == 'android') {
dependencies {
implementation 'io.swagger:swagger-annotations:1.5.24'
implementation "com.google.code.findbugs:jsr305:3.0.2"
api 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'io.gsonfire:gson-fire:1.8.4'
api 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'io.gsonfire:gson-fire:1.9.0'
{{#openApiNullable}}
implementation 'org.openapitools:jackson-databind-nullable:0.2.1'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
{{/openApiNullable}}
{{#hasOAuthMethods}}
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
Expand All @@ -104,31 +113,31 @@ dependencies {
implementation 'joda-time:joda-time:2.9.9'
{{/joda}}
{{#threetenbp}}
implementation 'org.threeten:threetenbp:1.5.2'
implementation 'org.threeten:threetenbp:1.6.8'
{{/threetenbp}}
{{#dynamicOperations}}
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.23'
{{/dynamicOperations}}
{{#android}}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.work:work-runtime-ktx:2.8.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.22"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.work:work-runtime-ktx:2.9.0'
{{/android}}
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.12.4'
testImplementation 'org.mockito:mockito-core:5.7.0'
testImplementation 'org.assertj:assertj-core:3.19.0'
{{#android}}
testImplementation "com.google.truth:truth:1.1.3"
androidTestImplementation "com.google.truth:truth:1.1.3"
testImplementation "com.google.truth:truth:1.4.0"
androidTestImplementation "com.google.truth:truth:1.4.0"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
androidTestImplementation 'de.mannodermaus.junit5:android-test-core:1.3.0'
androidTestRuntimeOnly 'de.mannodermaus.junit5:android-test-runner:1.3.0'
androidTestImplementation 'de.mannodermaus.junit5:android-test-core:1.10.0'
androidTestRuntimeOnly 'de.mannodermaus.junit5:android-test-runner:1.10.0'
{{/android}}
}

Expand Down
2 changes: 1 addition & 1 deletion templates/java/manifest.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest package="{{invokerPackage}}" xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
12 changes: 11 additions & 1 deletion templates/java/maven-push.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ def getRepositoryPassword() {
return hasProperty('OSSRH_PASSWORD') ? OSSRH_PASSWORD : System.getenv("OSSRH_PASSWORD")
}

afterEvaluate { project ->
android {
publishing {
multipleVariants {
withSourcesJar()
withJavadocJar()
allVariants()
}
}
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Check out current repository code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Create the documentation pull request
uses: apivideo/api.video-create-readme-file-pull-request-action@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
update-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Create draft release if needed
uses: apivideo/api.video-release-from-changelog-action@main
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Make gradlew executable
run: chmod +x ./gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,34 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES']
}
}

buildFeatures {
viewBinding true
}

namespace "video.api.uploader.service.example"
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.preference:preference-ktx:1.2.1'

implementation project(path: ':')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="video.api.uploader.service.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,37 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES']
}
}

buildFeatures {
viewBinding true
}

namespace "video.api.uploader.work.example"
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.preference:preference-ktx:1.2.1'

implementation project(path: ':')
implementation 'androidx.work:work-runtime-ktx:2.8.0'
implementation 'androidx.work:work-runtime-ktx:2.9.0'

testImplementation 'junit:junit:4.13.2'
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="video.api.uploader.work.example">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>
<string name="upload_notification_channel_name">Video uploader</string>
<string name="upload_notification_progress_title">Uploading</string>
<string name="upload_notification_progress_text">Uploaded %1d of %1d</string>
<string name="upload_notification_progress_text">Uploaded %1d of %2d</string>
<string name="upload_notification_current_progress_text">%1d %%</string>
<string name="upload_notification_error_title">Upload error</string>
<string name="upload_notification_upload_started_title">Upload starting…</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Check out current repository code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Create the documentation pull request
uses: apivideo/api.video-create-readme-file-pull-request-action@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
update-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Create draft release if needed
uses: apivideo/api.video-release-from-changelog-action@main
with:
Expand Down
6 changes: 3 additions & 3 deletions templates/java/statics/android/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
Expand Down
Loading

0 comments on commit 8bc8d12

Please sign in to comment.