Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:buildSrc:generatePrecompiledScriptPluginAccessors failing due to marathon plugin #602

Open
ZakTaccardi opened this issue Feb 8, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@ZakTaccardi
Copy link

ZakTaccardi commented Feb 8, 2022

Seeing a series of these errors:

:buildSrc:generatePrecompiledScriptPluginAccessors
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'com.malinskiy.marathon']
org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.malinskiy.marathon'.
org.gradle.api.UnknownTaskException: Task with name 'marathonWrapper' not found in project ':buildSrc:generatePrecompiledScriptPluginAccessors:accessors13741167371926945111'.
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'com.malinskiy.marathon']
org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.malinskiy.marathon'.
org.gradle.api.UnknownTaskException: Task with name 'marathonWrapper' not found in project ':buildSrc:generatePrecompiledScriptPluginAccessors:accessors1512429817489567500'.
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'com.malinskiy.marathon']
org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.malinskiy.marathon'.
org.gradle.api.UnknownTaskException: Task with name 'marathonWrapper' not found in project ':buildSrc:generatePrecompiledScriptPluginAccessors:accessors8459745059630063086'.

My guess is that there's some weirdness with how marathon generates plugin script accessors for precompiled kotlin gradle script plugins.

I'm guessing line in question is here:

val unpackMarathonTask = rootProject.tasks.getByName(MarathonUnpackTask.NAME, MarathonUnpackTask::class)

Note: subprojects should not be accessing the root project as this will break configuration cache support and project isolation

Gradle slack convo on this

@ZakTaccardi ZakTaccardi added the bug Something isn't working label Feb 8, 2022
@ZakTaccardi
Copy link
Author

workaround is to do this:

plugins {
  // causes bug, do not apply here
  // id("com.malinskiy.marathon")
}

// applying inline outside of plugins block due to https://github.com/MarathonLabs/marathon/issues/602
apply(plugin = "com.malinskiy.marathon")

@Malinskiy
Copy link
Member

The reason for accessing root project is to partially mitigate your issue #601.
New marathon plugin extracts the cli binary if it's not present. This has to happen once for whole project so a task on the root project is doing just that.

I'm not exactly sure what happens here with your project init. Can you create a sample project that reproduces the problem?

@ZakTaccardi
Copy link
Author

sure! will take some time to create a shareable reproducer, but I can hopefully get one to you in a few days.

New marathon plugin extracts the cli binary if it's not present. This has to happen once for whole project so a task on the root project is doing just that.

Hopefully there's a more idiomatic way to handle this than direct root project access from the subproject. I asked about it on gradle slack

@simonpoole
Copy link

simonpoole commented Feb 19, 2022

FWIW I currently get the, maybe the same, error

* Where:
Build file 'C:\Users\simon\git\osmeditor4android\build.gradle' line: 55

* What went wrong: 
A problem occurred evaluating root project 'osmeditor4android'.
> Failed to apply plugin 'marathon'.
   > Task with name 'marathonWrapper' not found in root project 'osmeditor4android'.

gradle 7.0, groovy config, marathon plugin 0.7.0

Relevant stacktrace

Caused by: org.gradle.api.UnknownTaskException: Task with name 'marathonWrapper' not found in root project 'osmeditor4android'.
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:102)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:46)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333)
	at org.gradle.kotlin.dsl.NamedDomainObjectCollectionExtensionsKt.getByName(NamedDomainObjectCollectionExtensions.kt:308)
	at com.malinskiy.marathon.gradle.MarathonPlugin.apply(MarathonPlugin.kt:32)
	at com.malinskiy.marathon.gradle.MarathonPlugin.apply(MarathonPlugin.kt:21)
	at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)
	at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51)
	at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
	at org.gradle.api.internal.plugins.DefaultPluginManager.access$100(DefaultPluginManager.java:51)
	at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:272)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
	at org.gradle.api.internal.plugins.DefaultPluginManager.lambda$doApply$0(DefaultPluginManager.java:157)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43)
	at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:156)
	... 150 more

PS: this is independent of how I configure the plugin in the build script.

@Malinskiy
Copy link
Member

Is this still an issue?

@simonpoole
Copy link

I haven't tried to upgrade of late, but last time I tried (2-3 months back) I had the same issues. I'll make some time this week for re-testing.

@simonpoole
Copy link

@Malinskiy just upgraded to 0.8.0. looks great and no issues outside of the minor, unrelated to this, #774, thanks!

@Malinskiy
Copy link
Member

@simonpoole great, thanks for the feedback. I'll check the windows issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants