Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Yauheni Khnykin <yauheni.khnykin@here.com>
  • Loading branch information
Hsilgos committed Jan 7, 2024
1 parent 5d29c24 commit 85cf416
Show file tree
Hide file tree
Showing 13 changed files with 250 additions and 117 deletions.
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.9.20"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.22.0"
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 '18.1.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 = "17"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "17"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
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:8.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
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:6.22.0'
classpath libs.spotless.plugin.gradle

modules {
module("org.jetbrains.trove4j:trove4j") {
Expand Down
34 changes: 11 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 @@ -89,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 @@ -114,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
41 changes: 14 additions & 27 deletions functional-tests/namerules/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-2023 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 @@ -21,8 +21,6 @@ apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

project.buildDir = "${rootProject.buildDir}"

def getCMakeCommonParameters() {
Expand Down Expand Up @@ -79,49 +77,38 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

libraryVariants.all { variant ->
def typeName = variant.name
def typeCapitalised = typeName.capitalize()

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

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

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())

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

implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.21"
implementation libs.bundles.kotlin

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: 'gluecodium.gradle'
Expand Down
4 changes: 2 additions & 2 deletions functional-tests/scripts/build-android-functional
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ INSTALL_AAR_DIR="${ANDROID_DIR}/app/libs/"
TMP_DIR=$(mktemp -d)

if $HOST_ONLY; then
./gradlew functional:testRelease -PhostOnly -PgluecodiumVersion=${GLUECODIUM_VERSION}
./gradlew functional:testRelease -PhostOnly -PgluecodiumVersion=${GLUECODIUM_VERSION} --info
else
./gradlew functional:testRelease -PgluecodiumVersion=${GLUECODIUM_VERSION}
./gradlew functional:testRelease -PgluecodiumVersion=${GLUECODIUM_VERSION} --info
fi

if [ "$GENERATE_DOCS" = true ]; then
Expand Down
10 changes: 9 additions & 1 deletion functional-tests/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
include ':functional', ':namerules'
project(':functional').projectDir=new File(rootProject.projectDir, 'functional')
project(':namerules').projectDir=new File(rootProject.projectDir, 'namerules')
project(':namerules').projectDir=new File(rootProject.projectDir, 'namerules')

dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}
30 changes: 24 additions & 6 deletions gluecodium-gradle/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
*/

plugins {
id 'java-gradle-plugin'
}
Expand All @@ -9,15 +28,14 @@ repositories {
dependencies {
implementation project(":gluecodium")

implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.21'
implementation('com.android.tools.build:gradle:7.2.1') {
implementation libs.kotlin.stdlib
implementation (libs.android.tools.build.gradle) {
exclude group: 'net.sf.proguard', module: 'proguard-gradle'
}
implementation 'com.natpryce:konfig:1.6.10.0'
implementation libs.natpryce.konfig

testImplementation 'io.mockk:mockk-dsl-jvm:1.12.2'
testImplementation 'io.mockk:mockk:1.12.2'
testImplementation 'junit:junit:4.13.2'
testImplementation libs.bundles.mockk
testImplementation libs.junit
}

gradlePlugin {
Expand Down
Loading

0 comments on commit 85cf416

Please # to comment.