Comments (5)
I wonder if you could provide a sample project? The worker API is enabled for this project, but I don't see the issue. Maybe it's related to Room?
from anvil.
You're right. While creating a minimally reproducible project, it looks like using gradle kts scripts is what changes things.
Attached is a project that reproduces the issue. There isn't even any consumption of code, it simply appears that using kts, kapt, and Hephaestus causes the problem.
To see the issue, run ./gradlew assemble
in this project. To see the fix, alternate the comments in settings.gradle
so the groovy based module2 is included instead of the kts based module1 is included.
from anvil.
I can reproduce the issue with your project. But I wasn't able to reproduce it in here. This definitely seems to be a Gradle issue and is maybe caused by the way plugins are applied.
You do this:
plugins {
id("com.squareup.hephaestus").version("1.0.3")
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
I changed it to the following in all three modules and cannot reproduce the bug anymore:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.squareup.hephaestus'
I also tested the plugins syntax and the issue is gone:
plugins {
id("kotlin")
id("kotlin-kapt")
id("com.squareup.hephaestus")
}
Only mixing the two seems to cause issues.
from anvil.
Hmm, that doesn't seem right. The code you're sharing looks like groovy (notice the single quotes).
In the example, the groovy modules aren't a problem, it's the kts build file that introduces the problem. (comment that out in settings.gradle and the problem goes away.)
Here's a new repro project with the updates you propose (changing all modules to use new plugin syntax) and the problem persists as long as you include the kts based module in the build.
from anvil.
Sharing zips isn't fun. This for some reason fixes the issue: https://github.com/vRallev/issue-33/commit/1befe3702c3b248c0f1344c5b699c3623cf10282
That's an interesting issue. I bet in my workaround Gradle doesn't change the classloader and the isAssignableFrom
check you mentioned earlier is successful.
from anvil.
Related Issues (20)
- Generated files contain errors HOT 2
- Add ability to generate a ContributesBinding baseline? HOT 3
- AssistedFactory generation (still) fails under IC
- Stub gen FileNotFoundException with new file tracking enabled
- Compiling annotation that does not exist throws `NoSuchElementException` HOT 2
- Strange behavior: @Binds methods' parameter type must be assignable to the return type. HOT 1
- Binding module validation should check type parameters when determining if a bound type is valid HOT 1
- New incremental compilation fails when deleting a contributed subcomponent HOT 2
- Support Dagger 2.51's new `@LazyClassLoading`
- Support Jakarta annotations
- Support setter/method injection in factory gen
- Migrate interface merging in IR
- Explore merging `ModuleMergerIr` and `InterfaceMergerIr`
- Enable K2 support in AnvilCompilerRegistrar
- Generated anvil code `OPT_IN_USAGE_ERROR` suppression causes warnings in K2 HOT 2
- K2: hints aren't discoverable in K2 IR HOT 1
- Compilation fails with multibindings across separate modules HOT 3
- KSP mode leaks kotlin-compiler-embeddable into javac classpath somehow HOT 1
- @ContributesMultibinding codegen missing imports for synthesized annotation constants HOT 3
- Adopt new KSP moduleName API or better handle in KSP2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anvil.