Skip to content
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

Do not rely on replacing GENERATED_RES to hook up the plugin #383

Merged
merged 5 commits into from
Nov 16, 2022

Conversation

mateuszkwiecinski
Copy link
Member

Prefer using addGeneratedSourceDirectory API instead

See #382 and https://issuetracker.google.com/issues/237421684 for more details

@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #383 (b29ed90) into master (6b46402) will decrease coverage by 1.53%.
The diff coverage is 33.33%.

@@             Coverage Diff              @@
##             master     #383      +/-   ##
============================================
- Coverage     81.08%   79.54%   -1.54%     
  Complexity      109      109              
============================================
  Files            16       16              
  Lines           608      621      +13     
  Branches         93       98       +5     
============================================
+ Hits            493      494       +1     
- Misses           45       53       +8     
- Partials         70       74       +4     
Impacted Files Coverage Δ
...om/project/starter/easylauncher/plugin/AgpUtils.kt 50.00% <0.00%> (-3.85%) ⬇️
...lin/com/project/starter/easylauncher/plugin/log.kt 50.00% <0.00%> (ø)
.../starter/easylauncher/plugin/EasyLauncherPlugin.kt 72.94% <36.84%> (-10.63%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@brudaswen brudaswen left a comment

Choose a reason for hiding this comment

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

Looks good. 🦫 Will test tomorrow. But some first comments:

.wiredWith(EasyLauncherTask::outputDir)
.toCreate(InternalArtifactType.GENERATED_RES)
val apgVersion = androidComponents.pluginVersion
if (apgVersion >= AndroidPluginVersion(7, 4).beta(1)) { // https://issuetracker.google.com/issues/237303854
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the Google issue: it might require beta02?

It should be available in beta02.

Suggested change
if (apgVersion >= AndroidPluginVersion(7, 4).beta(1)) { // https://issuetracker.google.com/issues/237303854
if (apgVersion >= AndroidPluginVersion(7, 4).beta(2)) { // https://issuetracker.google.com/issues/237303854

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, right! The res property was added in beta01 (source), but it seems to be working properly starting from beta02 (source) 🤷

tasks.named("generate${capitalisedVariantName}Resources") { it.dependsOn(task) }
}
} else {
// has side-effects, but "works". @see: https://github.com/usefulness/easylauncher-gradle-plugin/issues/382
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe print a warning as well?

Suggested change
// has side-effects, but "works". @see: https://github.com/usefulness/easylauncher-gradle-plugin/issues/382
// has side-effects, but "works". @see: https://github.com/usefulness/easylauncher-gradle-plugin/issues/382
println("WARNING: EasyLauncher generation might cause issues with Gradle resValues in AGP 7.3.")
println("See: https://github.com/usefulness/easylauncher-gradle-plugin/issues/382")

Copy link
Member Author

@mateuszkwiecinski mateuszkwiecinski Nov 16, 2022

Choose a reason for hiding this comment

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

I'll consider adding the log later. This block of code is called on each variant, and we'd spam the console with duplicated messages. Most probably it'll have to happen once, when plugin gets applied? or a task is invoked? It also would be nice to have an ability to disable the log message. I'll see if I manage to add this in a day or two and if not then I'll make a release with what's on the branch currently, relying on the fact people will have to read release notes 🤞

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good!

sample/example-vector/build.gradle Outdated Show resolved Hide resolved
@brudaswen
Copy link
Contributor

Just tested with 7.4. Looks good. Great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants