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 9 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
4 changes: 2 additions & 2 deletions .github/actions/setup-project/action.yaml
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: Setups the gradle and java environment
runs:
using: "composite"
steps:
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ concurrency: snapshot
on:
push:
branches:
- main
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
- feature-45-work

jobs:
deployment:
if: github.repository == 'eclipse-kuksa/kuksa-android-sdk'
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
12 changes: 10 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,14 @@ import org.eclipse.kuksa.property.PropertiesLoader
*
*/

@file:Suppress("UnstableApiUsage")

import org.eclipse.kuksa.property.PropertiesLoader

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 +124,11 @@ android {
}
}

vssProcessor {
searchPath = "$projectDir/src/main/assets"
fileName = "vss_rel_4.0.yaml"
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()

Expand Down
29 changes: 29 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,32 @@ tasks.register("mergeDashFiles") {
}
}
}

// 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",
"publishAllPublicationsToOSSRHReleaseRepository",
)

gradle.projectsEvaluated {
val subProjectTasks = tasks + subprojects.flatMap { it.tasks }

subProjectTasks
.filter { dependentCompositeTasks.contains(it.name) }
.forEach { task ->
val compositeTask = gradle.includedBuilds.map { compositeBuild ->
val compositeTaskPath = task.path.substringAfterLast(":")
println("Linking composite task - ${compositeBuild.name} <-> ${task.project}:${task.name}")

compositeBuild.task(":$compositeTaskPath")
}

task.dependsOn(compositeTask)
}
}
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
})
}
}
18 changes: 15 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,21 @@ 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>")
}

// Optional - See plugin documentation. Files inside the main assets are used automatically.
vssProcessor {
searchPath = "$projectDir/src/main/assets"
fileName = "vss_rel_4.0.yaml"
}
```

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
3 changes: 2 additions & 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 Expand Up @@ -71,3 +71,4 @@ grpc-protoc-java-gen = { group = "io.grpc", name = "protoc-gen-grpc-java", versi

[plugins]
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin" }
pluginPublishing = { id = "com.gradle.plugin-publish", version = "1.2.1" }
2 changes: 1 addition & 1 deletion kuksa-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
testImplementation(libs.mockk)
}

configure<Publish_gradle.PublishPluginExtension> {
publish {
mavenPublicationName = "release"
componentName = "release"
description = "Android Connectivity Library for the KUKSA Databroker"
Expand Down
6 changes: 6 additions & 0 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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 +55,11 @@ android {
}
}

vssProcessor {
searchPath = "$projectDir/src/main/assets"
fileName = "vss_rel_4.0.yaml"
}

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") // Always take the newest version since it's locally included
Chrylo marked this conversation as resolved.
Show resolved Hide resolved
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
3 changes: 1 addition & 2 deletions 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 Expand Up @@ -49,7 +48,7 @@ tasks.withType<Test>().configureEach {
}
}

configure<Publish_gradle.PublishPluginExtension> {
publish {
mavenPublicationName = "release"
componentName = "java"
description = "Vehicle Signal Specification (VSS) Core Module of the KUKSA SDK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@ 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>"
* }
*
* // Optional - See plugin documentation. Files inside the main assets are used automatically.
* vssProcessor {
* searchPath = "$projectDir/src/main/assets"
wba2hi marked this conversation as resolved.
Show resolved Hide resolved
* fileName = "vss_rel_4.0.yaml"
* }
* ```
*
* ### Annotation Example
*
* ```
* @VssDefinition("vss_rel_4.0.yaml")
Expand All @@ -36,10 +51,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
Loading
Loading