Open Johennes opened 1 week ago
@Johennes I'm not sure if you want to fix this yourself, or not. If you don't then, no worries, but it will take a week or two for me to get to it. If you do, great! This is what I'd suggest:
Reading the outputDir
from package.json
should be a case of adding a struct to npm.rs
. I think that file has some #[serde(default ="…")]` functions.
You may need to add something to AndroidConfig
and IosConfig
so it's accessible from the templates. The javaPackageName
property is a reasonable template for how all this ties together.
I'm not sure if you need to add something to build.gradle
too but you'll likely want to add to build.kt.gradle
. I haven't looked at the current build.gradle from CRNL, so it may be better just to add some lines, or to completely re-do it.
Looking up a relative path has a utility method on RenderedFile
; here it is used in the templates:
{%- let root = self.project_root() %}
{%- let dir = self.config.project.ios.framework_path(root) %}
{%- let framework = self.relative_to(root, dir) %}
I think you have a good handle on what's going on with the script/test-turbo-modules.sh
.
What do you think?
Thanks for the detailed steps. Let me try and take a stab at this.
I wanted to first set up the bob / rn test matrix we spoke about but was surprised when the issue didn't reproduce there. It turns out that build.kt.gradle
doesn't have this issue as long as you don't change the default paths that crnl puts into package.json
because of this:
When I first generated my project, however, crnl wasn't yet using Kotlin so this check always failed for me:
That in turn meant that ubrn would always generate from the build.gradle
template which expects the generated code in another folder:
Given that as of writing the lowest version of crnl that is not broken[^1] is 0.42.2 and given that this version uses Kotlin rather than Java, maybe we can ditch the build.gradle
template and always use build.kt.gradle
?
[^1]: 0.42.1 is missing @react-native-community/cli
and all lower versions have the unknown option '--npm'
issue.
The
codegenConfig
block now seems to include output dirs for the generated code.UBRN doesn't appear to use these for Android and instead tries to include the generated code from
android/build/generated/source/codegen/java
inandroid/build.gradle
.I tried changing the output dir for Android in
package.json
to comply with the value UBRN expects but this gave me another error. The only thing I found working so far is to manually patchbuild.gradle
.UBRN should read the values from
package.json
and use them accordingly.