gradle-appcenter-plugin icon indicating copy to clipboard operation
gradle-appcenter-plugin copied to clipboard

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

Open kingargyle opened this issue 5 years ago • 5 comments

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.

kingargyle avatar Oct 30 '19 18:10 kingargyle

@oliviergauthier I'm also facing this same bug.

@kingargyle did you ever find a workaround?

es0329 avatar Feb 21 '20 18:02 es0329

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

kingargyle avatar Feb 25 '20 17:02 kingargyle

@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 avatar Feb 25 '20 18:02 es0329

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.

es0329 avatar Feb 28 '20 17:02 es0329

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?

kingargyle avatar Mar 06 '20 15:03 kingargyle