-
-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android/r8 optimization #4743
base: main
Are you sure you want to change the base?
Android/r8 optimization #4743
Conversation
Hi! I'm I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:
|
This is WIP |
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need a proguardTest-rules.pro to be used to build instrumented tests
these are the typical contents when creating a project in android studio
# Proguard rules that are applied to your test apk/code.
-ignorewarnings
-dontoptimize
-keepattributes *Annotation*
-keep class androidx.test.espresso.**
# keep the class and specified members from being removed or renamed
-keep class androidx.test.espresso.IdlingRegistry { *; }
-keep class androidx.test.espresso.IdlingResource { *; }
-dontnote junit.framework.**
-dontnote junit.runner.**
-dontwarn androidx.test.**
-dontwarn org.junit.**
-dontwarn org.hamcrest.**
-dontwarn com.squareup.javawriter.JavaWriter
but get the same ones as in your reference project you created
|
||
import scala.xml.XML | ||
|
||
trait AndroidModule extends JavaModule { | ||
|
||
this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be here by accident
appLinkArgsBuilder += "--proguard-minimal-keep-rules" | ||
} | ||
appLinkArgsBuilder += "--proguard-minimal-keep-" + | ||
"rules" | ||
if (androidIsDebug()) { | ||
appLinkArgsBuilder += "--debug-mode" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, we should separate these with androidDebugInstall (androidDebugDex, etc) and androidReleaseInstall and have the common arguments in a shared method, so we can eliminate these if statements
@@ -706,4 +708,248 @@ trait AndroidModule extends JavaModule { | |||
PathRef(signedApk) | |||
} | |||
|
|||
/** Whether we are building an application (APK) or a library (AAR) */ | |||
def isApplication: T[Boolean] = Task { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this? we have AndroidModule and AndroidAppModule which should separate the two
) | ||
} | ||
|
||
/** Toggle desugaring in R8 (usually true for full R8 mode when minSdk < 24) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a link to documentation you can put here as a reference?
None | ||
} | ||
|
||
def mainDexListOutput: T[Option[PathRef]] = T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably not needed, try to refactor with a case class in runR8 task
val multiDexArgs = | ||
mainDexRules().toSeq.flatMap(r => Seq("--main-dex-rules", r.path.toString)) ++ | ||
mainDexList().toSeq.flatMap(l => Seq("--main-dex-list", l.path.toString)) ++ | ||
mainDexListOutput().toSeq.flatMap(l => Seq("--main-dex-list-output", l.path.toString)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the https://github.com/com-lihaoyi/mill/pull/4743/files#r2007060988 , you can decide the name of the output here and return it as part of a R8Output case class (needs a better name)
No description provided.