-
Notifications
You must be signed in to change notification settings - Fork 8
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
add input type setting to support running analysis with apk files #15
base: master
Are you sure you want to change the base?
Conversation
Hi @0xera, Thank you for your contribution and interest in improving App Sizer! While analyzing APK files directly is an interesting approach, App Sizer is designed to work with Android App Bundles (AAB) for several important reasons:
If you're still interested in APK analysis, you could create a separate Gradle task that depends on |
Hi. Thanks for the great plugin. We understand the basic idea behind AAB analysis, but some other stores don't support it, so it would be more convenient for us to focus on the APK size alone. Additionally, we want to analyze not just the download size, as we have an internal updater within the app that allows us to download only the APK file. I will keep these changes in my fork, and you can close the pull requests if they are not convenient for your plugin |
Hi @0xera, again, thank you for the input and contribution to the tool. It would be nice if we could also cover APK analytics. However, I suggest integrating APK analytics through a dedicated task rather than different input types. We can create a new task (based on AppSizeAnalysisTask) called Task dependency:
(similar to appSizeAnalytics) Usage: ./gradlew apkSizeAnalytics[VariantName] This single command will handle both APK building and analytics execution. |
done |
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.
Happy Lunar New Year - Thank you for your contribution
sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/configuration/InputExtension.kt
Outdated
Show resolved
Hide resolved
private fun registerAppSizeTaskDep( | ||
project: Project, | ||
variant: BaseVariant, | ||
appExtension: AppExtension, | ||
depTask: TaskProvider<out Task> | ||
depTasks: List<TaskProvider<out 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.
We could reduce the task dependencies graph by adding a dummy task that depends on other jar/aar generation tasks. And let the App size analysis & APK analysis tasks depend on that single 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.
I don't know about the improvement before. Could you please explain how it works?
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.
I think that generateArchivesListTask should be run after the assemble task, because it takes a lot of memory to run two tasks in parallel
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.
My idea is something like:
val compileDependenciesTask = project.tasks.register("compileDepe${variant.name}")
aabSizeAnalysisTask.dependsOn(compileDependenciesTask)
apkSizeAnalysisTask.dependsOn(compileDependenciesTask)
Then let compileDependenciesTask depend on the module's compilation tasks.
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.
I think that generateArchivesListTask should be run after the assemble task, because it takes a lot of memory to run two tasks in parallel
Do you face OOM error? Let treat it as a separated issue
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.
yeah. ok, i will create another PR after this one
sizer-gradle-plugin/src/main/kotlin/com/grab/plugin/sizer/configuration/InputExtension.kt
Outdated
Show resolved
Hide resolved
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.
Thank you 🙇
apk { | ||
// APK Generation | ||
aab { | ||
// APK Generation from aab | ||
} |
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.
On the other comment, I mean, let's keep the "apk" extension as well
registerAppSizeTaskDep(project, variant, this, appSizeAnalysisTask) | ||
runCatching { | ||
registerCollectDependenciesTask(project, variant, this) | ||
}.onFailure { |
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.
Should we still crash Gradle to print a full stacktrace?
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.
I don't think the crash is very useful in this case. We have a few variants for which we can't create a task graph, but we also don't want to find them all and try to declare them in the variant filter. So we're better off just ignoring the log message
sample/README.md
Outdated
``` | ||
./gradlew app:apkSizeAnalysisProRelease --no-configure-on-demand | ||
``` | ||
If you need to analyze apk files generated from the aab file according to device specs: |
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.
Let keeps the appSizeAnalysis* as the default. I would propose to have
2. Execute the following command to analyze the apks generated from the aab file according to device specs:
./gradlew app:appSizeAnalysisProRelease --no-configure-on-demand
Or if you need to analyze apk file only, you can execute the following command:
./gradlew app:apkSizeAnalysisProRelease --no-configure-on-demand
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.
Let update the https://github.com/grab/app-sizer/blob/master/docs/plugin.md file as well
No description provided.