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

Deprecation warnings when running pitest task with Gradle 6.0 #155

Closed
embee1981 opened this issue Nov 10, 2019 · 16 comments
Closed

Deprecation warnings when running pitest task with Gradle 6.0 #155

embee1981 opened this issue Nov 10, 2019 · 16 comments
Labels
Milestone

Comments

@embee1981
Copy link

When running the "pitest" task with Gradle 6.0 I get the following warnings (ensure "all" warnings are show, eg via gradle.properties file with org.gradle.warning.mode=all ):

Task :pitest
Property 'additionalClasspathFile' has conflicting type annotations declared: @input, @OutputFile; assuming @input. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'additionalClasspathFile' has @input annotation used on property of type 'File'. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'defaultFileForHistoryData' has @input annotation used on property of type 'File'. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'historyInputLocation' has @input annotation used on property of type 'File'. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'jvmPath' has @input annotation used on property of type 'File'. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.

@szpak szpak added the gradle label Dec 13, 2019
@remal
Copy link

remal commented Feb 21, 2020

@szpak Could you please fix it?

@szpak
Copy link
Owner

szpak commented Feb 21, 2020

I had a discussion with the Gradle guys about that and we didn't reach a consensus. I will try to make the second attempt to make it supported in Gradle (I would like to have that variable as both input and output - for different parts on the execution) or sort out how to solve it in the other way.

@remal
Copy link

remal commented Feb 25, 2020

As I can see, right now only additionalClasspathFile property is marked as @Input and @OutputFile. I suggest making it optional and use it's value, if thу property is set, and some temporary file, if the property isn't set. The temporary file doesn't need to be presented in the task's outputs.

@szpak
Copy link
Owner

szpak commented Feb 26, 2020

As I can see, right now only additionalClasspathFile property is marked as @Input and @OutputFile. I suggest making it optional and use it's value, if thу property is set, and some temporary file, if the property isn't set. The temporary file doesn't need to be presented in the task's outputs.

It the output of the task. Some other task re-use that. That was the initial idea to mark it as @OutputFile. Nevertheless, it is rather a rare (imagery) use-case and I will split it into 2 fields or just remove @OutputFile.

@szpak
Copy link
Owner

szpak commented Feb 26, 2020

Btw, I recalled why I haven't fixed those warnings back in September. It would remove the plugin compatibility with Gradle <5.6. See here and there.

5.5.1 was released on Jun 28, 2019 - just a hair over half year ago which is quite sad (when it was just 3 months). Nevertheless, the world moves forward and I will make a switch.

@szpak
Copy link
Owner

szpak commented Feb 26, 2020

I have encountered gradle/gradle#12351, but luckily Stefan provided a workaround.

@remal @embee1981 Please test the latest snapshot which should by Gradle6-related warnings.

buildscript {
    repositories {
        mavenCentral()
        //Needed only for SNAPSHOT versions
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    dependencies {
        classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.7-SNAPSHOT'
    }
}

@szpak szpak added this to the 1.4.7 milestone Feb 26, 2020
@remal
Copy link

remal commented Feb 26, 2020

This warning has been fixed, but another one occurs. I have a multi-module Gradle project.

The configuration :pitest was resolved without accessing the project in a safe manner.  This may happen when a configuration is resolved from a different project. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.2.1/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors for more details.
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:571)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1900(DefaultConfiguration.java:141)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getSelectedArtifacts(DefaultConfiguration.java:1246)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitContents(DefaultConfiguration.java:1237)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitStructure(DefaultConfiguration.java:1233)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.visitStructure(DefaultConfiguration.java:489)
	at org.gradle.api.internal.file.CompositeFileCollection.visitStructure(CompositeFileCollection.java:181)
	at org.gradle.internal.fingerprint.impl.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:49)
	at org.gradle.internal.fingerprint.impl.AbstractFileCollectionFingerprinter.fingerprint(AbstractFileCollectionFingerprinter.java:46)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.lambda$visitInputFileProperties$1(ExecuteActionsTaskExecuter.java:324)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$fingerprintInputFiles$3(CaptureStateBeforeExecutionStep.java:192)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.visitInputFileProperties(ExecuteActionsTaskExecuter.java:322)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.fingerprintInputFiles(CaptureStateBeforeExecutionStep.java:188)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionState(CaptureStateBeforeExecutionStep.java:150)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$captureExecutionStateOp$1(CaptureStateBeforeExecutionStep.java:104)
	at org.gradle.internal.execution.steps.BuildOperationStep$1.call(BuildOperationStep.java:40)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.internal.execution.steps.BuildOperationStep.operation(BuildOperationStep.java:37)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionStateOp(CaptureStateBeforeExecutionStep.java:103)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$execute$0(CaptureStateBeforeExecutionStep.java:78)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:192)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:184)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:748)

@szpak
Copy link
Owner

szpak commented Feb 26, 2020

Thanks for checking. It depends how you refers to that configuration. Please see this commit, is that your case?

The change it not perfect, but I asked about that and maybe there is some better way.

@remal
Copy link

remal commented Feb 26, 2020

I'm afraid, I'm not sure if this commit is about my case or not. I suppose that the cause is that you use rootProject.buildscript.configurations...

@szpak
Copy link
Owner

szpak commented Feb 26, 2020

That multi-module sample project (in the devel branch) used in the functional tests doesn't generate any warnings with Gradle 6.x.

Please share share a link to you project (if available), modify mine to generate a warning or provide some other minimal which could be used to determine where the problem is.

@remal
Copy link

remal commented Feb 27, 2020

I'm using junit5 test-plugin, so I configured the root project like this:

buildscript {
  // ...
  configurations.maybeCreate('pitest')
  dependencies {
    classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.6'
    pitest 'org.pitest:pitest-junit5-plugin:0.8'
  }
}

Also I run Gradle with org.gradle.parallel = true.

Looks like pitest gradle plugin tries to resolve pitest configuration of the buildscript of the root project from subprojects.

I'm not sure why I have this issue and your test doesn't generate it, but, as I understand, Gradle doesn't like resolving configurations from other projects.

The project I'm working on is not an open-source, so I can give you the link.

@remal
Copy link

remal commented Feb 27, 2020

To eliminate The configuration :pitest was resolved without accessing the project in a safe manner warning I've done this:

configurations.maybeCreate("pitest")
dependencies {
    pitest "org.pitest:pitest-command-line"
    pitest "org.pitest:pitest-junit5-plugin"
}

tasks.pitest.configure {
    launchClasspath = project.configurations.pitest
}

@szpak
Copy link
Owner

szpak commented Feb 27, 2020

Looks like pitest gradle plugin tries to resolve pitest configuration of the buildscript of the root project from subprojects.

Yes, it does.

I'm glad you've found a workaround on that. The idea to do not use the root project for the pitest configuration is not new - #62. I plan to take a look at it. However, most likely it will not be backward compatible, so as the other - more common - warnings seem to be fixed I plan to release 1.4.7 soon.

@remal as a JUnit 5 user you might also benefit (to some degree) from #177.

@szpak szpak closed this as completed Feb 27, 2020
@szpak
Copy link
Owner

szpak commented Feb 27, 2020

And thanks for getting into the problem in your project.

@embee1981
Copy link
Author

@szpak thanks for this :-) , new version of plugin has reduced the deprecation warnings, just the one left for me (multi project setup, "The configuration :pitest was resolved without accessing the project in a safe manner.", gradle 6.2.1). Think you've got a bug open for this one though.

@szpak
Copy link
Owner

szpak commented Feb 29, 2020

Yes, #62.

Btw, do you have tests in a separate module or just like @remal you "just" have multiple projects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants