From 979e7b3aaba36caa2f19b3009dcf51bcefbb6048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Mon, 13 Nov 2023 20:29:34 +0100 Subject: [PATCH 1/4] feature: Add Kuksa SDK via GitHub Packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #1 Signed-Off-By: Mark Hüsers --- .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++ .github/workflows/commitlint.yaml | 14 +++++++++++++ app/build.gradle.kts | 4 ++-- gradle/libs.versions.toml | 9 ++++---- settings.gradle.kts | 35 +++++++++++++++---------------- 5 files changed, 71 insertions(+), 24 deletions(-) create mode 100755 .github/workflows/build.yaml create mode 100755 .github/workflows/commitlint.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100755 index 0000000..84b267c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: build + +on: + pull_request + +jobs: + build-project: + env: + GPR_USERNAME: ${{ github.actor }} + GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run 'assemble' with Gradle Wrapper + run: ./gradlew assemble + + - name: Run 'check' with Gradle Wrapper + run: ./gradlew ktlintCheck detekt + + - name: Run 'test' with Gradle Wrapper + run: ./gradlew test diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100755 index 0000000..ad770fd --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,14 @@ +name: commitlint + +on: + pull_request + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - uses: wagoid/commitlint-github-action@v5 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e4b14b3..f12defc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -31,7 +31,7 @@ android { defaultConfig { applicationId = "org.eclipse.kuksa.demo" minSdk = 27 - targetSdk = 33 + targetSdk = 34 versionCode = 1 versionName = "1.0" @@ -88,7 +88,7 @@ dependencies { implementation(libs.androidx.compose.ui.graphics) implementation(libs.androidx.compose.ui.tooling.preview) implementation(libs.androidx.compose.material3) - implementation("org.eclipse.kuksa:kuksa-sdk:0.1.0-SNAPSHOT") { + implementation(libs.kuksa.sdk) { isChanging = true } implementation(libs.androidx.datastore) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 61cb6e8..8e65f95 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] activityKtx = "1.8.0" -androidGradlePlugin = "8.1.2" # Check with detekt table first: https://detekt.dev/docs/introduction/compatibility/ +androidGradlePlugin = "8.1.3" # Check with detekt table first: https://detekt.dev/docs/introduction/compatibility/ coreKtx = "1.12.0" datastore = "1.0.0" espressoCore = "3.5.1" @@ -14,12 +14,12 @@ androidxLifecycle = "2.6.2" kotlinCompilerExtension = "1.5.1" composeBom = "2023.10.01" jvmTarget = "17" +kuksaSdk = "0.1.2-SNAPSHOT" lifecycleRuntimeCompose = "2.6.2" ramsesAar = "1.1.0" -navigationCompose = "2.7.4" +navigationCompose = "2.7.5" kotlinxSerializationJson = "1.6.0" constraintlayoutCompose = "1.0.1" -vssProcessor = "0.1.0-SNAPSHOT" [libraries] androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } @@ -34,7 +34,8 @@ androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidxLifecycle" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } -vss-processor = { module = "org.eclipse.kuksa.vss-processor:vss-processor", version.ref = "vssProcessor" } +kuksa-sdk = { module = "org.eclipse.kuksa:kuksa-sdk", version.ref = "kuksaSdk" } +vss-processor = { module = "org.eclipse.kuksa:vss-processor", version.ref = "kuksaSdk" } ramses-aar = { module = "io.github.bmwcarit:ramses-aar", version.ref = "ramsesAar" } # Compose diff --git a/settings.gradle.kts b/settings.gradle.kts index cf6677b..696cc0d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,21 +1,4 @@ -/* - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * 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 - * - */ +import java.util.Properties pluginManagement { repositories { @@ -29,6 +12,7 @@ pluginManagement { id("com.google.devtools.ksp") version "1.9.0-1.0.11" } } + dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { @@ -39,6 +23,21 @@ dependencyResolutionManagement { google() mavenCentral() mavenLocal() + maven { + url = uri("https://maven.pkg.github.com/eclipse-kuksa/kuksa-android-sdk") + credentials { + val localProperties = Properties().apply { + val localProperties = rootDir.listFiles()?.find { file -> + file.name == "local.properties" + } ?: return@apply + + load(localProperties.reader()) + } + + username = System.getenv("GPR_USERNAME") ?: localProperties.getProperty("gpr.user") + password = System.getenv("GPR_TOKEN") ?: localProperties.getProperty("gpr.key") + } + } } } From 07f6bac19ac4972cc242f35b76116c107135b0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Wed, 15 Nov 2023 14:17:20 +0100 Subject: [PATCH 2/4] chore: Align Detekt baseline file --- buildSrc/src/main/kotlin/detekt.gradle.kts | 2 +- ...kuksa-sdk-demo-android.xml => baseline.xml} | 0 settings.gradle.kts | 18 +++++++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) rename config/detekt/{baseline/kuksa-sdk-demo-android.xml => baseline.xml} (100%) diff --git a/buildSrc/src/main/kotlin/detekt.gradle.kts b/buildSrc/src/main/kotlin/detekt.gradle.kts index bfc5ded..1047ca1 100644 --- a/buildSrc/src/main/kotlin/detekt.gradle.kts +++ b/buildSrc/src/main/kotlin/detekt.gradle.kts @@ -20,7 +20,7 @@ import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask -val baselineFile = project.file("$rootDir/config/detekt/baseline/${project.name}.xml") +val baselineFile = project.file("$rootDir/config/detekt/baseline.xml") plugins { id("io.gitlab.arturbosch.detekt") // see https://github.com/detekt/detekt diff --git a/config/detekt/baseline/kuksa-sdk-demo-android.xml b/config/detekt/baseline.xml similarity index 100% rename from config/detekt/baseline/kuksa-sdk-demo-android.xml rename to config/detekt/baseline.xml diff --git a/settings.gradle.kts b/settings.gradle.kts index 696cc0d..0082a22 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,13 +26,7 @@ dependencyResolutionManagement { maven { url = uri("https://maven.pkg.github.com/eclipse-kuksa/kuksa-android-sdk") credentials { - val localProperties = Properties().apply { - val localProperties = rootDir.listFiles()?.find { file -> - file.name == "local.properties" - } ?: return@apply - - load(localProperties.reader()) - } + val localProperties = loadLocalProperties() username = System.getenv("GPR_USERNAME") ?: localProperties.getProperty("gpr.user") password = System.getenv("GPR_TOKEN") ?: localProperties.getProperty("gpr.key") @@ -42,3 +36,13 @@ dependencyResolutionManagement { } include(":app") + +fun loadLocalProperties(): Properties { + return Properties().apply { + val localProperties = rootDir.listFiles()?.find { file -> + file.name == "local.properties" + } ?: return@apply + + load(localProperties.reader()) + } +} From 61db3d9d90fe3ce897ee4528bbc46113a83d5f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Wed, 15 Nov 2023 14:27:41 +0100 Subject: [PATCH 3/4] chore: Simplify local property reading --- settings.gradle.kts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 0082a22..0e84239 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,10 +39,7 @@ include(":app") fun loadLocalProperties(): Properties { return Properties().apply { - val localProperties = rootDir.listFiles()?.find { file -> - file.name == "local.properties" - } ?: return@apply - + val localProperties = file("$rootDir/local.properties") load(localProperties.reader()) } } From 6cd1bdda3b257663d76ed00aaf02d80125a1726d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Wed, 15 Nov 2023 15:29:01 +0100 Subject: [PATCH 4/4] chore: Close read stream of local.properties --- settings.gradle.kts | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 0e84239..d271e71 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,22 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * 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 + * + */ + import java.util.Properties pluginManagement { @@ -28,8 +47,8 @@ dependencyResolutionManagement { credentials { val localProperties = loadLocalProperties() - username = System.getenv("GPR_USERNAME") ?: localProperties.getProperty("gpr.user") - password = System.getenv("GPR_TOKEN") ?: localProperties.getProperty("gpr.key") + username = System.getenv("GPR_USERNAME") ?: localProperties?.getProperty("gpr.user") + password = System.getenv("GPR_TOKEN") ?: localProperties?.getProperty("gpr.key") } } } @@ -37,9 +56,13 @@ dependencyResolutionManagement { include(":app") -fun loadLocalProperties(): Properties { - return Properties().apply { - val localProperties = file("$rootDir/local.properties") - load(localProperties.reader()) +fun loadLocalProperties(): Properties? { + val localProperties = file("$rootDir/local.properties") + if (!localProperties.exists()) return null + + localProperties.reader().use { reader -> + return Properties().apply { + load(reader) + } } }