Vlastimil Brecka
08/06/2024, 10:22 PMtasks.named("appDistributionUpload${variant.name.capitalize()}").configure {
artifactPath = output.outputFile.absolutePath
serviceCredentialsFile = project.file("...").absolutePath
groups = ...
}
this works for modifying the already registered tasks by plugin, but for my setup, I need to register such tasks myself because plugin doesn't generate all it's supposed to (apk splits)
so googling gets me this
tasks.register("appDistributionUpload${abiName.capitalize()}${variant.name.capitalize()}", com.google.firebase.appdistribution.gradle.UploadDistributionTask) {
artifactPath = output.outputFile.absolutePath
serviceCredentialsFile = project.file("...").absolutePath
releaseNotes = abi
}
but gradle complains about
A problem occurred evaluating project ':app'.
> Could not get unknown property 'com' for project ':app' of type org.gradle.api.Project.
so I presume the com.google.firebase.appdistribution.gradle.UploadDistributionTask doesnt exist
is there a way to know the correct fully qualified name of the task if I know its name?
printing this in the .configure { .. } just gives me nonsense 😕Vampire
08/06/2024, 10:27 PMgw help --task myTaskName shows information about the task, its supported CLI arguments and also its type.Vlastimil Brecka
08/06/2024, 10:34 PMVampire
08/06/2024, 10:36 PMVampire
08/06/2024, 10:36 PMVampire
08/06/2024, 10:37 PMjava.util.Properties and so on where then the property util was searched in the java extension instead of considering it as FQCNVampire
08/06/2024, 10:38 PMVlastimil Brecka
08/06/2024, 10:40 PMVlastimil Brecka
08/06/2024, 10:42 PMhelp --task name I pulled it out like this
tasks.register("printTaskClass") {
doLast {
def taskName = "appDistributionUploadTstingRelease" // Replace with the actual task name
def task = tasks.named(taskName).get()
if (task != null) {
println "The class of the task '${taskName}' is ${task.getClass().getName()}"
} else {
println "Task '${taskName}' not found."
}
}
}
and that gave me com.google.firebase.appdistribution.gradle.tasks.UploadDistributionTask_Decorated
and your task gave me com.google.firebase.appdistribution.gradle.tasks.UploadDistributionTask
any idea why the difference? i.e. what's _Decorated?Vampire
08/06/2024, 10:44 PMI see.. I'm not a huge fan of kotlin in gradle, it's slower from what I recall & only really helpful once in a blue moon debugging session like thisYeeeah, ..., no. In some situations Groovy is faster, in some situations Kotlin is faster. But the advantages of Kotlin DSL almost always outweigh it majorly. By now it is the default DSL, you immediately get typesafe build scripts, actually helpful error message if you mess up the syntax, and amazingly better IDE support when using a good IDE like IntelliJ IDEA or Android Studio. But hey, to each his tool and sacrifice. 🙂
Vampire
08/06/2024, 10:44 PMany idea why the difference?Of course. 🙂 Because it is decorated. 😛
Vampire
08/06/2024, 10:46 PMExtensionAware and thus can get extensions added, whether they declare it or not, you can always cast them, due to that I tend to always also formally make extensions and so on ExtensionAware.
Or all the Gradle magic is doing for you like implementing the abstract getters and properties, injecting services and so on.Vlastimil Brecka
08/06/2024, 10:46 PMVampire
08/06/2024, 10:46 PM_Decorated suffixVampire
08/06/2024, 10:47 PMVampire
08/06/2024, 10:47 PMVlastimil Brecka
08/06/2024, 10:47 PMVampire
08/06/2024, 10:48 PMVampire
08/06/2024, 10:48 PMVampire
08/06/2024, 10:49 PM_Decorated, that's just an internal detail, just forget about itVlastimil Brecka
08/06/2024, 10:49 PMVlastimil Brecka
08/06/2024, 10:49 PMtasks.register("appDistributionUpload${abiName.capitalize()}${variant.name.capitalize()}", com.google.firebase.appdistribution.gradle.tasks.UploadDistributionTask) {Vampire
08/06/2024, 10:49 PMVampire
08/06/2024, 10:49 PMVampire
08/06/2024, 10:50 PMclass Foo extends UploadDistributionTask {} is subclassingVampire
08/06/2024, 10:51 PMtasks.register just schedules an instance of type UploadDistributionTask (actually UploadDistributionTask_Decorated) and configuration for it to be created as soon as necessary.Vlastimil Brecka
08/06/2024, 10:51 PMVampire
08/06/2024, 10:52 PM..._Decorated anyway, it it just a runtime decoration of the original class to do the Gradle magic.Vlastimil Brecka
08/06/2024, 10:52 PMfirebaseAppDistribution {
serviceCredentialsFile = file("...") <--------
}
yet when I register
tasks.register("appDistributionUpload${abiName.capitalize()}${variant.name.capitalize()}", com.google.firebase.appdistribution.gradle.tasks.UploadDistributionTask) {
serviceCredentialsFile = project.file("....").absolutePath
it forces me to add the .absolutePath to make it work?Vlastimil Brecka
08/06/2024, 10:52 PMVampire
08/06/2024, 10:53 PMVlastimil Brecka
08/06/2024, 10:55 PMVampire
08/06/2024, 10:56 PMVlastimil Brecka
08/06/2024, 10:56 PMVampire
08/06/2024, 11:02 PMUploadDistributionTaskConfigurator.configure with the task and extension as arguments and that method does call task.serviceCredentialsFile.set(nullOrAbsolutePath(extension.serviceCredentialsFile, project)), so, ...Vampire
08/06/2024, 11:03 PMVlastimil Brecka
08/06/2024, 11:06 PMVlastimil Brecka
08/06/2024, 11:07 PMVampire
08/06/2024, 11:08 PMVlastimil Brecka
08/06/2024, 11:08 PMVlastimil Brecka
08/06/2024, 11:10 PMVampire
08/06/2024, 11:11 PMVampire
08/06/2024, 11:13 PMVampire
08/06/2024, 11:13 PMid("com.google.firebase.appdistribution") version "4.2.0" apply false to my play project, synced, and then navigated to the plugin extension and taskVlastimil Brecka
08/06/2024, 11:15 PMVlastimil Brecka
08/06/2024, 11:24 PMVampire
08/06/2024, 11:25 PMVlastimil Brecka
08/06/2024, 11:26 PMVampire
08/06/2024, 11:27 PMVlastimil Brecka
08/06/2024, 11:28 PM./gradlew .. pressing debug executes my current IDE run config..no?Vampire
08/06/2024, 11:33 PM-Dorg.gradle.debug=true and then attach the debugger to 5005