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 generated Proguard rules not using valid fully qualified name #626

Merged
merged 7 commits into from
Jun 28, 2024
Merged

Fix generated Proguard rules not using valid fully qualified name #626

merged 7 commits into from
Jun 28, 2024

Conversation

mhelder
Copy link
Contributor

@mhelder mhelder commented Jun 27, 2024

This PR fixes #624.

KotlinPoet's ClassName.toString() does not yield a valid fully qualified path for e.g. nested classes, or when backticks are used in the package name to escape reserved keywords. Instead, ClassName.reflectionName() should be used for that.

☝️ This is the only functional change.

The other changes in this PR are:

  • Fix the existing tests asserting incorrect expected values. These tests started failing as soon as reflectionName() was used. 👌
  • Add a test for Malformed generated Proguard rules for classes with data in package #624. I just cherry picked 3 reserved keywords per category. These could be extended to include more, or reduced to a single keyword. It's currently not optimised at all, as it simply repeats the compile -> validation cycle 3*3 times. (Compiling once would probably be more efficient, but also harder to do assertions on the output)

Thanks to @sav007 for the hint in #415 (comment)

@ZacSweers
Copy link
Owner

You need to run spotless locally - ./gradlew spotlessApply --no-configuration-cache

@mhelder
Copy link
Contributor Author

mhelder commented Jun 28, 2024

Done!

@ZacSweers
Copy link
Owner

Unfortunately looks like there's failing tests

@mhelder
Copy link
Contributor Author

mhelder commented Jun 28, 2024

Ah sorry, my bad, I overlooked one existing test. Have pushed a fix, and this time ran the full test suite to make sure everything passes.

@ZacSweers
Copy link
Owner

Can you push one more (empty) commit to re-trigger CI? Looks like github had an outage when you pushed

@ZacSweers ZacSweers merged commit 7bda2c5 into ZacSweers:main Jun 28, 2024
5 checks passed
@ZacSweers
Copy link
Owner

Thanks!

@mhelder mhelder deleted the issue-624/malformed-proguard-rules branch June 28, 2024 20:33
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.

Malformed generated Proguard rules for classes with data in package
2 participants