oliviergauthier / gradle-appcenter-plugin

This gradle plugin allow you to upload each build variant of your android application to separate AppCenter Apps.
MIT License
85 stars 45 forks source link

No upload tasks showing after moving to build.gradle.kts #32

Open kingargyle opened 4 years ago

kingargyle commented 4 years ago

After moving our builds to the Kotlin-DSL, the upload task is no longer being registered for the various build flavors.

The kotlin-dsl picks up the appcenter -> apps extensions, but I must use either a create("flavorName") or getByName("flavorName") to get the rest of the extensions configuration.

basically when I now run the: gradlew tasks

I get no entries for the appcenter plugin, where I did before the migration.

es0329 commented 4 years ago

@oliviergauthier I'm also facing this same bug.

@kingargyle did you ever find a workaround?

kingargyle commented 4 years ago

@es0329 I extracted the DSL into it's own .gradle file, and include it as part of the scripts that need to use it.

es0329 commented 4 years ago

@kingargyle I also tried that to no avail. You give me hope though! I'll revisit when I'm able and share the specific error message.

es0329 commented 4 years ago

Alright so... with the Kotlin DSL the project builds but without tasks registered/found for this plugin.

When I extract the config to a .gradle file and use apply { from(...) } in my .gradle.kts file, then the project fails to build.

ERROR: Unable to find method 'com.android.build.gradle.tasks.PackageAndroidArtifact.getOutputDirectory()Lorg/gradle/api/file/DirectoryProperty;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

I tried those suggestions, but no go. Commenting/uncommenting that apply line toggles whether it hits that error while building.

kingargyle commented 4 years ago

I did eventually, move the source code to build locally as part of the buildSrc directory, but in general I kept the configuration as a standard gradle option.

In the build.gradle.kts script that builds the source I do have a specified dependency on the android gradle tools.

implementation("com.android.tools.build:gradle:3.5.3")

Might need to make sure the depedency is on the class path when the build runs?