Comments (8)
I don't develop on Android, So I need some feedback from upstream bazel devs who maintain the android rules for the best way integrate with the android.
My advice would be to use kt_jvm_library to compile your Kotlin srcs and then feed those into Android or Java rules for the time being.
from rules_kotlin.
The aar_import rule provides a JavaInfo provider:
https://github.com/bazelbuild/bazel/blob/3a7b8bc2abeaf8b8647c037bed1dd5fd73b8392b/src/main/java/com/google/devtools/build/lib/rules/android/AarImport.java#L199
which is the same thing that java_import does:
https://github.com/bazelbuild/bazel/blob/3a7b8bc2abeaf8b8647c037bed1dd5fd73b8392b/src/main/java/com/google/devtools/build/lib/rules/java/JavaImport.java#L177
Does having a java_import in the deps of a kt_jvm_library work? E.g, if you extend just Activity, which would come from the android.jar through the java_import, does that work?
from rules_kotlin.
@hsyed that's my plan.
@ahumesky it does works.
I've solved my problem. It was that @appcompat_v7//aar doesn't include its transitive dependencies. I.e. support-fragment and support-core-ui.
from rules_kotlin.
Glad you were able to find a solution. Transitive dependency management is something that we're working to improve. In the meantime, depending on your needs, there are temporary workaround like https://github.com/aj-michael/gmaven_rules which set up the transitive dependencies for you.
from rules_kotlin.
@ahumesky I was using that. I guess it's not working because the transitive dependencies are declared on deps
attribute when it should be on exports
.
from rules_kotlin.
Which version of bazel are you using? I believe that this was fixed with bazelbuild/bazel#4472
from rules_kotlin.
Build label: 0.11.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue May 14 07:48:23 +50148 (1520362424903)
Build timestamp: 1520362424903
Build timestamp as int: 1520362424903
Repro https://github.com/kafji/bazel48
from rules_kotlin.
Thanks for the repro, looks like there's still something going on with deps vs exports.
from rules_kotlin.
Related Issues (20)
- KotlinKapt fails on Java 21 with java.lang.IllegalAccessError
- [Feature Request] Allow exporting KSP plugins
- Release notes for v1.9.0 contain incorrect url for http_archive HOT 4
- WorkerEnvironmentTest is failing with Bazel@HEAD HOT 1
- `Exception in thread "main" java.lang.NoClassDefFoundError: dagger/internal/Preconditions` with JDK 20 and 21
- Support generating Java code with KSP HOT 1
- bzlmod: Document how to specify toolchain parameters such as kt_kotlinc_options
- Expose lower-level Kotlin JVM compilation defs for aspects HOT 1
- Error turbine_direct_graal failed while executing Turbine command HOT 3
- kt_jvm_test does not include native library paths in java.library.path HOT 2
- WorkerEnvironmentTest is failing at Bazel@HEAD HOT 2
- Error when using AutoBazelRepository annotation processor HOT 1
- Dependency .jar not found for kt_js_library with v1.9.0, but works fine with previous version (v1.8.1)
- kotlin compiler and ksp repositories fail to initialize on windows HOT 4
- WorkerEnvironmentTest is failing with Bazel@HEAD HOT 1
- kt_jvm_test is incompatible with Java >= 18 HOT 1
- Generated types not visible to IntelliJ HOT 2
- [Feature Request] apoption support for KSP plugins HOT 4
- Bzlmod: kotlin compiler is unconditionally downloaded HOT 4
- Does KSP require a separate runner? HOT 2
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 rules_kotlin.