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

Comments

Projects
None yet
6 participants
@gyscos

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

This comment has been minimized.

Show comment
Hide comment
@karolhor

karolhor Sep 21, 2017

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)
}

karolhor commented Sep 21, 2017

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

This comment has been minimized.

Show comment
Hide comment
@lbergelson

lbergelson Sep 25, 2017

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

lbergelson commented Sep 25, 2017

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

@REPLicated

This comment has been minimized.

Show comment
Hide comment
@REPLicated

REPLicated Sep 25, 2017

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).

REPLicated commented Sep 25, 2017

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

This comment has been minimized.

Show comment
Hide comment
@lbergelson

lbergelson Sep 25, 2017

That's even better!

lbergelson commented Sep 25, 2017

That's even better!

REPLicated added a commit to REPLicated/shadow that referenced this issue Sep 30, 2017

Fix SimpleWorkResult deprecation warning in gradle 4.2
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 johnrengelman#326.

@johnrengelman johnrengelman added this to the 2.0.2 milestone Nov 4, 2017

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Dec 12, 2017

Owner

2.0.2 is now available with this fix.

Owner

johnrengelman commented Dec 12, 2017

2.0.2 is now available with this fix.

charleskorn added a commit to charleskorn/batect that referenced this issue Dec 14, 2017

Update to the latest version of the 'shadow' Gradle plugin.
This fixes a deprecation warning shown when running the shadowJar task.
(See johnrengelman/shadow#326 for details.)
@DuncanCasteleyn

This comment has been minimized.

Show comment
Hide comment
@DuncanCasteleyn

DuncanCasteleyn Dec 28, 2017

I still have this issue.

Gradle version 4.4.1

afbeelding

DuncanCasteleyn commented Dec 28, 2017

I still have this issue.

Gradle version 4.4.1

afbeelding

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Dec 28, 2017

Owner

@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.

Owner

johnrengelman commented Dec 28, 2017

@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