Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/androidlib/src/mill/androidlib/AndroidAppModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ trait AndroidAppModule extends AndroidModule { outer =>
)
}

override def androidAaptOptions: T[Seq[String]] = Task {
super.androidAaptOptions().filterNot(_ == "--non-final-ids")
Copy link
Contributor

@vaslabs vaslabs Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have a task androidAaptNonFinalIds instead, so we avoid filtering and append it here

if it's set to true

}

/**
* Regex patterns of files to be excluded from packaging into the APK.
*/
Expand Down
31 changes: 20 additions & 11 deletions libs/androidlib/src/mill/androidlib/AndroidModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,23 @@ trait AndroidModule extends JavaModule { outer =>
* Specifies AAPT options for Android resource compilation.
*/
def androidAaptOptions: T[Seq[String]] = Task {
if (androidIsDebug()) {
Seq(
"--proguard-minimal-keep-rules",
"--debug-mode",
"--auto-add-overlay"
)
} else {
Seq("--auto-add-overlay")
}
val debugOptions = Seq(
"--proguard-minimal-keep-rules",
"--debug-mode"
)

// Add module dependencies' namespaces as extra packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a TODO here to clean up, once we rewire the submodule sources to go to the app module

val extraPackages = moduleDeps.collect {
case p: AndroidModule => Seq("--extra-packages", p.androidNamespace)
}.flatten

Seq(
"--auto-add-overlay",
"--no-version-vectors",
"--no-proguard-location-reference",
"--non-final-ids"
) ++ extraPackages
++ Option.when(androidIsDebug())(debugOptions).toSeq.flatten
}

def androidProviderProguardConfigRules: T[Seq[String]] = Task {
Expand Down Expand Up @@ -498,7 +506,8 @@ trait AndroidModule extends JavaModule { outer =>
// * it will generate R.java for the library even library has no resources declared
// * R.java will have not only resource ID from this library, but from other libraries as well. They should be stripped.
val rClassDir = androidLinkedResources().path / "generatedSources/java"
val mainRClassPath = os.walk(rClassDir)
val javaSources = os.walk(rClassDir).filter(p => os.isFile(p) && p.ext == "java")
val mainRClassPath = javaSources
.find(_.last == "R.java")
.get

Expand All @@ -519,7 +528,7 @@ trait AndroidModule extends JavaModule { outer =>
)
} yield PathRef(libRClassPath)

libClasses :+ PathRef(mainRClassPath)
libClasses ++ javaSources.map(PathRef(_))
}

/**
Expand Down