Skip to content

Commit

Permalink
Updates gradle 7.4 -> 8.2 (#1561)
Browse files Browse the repository at this point in the history
* Updated build system

- Gradle is updated 7.4 -> 8.2
- Gradle scripts are updated to work with new updated Gradle
- Central repository of dependencies is used
- Dependencies are updated
- CI uses Java 17 instead of 11

Signed-off-by: Yauheni Khnykin <[email protected]>

* Applies new klint format

Signed-off-by: Yauheni Khnykin <[email protected]>

---------

Signed-off-by: Yauheni Khnykin <[email protected]>
  • Loading branch information
Hsilgos authored Jan 9, 2024
1 parent 5fcdcd5 commit d866b4e
Show file tree
Hide file tree
Showing 248 changed files with 4,834 additions and 4,031 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -339,7 +339,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2019 HERE Europe B.V.
* Copyright (C) 2016-2024 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,9 +23,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.10.2"
classpath libs.kotlin.gradle.plugin
classpath libs.build.info.extractor.gradle
classpath libs.spotless.plugin.gradle

modules {
module("org.jetbrains.trove4j:trove4j") {
Expand All @@ -35,12 +35,13 @@ buildscript {
}
}
plugins {
id 'nebula.lint' version '16.9.0'
alias libs.plugins.nebula.lint
}

allprojects {
repositories {
mavenCentral()
google()
}

configurations.all {
Expand All @@ -58,15 +59,22 @@ allprojects {

compileJava {
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
compileTestJava {
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
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.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 41 additions & 3 deletions functional-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright (C) 2016-2024 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

ext {
ndkVersion = '24.0.8215888'
compileSdkVersion = 31
Expand Down Expand Up @@ -67,21 +86,40 @@ public class BuildCMakeNativeHost extends DefaultTask {

ext.BuildCMakeNativeHost = BuildCMakeNativeHost

static def dependJavaTasksOnNativeBuild(tasks, isHostOnly) {
tasks.configureEach { task ->
['Debug', 'Release'].each { buildType ->
if (task.name == "javaPreCompile${buildType}" ||
task.name == "javaPreCompile${buildType}UnitTest" ||
task.name == "compile${buildType}UnitTestJavaWithJavac" ||
task.name == "package${buildType}Resources" ||
task.name == "generate${buildType}ResValues" ||
task.name == "process${buildType}Manifest") {
if (isHostOnly) {
task.dependsOn "build${buildType}NativeHost"
} else {
task.dependsOn "externalNativeBuild${buildType}"
}
}
}
}
}

buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
classpath libs.android.tools.build.gradle
classpath libs.kotlin.gradle.plugin

def gluecodiumVersion = project.hasProperty('gluecodiumVersion')
? project.property('gluecodiumVersion').toString().trim() : '+'

classpath "com.here.gluecodium:gluecodium-gradle:${gluecodiumVersion}"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.10.2'
classpath libs.spotless.plugin.gradle

modules {
module("org.jetbrains.trove4j:trove4j") {
Expand Down
36 changes: 13 additions & 23 deletions functional-tests/functional/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2019 HERE Europe B.V.
* Copyright (C) 2016-2024 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,8 @@ android {
ndkVersion rootProject.ndkVersion
compileSdkVersion rootProject.compileSdkVersion

namespace 'com.here.gluecodium.test.functional'

defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
Expand Down Expand Up @@ -87,19 +89,20 @@ android {
def typeName = variant.name
def typeCapitalised = typeName.capitalize()

def buildNativeProject = task("build${typeCapitalised}NativeHost", type: BuildCMakeNativeHost) {
tasks.register("build${typeCapitalised}NativeHost", BuildCMakeNativeHost) {
projectDir = rootProject.projectDir
buildDir = file(buildNativeHostDir('functional', typeName))
cmakeParameters = getCMakeCommonParameters()
target = 'functional'
buildType = variant.buildType.name
dependsOn("generate${typeCapitalised}BuildConfig")
}

buildConfigField "String", "NATIVE_LIB_HOST_DIR", "\"${buildNativeHostDir('functional', typeName)}/functional\""
}
}

task generateJavadoc(type: Javadoc) {
tasks.register('generateJavadoc', Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += files(android.getBootClasspath().join(File.pathSeparator))
exclude '**/jni/**', '**.xml'
Expand All @@ -112,34 +115,21 @@ task generateJavadoc(type: Javadoc) {
}
}

tasks.configureEach { task ->
// Java compilation depends on .java/.jar files created by CMake
if (task.name == 'javaPreCompileDebug' || task.name == 'compileDebugUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildDebug'
}
task.dependsOn 'buildDebugNativeHost'
}
if (task.name == 'javaPreCompileRelease' || task.name == 'compileReleaseUnitTestJavaWithJavac') {
if (!rootProject.isHostOnly()) {
task.dependsOn 'externalNativeBuildRelease'
}
task.dependsOn 'buildReleaseNativeHost'
}
dependJavaTasksOnNativeBuild(tasks, rootProject.isHostOnly())

tasks.configureEach { task ->
if (task.name == 'generateJavadoc') {
task.mustRunAfter 'buildDebugNativeHost', 'buildReleaseNativeHost', 'externalNativeBuildDebug', 'externalNativeBuildRelease'
}
}

dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation libs.androidx.annotation

testImplementation 'junit:junit:4.13.2'
testImplementation "org.powermock:powermock-reflect:2.0.9"
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation libs.junit
testImplementation libs.powermock.reflect
testImplementation libs.robolectric
testImplementation libs.bundles.hamcrest
}

apply plugin: 'com.diffplug.spotless'
Expand Down
3 changes: 2 additions & 1 deletion functional-tests/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
minifyDebugBuilds=false
org.gradle.jvmargs=-Xmx4096m
android.useAndroidX=true
android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
2 changes: 1 addition & 1 deletion functional-tests/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.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit d866b4e

Please sign in to comment.