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

Add VSS Processor Plugin #71

merged 32 commits into from
Feb 28, 2024

Conversation

Chrylo
Copy link
Contributor

@Chrylo Chrylo commented Jan 31, 2024

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

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]>
app/build.gradle.kts Outdated Show resolved Hide resolved
@wba2hi wba2hi linked an issue Feb 2, 2024 that may be closed by this pull request
Chrylo and others added 4 commits February 2, 2024 14:10
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.
Copy link
Contributor

@wba2hi wba2hi left a 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

Using @InputDirectory and @OutputDirectory for a custom tasks
allows for the usage of incremental builds.
.github/workflows/deploy-snapshot.yaml Outdated Show resolved Hide resolved
gradle.properties Show resolved Hide resolved
gradle.properties Show resolved Hide resolved
samples/build.gradle.kts Outdated Show resolved Hide resolved
settings.gradle.kts Outdated Show resolved Hide resolved
.github/actions/setup-project/action.yaml Outdated Show resolved Hide resolved
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
Copy link
Contributor

@wba2hi wba2hi left a 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/version.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/version.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/version.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/version.gradle.kts Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
docs/QUICKSTART.md Show resolved Hide resolved
vss-core/build.gradle.kts Outdated Show resolved Hide resolved
Copy link
Contributor

@wba2hi wba2hi left a 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!

build.gradle.kts Outdated Show resolved Hide resolved
vss-processor-plugin/build.gradle.kts Outdated Show resolved Hide resolved
vss-processor-plugin/build.gradle.kts Outdated Show resolved Hide resolved
.github/actions/setup-project/action.yaml Outdated Show resolved Hide resolved
@Chrylo
Copy link
Contributor Author

Chrylo commented Feb 15, 2024

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!

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.
@Chrylo
Copy link
Contributor Author

Chrylo commented Feb 21, 2024

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:

./gradlew vss-processor-plugin:test

Note:

  • Debugging into the tests does not work here.
  • Sometimes tests errors are obscured so I recommend opening the test results file.
  • Everything was implemented in kotlin so the recommended "spock" framework was not necessary.

Copy link
Contributor

@wba2hi wba2hi left a 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

.github/actions/setup-project/action.yaml Outdated Show resolved Hide resolved
- Removed print from SemanticVersion because it spams the logs and
can be printed via the "printVersion" task.
Copy link
Contributor

@wba2hi wba2hi left a 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.
@Chrylo
Copy link
Contributor Author

Chrylo commented Feb 26, 2024

./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)

  1. Created an issue for the first problem: Unable to execute task "publishToMavenLocal" if executed with "clean" for composite build #80
  2. Fixed the java.io.FileNotFoundException

Chrylo and others added 2 commits February 27, 2024 09:01
Copy link
Contributor

@wba2hi wba2hi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wba2hi wba2hi merged commit f41d383 into eclipse-kuksa:main Feb 28, 2024
5 checks passed
@wba2hi wba2hi deleted the feature-45 branch February 28, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add VssDefinition plugin for KSP usage
2 participants