-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
The plugin is a composite project which means a higher separation to the other modules and common buildSrc plugins can't be used here. So plugins like publish / version had to be copied. The publish script had to be adapted for publishing a plugin close eclipse-kuksa#45 Signed-Off-By: Mark Hüsers <[email protected]>
vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt
Outdated
Show resolved
Hide resolved
The plugin is now taking care of finding compatible VSS files or using the config provided by the developer. Afterwards it executes the custom task to copy the VSS files to the ksp input folder.
Update the documentation for plugin interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short functional test:
- ./gradlew clean kspDebugKotlin works -> OK
- ./gradlew clean test -> -NOK- OK with latest version
vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt
Outdated
Show resolved
Hide resolved
vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/buildSrc/src/main/kotlin/version.gradle.kts
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
Using @InputDirectory and @OutputDirectory for a custom tasks allows for the usage of incremental builds.
The storing inside the extra properties was removed in favour of just reading the version file.
Needed for compatibility with the config cache.
# Conflicts: # gradle/libs.versions.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional Test:
./gradlew clean build -Dkotest.tags="\!Secure"
reliably fails with different errors:
also it does not fail when running with --no-configuration-cache.
ERROR 1
Execution failed for task ':app:clean'.
java.io.IOException: Unable to delete directory '/Users/wba2hi/git/kuksa-android-sdk/app/build'
New files were found. This might happen because a process is still writing to the target directory.
- /Users/wba2hi/git/kuksa-android-sdk/app/build/kspInput
- /Users/wba2hi/git/kuksa-android-sdk/app/build/kspInput/vss_rel_4.0.yaml
ERROR 2
e: [ksp] No VSS definition files were found! Is the plugin correctly configured?
e: Error occurred in KSP, check log for detail
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:kspDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details
- Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.
buildSrc/src/main/kotlin/org/eclipse/kuksa/version/SemanticVersion.kt
Outdated
Show resolved
Hide resolved
vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
- Improves error handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scenario: Add a VSS Property to VSS Spec file
-> ./gradlew clean build
-> OK: Property is correctly generated
-> ./gradlew build
-> NOK: Property is not correctly generated because task is up-to-date. That's probably the best we can do for now, because there is no clear dependency between our Specification and the ksp*Kotlin task. Could be solved when the files are generated inside the Plugin?
Scenario: Changing Version
-> ./gradlew setSnapshotVersion
-> OK
-> ./gradlew setReleaseVersion
-> OK
Scenario: vssProcessor.searchPath does not exist
-> Android Studio Gradle Synch -> OK
-> ./gradlew clean build
-> OK
-> minor improvements with the message to be done, see corresponding finding
Scenario: Create Dash Report
-> ./gradlew clean mergeDashFiles
-> OK
=> Function-wise OK!
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
For the NOK I also think this can only properly solved when we move the generation code aways from KSP. Known issue for now. |
BREAKING CHANGE: - A new Gradle plugin(VssProcessorPlugin) was introduced to improve the input (VSS files) handling of the VSS KSP generation. This plugin is now mandatory if the VssProcessor KSP module is used in the project.
- Added a filter for the composite build so if more composite builds were available it does not automatically link against them too.
I tried to decouple the gradle kts generation from the tests so new tests can just reuse the generator classes.
Added tests for the vss processor plugin. Used the following guide: https://docs.gradle.org/current/userguide/test_kit.html#sub:test-kit-build-cache Use the following command to test or execute the Android Studio run config:
Note:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional Test looks good
buildSrc/src/main/kotlin/org/eclipse/kuksa/version/SemanticVersion.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
...essor-plugin/src/test/kotlin/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPluginTest.kt
Show resolved
Hide resolved
...essor-plugin/src/test/kotlin/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPluginTest.kt
Show resolved
Hide resolved
- Removed print from SemanticVersion because it spams the logs and can be printed via the "printVersion" task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./gradlew clean publishToMavenLocal
-> NOK (Unable to make progress running work. There are items queued for execution but none of them can be started)
./gradlew :vss-processor-plugin:clean :vss-processor-plugin:publishToMavenLocal
-> NOK (Execution failed for task ':vss-processor-plugin:generateMetadataFileForPluginMavenPublication'.
java.io.FileNotFoundException: /Users/wba2hi/git/kuksa-android-sdk/vss-processor-plugin/build/libs/vss-processor-plugin-0.1.3-SNAPSHOT.jar (No such file or directory))
> cd vss-processor-plugin
> gradle wrapper # add gradle wrapper; requires gradle being installed
> ./gradlew wrapper --gradle-version=8.6 # use same version as in sdk rootProject
> ./gradlew clean publishToMavenLocal
-> OK
The composite linking of clean seems to break something? Maybe the composite links are not adequately "planned into the dependency graph"?
Without clean
everything works fine. In this particular case I would be ok with not executing clean, but the minimum I expect is a follow-up ticket.
Also it mean that if more of these issues appear we have to remove the composite links again and handle the project as a "real and independent rootProject" (which I also would be fine with, because I don't expect many changes in this project over time)
The "generateMetadataFileForPluginMavenPublication" task is currently not using the configuration cache correctly. The cache was disabled for this task until it is fixed.
|
There is currently a limitation with "clean" + composite builds. gradle/gradle#23585
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Added a new composite module which provides the new vss-processor-plugin. It is mainly independent of the whole project. It has its own settings.gradle (not needed yet / default is used) etc. Which means some gradle configurations will be redundant.
Documentation:
Gradle Plugins: https://docs.gradle.org/current/userguide/custom_plugins.html
Disable signing for publishToMavenLocal: https://docs.gradle.org/current/userguide/signing_plugin.html
Task dependencies with composite builds: https://docs.gradle.org/current/userguide/composite_builds.html
Test:
Deploy: https://github.com/eclipse-kuksa/kuksa-android-sdk/actions/runs/7726264784
See documentation for how to test it with mavenLocal + Companion app. Same setup as with the SDK TestApp.
The following should now work and the workaround inside the KSP module was removed.
./gradlew clean kspDebugKotlin
close #45