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

META-INF files generated by KSP processor are missing from output #991

Open
oliviernotteghem opened this issue Jul 21, 2023 · 4 comments
Open

Comments

@oliviernotteghem
Copy link
Contributor

oliviernotteghem commented Jul 21, 2023

Issue was found when trying to integrate with auto-service-ksp library. In this case, KSP processor is invoked but META-INF service file is missing from out jar artifact.

REPRO:

  1. Clone this branch : master...oliviernotteghem:rules_kotlin:inner
  2. Change dir to: examples/ksp
  3. Run command: bazel build coffee_lib && tar -tf bazel-bin/coffee_lib.jar

EXPECTED:
There should be a file under META-INF/services/.

ACTUAL:
File is missing.

Notes:
KSP processor is invoked, since, for example, specifying a bogus value for AutoService() param (in CoffeAppService.java) causes a crash in KSP auto-value processor. Also, the following is observed in logs:

info: [ksp] loaded provider(s): [com.squareup.moshi.kotlin.codegen.ksp.JsonClassSymbolProcessorProvider, dev.zacsweers.autoservice.ksp.AutoServiceSymbolProcessor$Provider]

@zalewskise
Copy link
Contributor

Hi!

Another files that are missing are for example proguard rules from moshi.

Can be reproduce on current master:

  1. Change dir to: examples/ksp
  2. Run command: bazel build coffee_lib && tar -tf bazel-bin/coffee_lib.jar

Expected:
There should be META-INF/proguard/moshi-coffee.CoffeeAppModel.pro file, with content:

-if class coffee.CoffeeAppModel
-keepnames class coffee.CoffeeAppModel
-if class coffee.CoffeeAppModel
-keep class coffee.CoffeeAppModelJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

Actual:
File is missing

@jbarr21
Copy link
Contributor

jbarr21 commented Jul 31, 2023

The META-INF/<LIBRARY_PACKAGE>.version files are stripped in Bazel vs APKs built by Gradle. Android Studio's Layout Inspector tool uses these files to be able to know which version of the AndroidX libraries is present in the APK. They are present in both debug & release versions of the built APK.

Screenshot 2023-07-31 at 10 51 15 AM

@jvgelder
Copy link

i think I am facing a similar issue here: komapper/komapper#1105 (comment)

@restingbull
Copy link
Collaborator

#997 looking to fix this.

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 a pull request may close this issue.

5 participants