Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VSS Processor Plugin #71

Merged
merged 32 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aa3d2d2
feature: Add VSS Processor Plugin
Chrylo Dec 20, 2023
121a0e6
chore: Add publish of VSS Processor Plugin
Chrylo Jan 15, 2024
848f019
chore: Enable publish for VSS Processor Plugin
Chrylo Jan 31, 2024
aad0a0c
docs: Add VSS Processor Plugin docs
Chrylo Jan 31, 2024
09411de
chore: Update Checkout to v4
Chrylo Jan 31, 2024
e997a91
chore: Add automatic search to VSS files
Chrylo Feb 1, 2024
3227633
chore: Switch to gradle publish plugin
Chrylo Feb 2, 2024
c35e53e
chore: Update documentation
Chrylo Feb 6, 2024
ba976fe
Merge branch 'main' into feature-45
Chrylo Feb 6, 2024
bf74188
chore: Support incremental builds Vss Plugin tasks
Chrylo Feb 9, 2024
eef025c
chore: Enable Gradle configuration cache
Chrylo Feb 9, 2024
f08a5a9
chore: Add support for config caches
Chrylo Feb 13, 2024
f4b3882
chore: Change SemanticVersion handling
Chrylo Feb 13, 2024
25345ad
chore: Update dependencies
Chrylo Feb 13, 2024
4d56a1d
Merge branch 'main' into feature-45
Chrylo Feb 13, 2024
486b371
chore: Improve semantic version handling
Chrylo Feb 14, 2024
6b5c34a
chore: Fix clean builds for VSS Plugin
Chrylo Feb 14, 2024
49729c4
chore: Fix buildDir for javadocJar task
Chrylo Feb 15, 2024
ac9d61a
chore: Link composite plugin build only to vss-processor
Chrylo Feb 21, 2024
3a03c0f
test: Add VSS Processor Plugin tests
Chrylo Feb 21, 2024
1b2dfc0
test: Add tests for outdated cache
Chrylo Feb 22, 2024
33441b7
chore: Improve logging
Chrylo Feb 22, 2024
8f00509
chore: Link :clean task with VSS Processor Plugin
Chrylo Feb 22, 2024
e4d6734
chore: Correct composite task linking logging
Chrylo Feb 22, 2024
890393d
chore: Reverse logging order for linked composite tasks
Chrylo Feb 22, 2024
77efd21
chore: Remove FunctionTests run config
Chrylo Feb 22, 2024
889b329
chore: Fix missing oss/all folder during clean build
Chrylo Feb 22, 2024
fb3e8fd
chore: Add comment to be mindful of oss licenses
Chrylo Feb 23, 2024
9da0507
chore: Add known issue explanation for build warning
Chrylo Feb 23, 2024
6c3d7bc
chore: Disable config cache for maven task
Chrylo Feb 26, 2024
d4ebab1
chore: Remove clean from composite linking
Chrylo Feb 27, 2024
f591fb5
Merge branch 'main' into feature-45
Chrylo Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Project
uses: ./.github/actions/setup-project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Run Docker Container of Databroker in detached mode"
run: docker run --pull=always --rm --publish 55556:55556/tcp --detach --name databroker ghcr.io/eclipse/kuksa.val/databroker:master --port 55556 --insecure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# required to grab the history of the PR
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: wagoid/commitlint-github-action@v5
2 changes: 1 addition & 1 deletion .github/workflows/dash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Project
uses: ./.github/actions/setup-project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Project
uses: ./.github/actions/setup-project
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Project
uses: ./.github/actions/setup-project
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ within an Android App. The main functionality consists of fetching, updating and

## Integration

*build.gradle*
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
*build.gradle.kts*
```
implementation("org.eclipse.kuksa:kuksa-sdk:<VERSION>")
```
Expand Down
19 changes: 17 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.eclipse.kuksa.property.PropertiesLoader

/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
Expand All @@ -19,9 +17,16 @@ import org.eclipse.kuksa.property.PropertiesLoader
*
*/

@file:Suppress("UnstableApiUsage")

import com.google.devtools.ksp.gradle.KspTask
import org.eclipse.kuksa.property.PropertiesLoader
import org.eclipse.kuksa.vssprocessor.plugin.ProvideVssDefinitionTask

plugins {
id("com.android.application")
id("com.google.devtools.ksp")
id("org.eclipse.kuksa.vss-processor-plugin")
kotlin("plugin.serialization")
kotlin("android")
}
Expand Down Expand Up @@ -121,6 +126,16 @@ android {
}
}

tasks.register<ProvideVssDefinitionTask>("ProvideVssDefinition") {
val vssDefinitionFilePath = "$projectDir/src/main/assets/vss_rel_4.0.yaml"
val regularFile = RegularFile { File(vssDefinitionFilePath) }
vssDefinitionFile.add(regularFile)
}

tasks.withType<KspTask> {
dependsOn(tasks.withType<ProvideVssDefinitionTask>())
}

tasks.withType<Test>().configureEach {
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
useJUnitPlatform()

Expand Down
16 changes: 5 additions & 11 deletions buildSrc/src/main/kotlin/publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,12 @@ afterEvaluate {
)

sign(publishing.publications)
}
}

gradle.taskGraph.whenReady {
tasks.withType(Sign::class) {
val publishToMavenLocalTask = allTasks.find { it.name.contains("publishToMavenLocal") }
val isPublishingToMavenLocal = publishToMavenLocalTask != null

if (isPublishingToMavenLocal) {
println(":${project.name}:$name - Signing is disabled (publishToMavenLocal)")
}
setRequired({
val publishToMavenLocalTask = gradle.taskGraph.allTasks.find { it.name.contains("ToMavenLocal") }
val isPublishingToMavenLocal = publishToMavenLocalTask != null

onlyIf { !isPublishingToMavenLocal } // disable signing when publishing to MavenLocal
!isPublishingToMavenLocal // disable signing when publishing to MavenLocal
})
}
}
23 changes: 20 additions & 3 deletions docs/QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Get instantly bootstrapped into the world of the KUKSA SDK with the following co

## Integration

*build.gradle*
*build.gradle.kts*
```
implementation("org.eclipse.kuksa:kuksa-sdk:<VERSION>")
```
Expand Down Expand Up @@ -153,9 +153,26 @@ For a more convenient usage you can opt in to auto generate Kotlin models via [S
of the same specification the Databroker uses. For starters you can retrieve an extensive default specification from the
release page of the [COVESA Vehicle Signal Specification GitHub repository](https://github.com/COVESA/vehicle_signal_specification/releases).

*build.gradle*
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
*build.gradle.kts*
```
ksp("org.eclipse.kuksa:vss-processor:<VERSION>")
plugins {
id("org.eclipse.kuksa.vss-processor-plugin")
}

dependencies {
ksp("org.eclipse.kuksa:vss-processor:<VERSION>")
}

// Copies the given specification file to the KSP processor
tasks.register<ProvideVssDefinitionTask>("ProvideVssDefinition") {
val vssDefinitionFilePath = "$projectDir/src/main/assets/<VSS_FILE.yml>"
val regularFile = RegularFile { File(vssDefinitionFilePath) }
vssDefinitionFile.add(regularFile)
}

tasks.withType<KspTask> {
dependsOn(tasks.withType<ProvideVssDefinitionTask>())
}
```

Use the new [`VssDefinition`](https://github.com/eclipse-kuksa/kuksa-android-sdk/blob/main/vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt) annotation and provide the path to the specification file (Inside the assets folder).
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonTransitiveRClass=true
android.useAndroidX=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
activityKtx = "1.8.0"
androidGradlePlugin = "8.1.3" # Check with detekt table first: https://detekt.dev/docs/introduction/compatibility/
androidGradlePlugin = "8.2.2" # Check with detekt table first: https://detekt.dev/docs/introduction/compatibility/
datastore = "1.0.0"
constraintlayoutCompose = "1.0.1"
datastorePreferences = "1.0.0"
Expand Down
23 changes: 23 additions & 0 deletions kuksa-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,26 @@ protobuf {
}
}
}

// Tasks for included composite builds need to be called separately. For convenience sake we depend on the most used
// tasks. Every task execution of the main project will then be forwarded to the included build project.
//
// We have to manually define the task names because the task() method of the included build throws an error for any
// unknown task.
val dependentCompositeTasks = setOf(
"setSnapshotVersion",
"setReleaseVersion",
"publishToMavenLocal",
"publishAllPublicationsToOSSRHSnapshotRepository",
"publishAllPublicationsToOSSRHReleaseRepository",
)
tasks
.filter { dependentCompositeTasks.contains(it.name) }
.forEach { task ->
val compositeTask = gradle.includedBuilds.map { compositeBuild ->
val compositeTaskPath = task.path.substringAfter(":kuksa-sdk")
compositeBuild.task(compositeTaskPath)
}

task.dependsOn(compositeTask)
}
14 changes: 14 additions & 0 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.google.devtools.ksp.gradle.KspTask
import org.eclipse.kuksa.vssprocessor.plugin.ProvideVssDefinitionTask

/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
Expand All @@ -20,6 +23,7 @@
plugins {
id("com.android.application")
id("com.google.devtools.ksp")
id("org.eclipse.kuksa.vss-processor-plugin")
kotlin("android")
}

Expand Down Expand Up @@ -54,6 +58,16 @@ android {
}
}

tasks.register<ProvideVssDefinitionTask>("ProvideVssDefinition") {
val vssDefinitionFilePath = "$projectDir/src/main/assets/vss_rel_4.0.yaml"
val regularFile = RegularFile { File(vssDefinitionFilePath) }
vssDefinitionFile.add(regularFile)
}

tasks.withType<KspTask> {
dependsOn(tasks.withType<ProvideVssDefinitionTask>())
}

dependencies {
implementation(project(":kuksa-sdk")) // org.eclipse.kuksa.kuksa-sdk:<VERSION>
ksp(project(":vss-processor")) // org.eclipse.kuksa.vss-processor:<VERSION>
Expand Down
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/

pluginManagement {
includeBuild("vss-processor-plugin")

repositories {
gradlePluginPortal()
google()
Expand All @@ -26,6 +28,7 @@ pluginManagement {

plugins {
id("com.google.devtools.ksp") version "1.9.0-1.0.11"
id("org.eclipse.kuksa.vss-processor-plugin") version "0.1.3"
kotlin("jvm") version "1.9.0-1.0.11"
kotlin("plugin.serialization") version "1.9.0"
}
Expand All @@ -40,6 +43,8 @@ dependencyResolutionManagement {
}
}

rootProject.name = "kuksa-android-sdk"
wba2hi marked this conversation as resolved.
Show resolved Hide resolved

include(":app")
include(":kuksa-sdk")
include(":samples")
Expand Down
1 change: 0 additions & 1 deletion vss-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

plugins {
kotlin("jvm")
`maven-publish`
publish
alias(libs.plugins.dokka)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,29 @@ package org.eclipse.kuksa.vsscore.annotation

/**
* Add this annotation to any class to trigger the model generation (Kotlin Symbol Processing) for the given
* Vehicle Signal Specification definition file. Only .yaml files are currently supported. The searched root folder
* is the assets folder (example path: app/src/main/assets).
* Vehicle Signal Specification definition file. Only .yaml files are currently supported. Use the
* "VSS Processor Plugin" to provide the Symbol Processor with the necessary definition file(s). Then provide the file
* name via the [vssDefinitionName] parameter (The path can be ignored).
*
* ### Example
* ### Plugin Example
*
* ```
* plugins {
* id("org.eclipse.kuksa.vss-processor-plugin") version "<VERSION>"
* }
*
* tasks.register<ProvideVssDefinitionTask>("ProvideVssDefinition") {
* val vssDefinitionFilePath = "$projectDir/src/main/assets/vss_rel_4.0.yaml"
* val regularFile = RegularFile { File(vssDefinitionFilePath) }
* vssDefinitionFile.add(regularFile)
* }
*
* tasks.withType<KspTask> {
* dependsOn(tasks.withType<ProvideVssDefinitionTask>())
* }
* ```
*
* ### Annotation Example
*
* ```
* @VssDefinition("vss_rel_4.0.yaml")
Expand All @@ -36,10 +55,8 @@ package org.eclipse.kuksa.vsscore.annotation
* then the incremental compiler for KSP needs to be disabled explicitly in the gradle properties.
* ```
* <ksp.incremental=false>
*
* @param vssDefinitionPath the path to the definition file
* ```
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class VssDefinition(val vssDefinitionPath: String)
annotation class VssDefinition(val vssDefinitionName: String)
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions vss-processor-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
51 changes: 51 additions & 0 deletions vss-processor-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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
*
*/

repositories {
gradlePluginPortal()
google()
mavenCentral()
}

plugins {
`kotlin-dsl`
`java-gradle-plugin`
publish
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
version
}

gradlePlugin {
plugins {
create("VssProcessorPlugin") {
id = "org.eclipse.kuksa.vss-processor-plugin"
implementationClass = "org.eclipse.kuksa.vssprocessor.plugin.VssProcessorPlugin"
}
}
}

group = "org.eclipse.kuksa"
version = rootProject.extra["projectVersion"].toString()

dependencies {
implementation(kotlin("stdlib"))
}

configure<Publish_gradle.PublishPluginExtension> {
description = "Vehicle Signal Specification (VSS) Plugin of the KUKSA SDK"
}
Loading
Loading