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

fix: VSS Specification Generation fails for specific Folder Structure #67

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

wba2hi
Copy link
Contributor

@wba2hi wba2hi commented Jan 18, 2024

Closes: #66

@wba2hi
Copy link
Contributor Author

wba2hi commented Jan 18, 2024

Unfortunately I had to fallback to the minimum viable solution. I debugged into the ksp generation and at a few different places the "projectPath" is visible. However, none of them are freely accessable.
e.g.

  • codeGenerator.projectBase
  • resolver.options.projectBaseDir

We could solve it by using reflections to access these properties, but I don't think we should do that.


private val fileSeparator = File.separator
private val assetsDir = "intermediates" + fileSeparator + "assets" + fileSeparator
private val buildDir = fileSeparator + "build" + fileSeparator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are now using "replaceAfterLast" we just moved the problem. The solution might still fail when the folder structure looks like:

$projectDir/build/.../build/.../file.kt

This might happen when somebody introduces a buildType named "build" without any other flavors -> "/home/vagrant/build/org.eclipse.kuksa.companion/app/build/generated/ksp/fDroid/kotlin/org/eclipse/kuksa/vss/MainActivityProcessor.kt

I added the starting fileSeparator to be a bit more robust and reduce the number of fase-positives in case some other string is appended

private const val ASSETS_BUILD_DIRECTORY = "intermediates/assets/"
private const val BUILD_FOLDER_NAME = "build/"

private val fileSeparator = File.separator
Copy link
Contributor Author

@wba2hi wba2hi Jan 18, 2024

Choose a reason for hiding this comment

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

Due to how we resolve the buildFolder the approach was not working on windows before due to the difference in fileSeparators ("/" vs "\"). I changed it, however did not test it. So we should probably test if VssSpec generation also works on Windows devices!

FIrst I thought this would only be an issue for windows runners, but in fact it's an issue for each and every windows user of our lib - so we need to test and fix this ;)

Copy link
Contributor

@lukasmittag lukasmittag left a comment

Choose a reason for hiding this comment

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

Works for me on Linux.

What I did:

  • move kuksa-android-sdkunder home/user/build/
  • ./gradlew clean assemble
  • ran unit test config -> succeeded
  • ran app -> set/get possible

@SebastianSchildt SebastianSchildt merged commit 74687b3 into eclipse-kuksa:main Jan 22, 2024
5 checks passed
@wba2hi wba2hi mentioned this pull request Jan 31, 2024
@erikbosch erikbosch deleted the fix-66 branch October 31, 2024 13:16
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.

VSS Specification Generation fails for specific folder structure
3 participants