-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
The values were already there. It makes sense for Extension to do it
@@ -109,7 +109,7 @@ android { | |||
} | |||
} | |||
|
|||
task listDevices << { |
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 also updated because Gradle had a warning saying that the leftShift
operator on Tasks API is deprecated.
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.
👍
@@ -13,7 +13,7 @@ public class AndroidCommandPlugin implements Plugin<Project> { | |||
throw new StopExecutionException("The 'android' plugin is required.") | |||
} | |||
|
|||
def extension = project.android.extensions.create("command", AndroidCommandPluginExtension, project) | |||
AndroidCommandPluginExtension extension = project.android.extensions.create("command", AndroidCommandPluginExtension, project) |
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's use single quotes while we're at it here.
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.
Sure ddb3a80
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.
👍
@@ -109,7 +109,7 @@ android { | |||
} | |||
} | |||
|
|||
task listDevices << { |
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.
👍
|
||
project.tasks.withType(AdbTask) { task -> | ||
extension.attachDefaults(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.
Would that be the same here?
project.tasks.withType(AdbTask).all(extension.&attachDefaults)
Not sure it's better though.
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 was thinking if it's possible to do it in 1 line, but I didn't figure it out when I was writing it. I think 3 lines is clear tho. What do you think?
I don't think we need to emphasize |
@devisnik I thought about it a lot. I went back and forth. I agree with you. I think it is not really mandatory. |
Problem
In a previous PR #107, we decoupled the extension from the tasks.
But to keep backward compatible, we kept accessing the extension from the tasks as last resort, and we have a big warning if such case occurs.
Then, we forgot to update our own systemAnimation tasks. Since it uses 6 adb command, this 4 line warning was printed 6 times on each run.
Solution
This PR is fixing that by attaching adb and other fields to all AdbTask tasks by finding them later in the plugin. Using this method
project.tasks.withType(AdbTask)
.Note: this new
attachDefaults(AdbTask)
method can also be used by the users to prevent this warning now. Should we update the sample's and README with this info?