trevjonez / composer-gradle-plugin

Gradle task type and plugin for interacting with https://github.com/gojuno/composer
Apache License 2.0
54 stars 18 forks source link

Unable to use apk / testApk properties #54

Closed dkostyrev closed 4 years ago

dkostyrev commented 4 years ago

Before to updating on Composer Gradle plugin 0.13 I had the following configuration in my build.gradle file:

composer {
  configs {
    debug {
      apk file("build/outputs/apk/debug/app-debug.apk")
    }
  }
}

Composer Gradle plugin 0.13 has changed apk and testApk properties type to RegularFileProperty. I have updated my configuration following way:

composer {
  configs {
    debug {
      apk project.layout.projectDirectory.file("build/outputs/apk/debug/app-debug.apk")
    }
  }
}

But when I try to execute testDebugComposer task I get the following output:

Could not determine the dependencies of task ':app:testDebugComposer'.
> Cannot convert <SOME_PATH>/build/outputs/apk/debug/app-debug.apk to a task.
  The following types/formats are supported:
    - A String or CharSequence task name or path
    - A Task instance
    - A TaskReference instance
    - A Buildable instance
    - A TaskDependency instance
    - A Provider that represents a task output
    - A Provider instance that returns any of these types
    - A Closure instance that returns any of these types
    - A Callable instance that returns any of these types
    - An Iterable, Collection, Map or array instance that contains any of these types

I believe this happens because of this line where RegularFileProperty is passed to dependsOn function. Same applies for testApk and extraApk properties.

Composer Gradle plugin version: 0.13 Gradle version: 5.6.2

trevjonez commented 4 years ago

give this a try:

apk provider { file("build/outputs/apk/debug/app-debug.apk") }

edit: The api's were converted rely more heavily on the default configuration behavior of gradle as well as try to use all the provider api's so that task configuration stays lazy. Ends up being super important since composer tasks typically happen towards the end of a long chain of tasks and forcing configuration for that chain can be fairly expensive.

dkostyrev commented 4 years ago

I did, unfortunately this does not work:

apk provider { layout.projectDirectory.file("build/outputs/apk/debug/app-debug.apk") }
Cannot convert <SOME_PATH>/build/outputs/apk/debug/app-debug.apk to a task.
  The following types/formats are supported:
    - A String or CharSequence task name or path
    - A Task instance
    - A TaskReference instance
    - A Buildable instance
    - A TaskDependency instance
    - A Provider that represents a task output
    - A Provider instance that returns any of these types
    - A Closure instance that returns any of these types
    - A Callable instance that returns any of these types
    - An Iterable, Collection, Map or array instance that contains any of these types
trevjonez commented 4 years ago

0.13.1 should be available via the plugin portal now. let me know how it goes. hopefully no one was relying on that behavior. not sure anymore why I had it in there initially, smells like auto task wireup via providers wasn't working as expected.

dkostyrev commented 4 years ago

Thanks for your prompt response!

dkostyrev commented 4 years ago

I believe you still need to tag commit with 0.13.1 version.

trevjonez commented 4 years ago

right you are good catch. I better go make more coffee, Monday coming in fast.