Skip projects can't import generated BuildConfig.java file
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
Gradle automatically generates a BuildConfig.java file. It's especially useful for checking if (BuildConfig.DEBUG) { } in Kotlin, because R8/Proguard will automatically eliminate if (false) { } code at compile time. It's a more efficient "is this debug mode?" check than the strategy recommended in the documentation, which checks at runtime whether the application is debuggable. https://skip.tools/docs/faq/#skip_lite_debugflag
Unfortunately, in skip-generated projects, BuildConfig is not available for import for some reason (presumably some confusion around output directories…? I can't figure it out).
To repro:
skip init --transpiled-app --appid=some.app.id app-project AppName
cd app-project/Android
gradle assembleDebug
cat ../.build/Android/app/generated/source/buildConfig/debug/app/name/BuildConfig.java
You'll see a file generated by Gradle like this:
/**
* Automatically generated file. DO NOT MODIFY
*/
package app.name;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "some.app.id";
public static final String BUILD_TYPE = "debug";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "0.0.1";
}
But if you add this to ContentView.swift:
#if SKIP
import app.name.BuildConfig
#endif
The build will fail:
e: file:///private/tmp/tp/app-project/.build/plugins/outputs/app-project/AppName/destination/skipstone/AppName/src/main/kotlin/app/name/ContentView.kt:13:17 Unresolved reference 'BuildConfig'.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce from the issue's commands with skip init --transpiled-app, gradle assembleDebug, and the generated BuildConfig.java path under .build/Android. Compare that generated output with the Kotlin source emitted from ContentView.swift, where import app.name.BuildConfig currently fails. Done means the generated project can resolve and import BuildConfig during its build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, kotlin, swift
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100