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

SimpleWorkResult is deprecated in gradle 4.2 #326

Closed
gyscos opened this issue Sep 20, 2017 · 7 comments
Closed

SimpleWorkResult is deprecated in gradle 4.2 #326

gyscos opened this issue Sep 20, 2017 · 7 comments
Milestone

Comments

@gyscos
Copy link

gyscos commented Sep 20, 2017

Shadow Version

2.0.0, 2.0.1

Gradle Version

4.2

Expected Behavior

Clean build.

Actual Behavior

Gradle prints a deprecation warning:

> Task :shadowJar
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle 5.0. Please use WorkResults.didWork() instead.
@karolhor
Copy link

Solution for this fix is really simple. Unfortunately it requires to drop support for Gradle < 4.2

Change needs to be applied in ShadowCopyAction class

before:

import org.gradle.api.internal.tasks.SimpleWorkResult

@Override
WorkResult execute(CopyActionProcessingStream stream) {
  // ...
  return new SimpleWorkResult(true)
}

after:

import org.gradle.api.tasks.WorkResults

@Override
WorkResult execute(CopyActionProcessingStream stream) {
  // ...
  return WorkResults.didWork(true)
}

@lbergelson
Copy link

I would definitely support breaking compatibility with older gradle versions to fix this annoying output line.

@REPLicated
Copy link

The class WorkResults appeared in Gradle 4.2. Version 4.0 has just been released back in June and Shadow itself is currently built using 3.5 as I see.

While I understand and appreciate that things are progressing fast in the gradle world, I would also hope that plugins (and libraries in general) provide a reasonable continuity/backward compatibility. As an example of such an approach, see how Gradle continues to support building with java 7 until version 5.0.

I will create a PR that both avoids this warning and continues to be backward compatible (until Shadow starts to support the future 5.0 version, at which point it will probably be inevitable without hacks).

@lbergelson
Copy link

That's even better!

REPLicated added a commit to REPLicated/shadow that referenced this issue Sep 30, 2017
Explicitly silences deprecation warning regarding SimpleWorkResult.
Since the recommended WorkResults appeared in 4.2, we can use this
workaround to both avoid this warning in newer gradle versions and still
support pre-4.2 for now.

Closes GradleUp#326.
@johnrengelman johnrengelman added this to the 2.0.2 milestone Nov 4, 2017
@johnrengelman
Copy link
Collaborator

2.0.2 is now available with this fix.

charleskorn added a commit to batect/batect that referenced this issue Dec 14, 2017
This fixes a deprecation warning shown when running the shadowJar task.
(See GradleUp/shadow#326 for details.)
@DuncanCasteleyn
Copy link

I still have this issue.

Gradle version 4.4.1

afbeelding

@johnrengelman
Copy link
Collaborator

@DuncanCasteleyn your error is not the same problem as this issue. Please find an existing open issue that corresponds to this, or open a new one.

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

No branches or pull requests

6 participants