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

Update for JDK 17 #292

Closed
wants to merge 17 commits into from
Closed

Update for JDK 17 #292

wants to merge 17 commits into from

Conversation

Jawnnypoo
Copy link

@Jawnnypoo Jawnnypoo commented Mar 4, 2022

Hey there, this project has conflicts and does not work on projects that are targeting JDK 17. Most of this is due to the outdated usages of scrimage, so the bulk of this is updating that usage, but with some bonuses:

  • removing jcenter
  • updating dependencies which made things incompatible for JDK 17
  • update Gradle wrapper

This PR sort of supersedes #288 FYI just since it adds the additional support for JDK 17. Fixes #287

Copy link

@vyguera vyguera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. It looks right for me. It even does much more things than what you say, such as enabling androidx, updating kotlin plugin, updating compile and target SDK and updating compose version (which I think is 1.1.1 for the latest, now)

Copy link
Owner

@pedrovgs pedrovgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Jawnnypoo thanks for the PR 😃 could you please check code formatting? CI Reports there is an error. You can automatically format the code using a grade task configured. Thank you in advance 😃

@pedrovgs
Copy link
Owner

@Jawnnypoo looks like there is something wrong with the CI config after your update. Can you please take a look so we can ensure the CI is passing before releasing a new version? Thank you in advance 😃

@pedrovgs
Copy link
Owner

@Jawnnypoo I think after merging this PR all our users will be forced to use at least JDK >= 11. Am I wrong?

@@ -85,6 +89,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up JDK 11
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean 17 here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, good catch

@@ -20,6 +20,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove all the references to previous JDK configs we don't need? I'd like to use the minimum version possible. So if we can use JDK 11, please keep JDK 11 and remove the versions we don't need 😃

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sounds good 👍

@Jawnnypoo
Copy link
Author

Yeah, that sounds right. The latest Android Studio plugin requires Java 11 if I recall correctly.

@Jawnnypoo
Copy link
Author

Sorry this took so long, it should be good now, can we rerun this?

@Jawnnypoo
Copy link
Author

There might be some issues relating to Maven Central and the release signing, but thats not something I can look too much into myself. I confirmed that this branch can be deployed to Jitpack correctly, see https://jitpack.io/com/github/Jawnnypoo/Shot/1b555c2d20/build.log

@Jawnnypoo
Copy link
Author

If you wanted to try it out:

classpath(com.github.Jawnnypoo.Shot:shot:1b555c2d20)

with:

maven("https://jitpack.io")

configured for buildscript

@robertgorterns
Copy link

robertgorterns commented Feb 23, 2023

I tried this PR but I get an error running it in my project:

> Task :app:debugExecuteScreenshotTests FAILED
🔎  Comparing screenshots with previous ones.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:debugExecuteScreenshotTests'.
> Input image must store pixels as ints. Convert your input image using 0
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:debugExecuteScreenshotTests'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:140)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:128)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:57)
	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.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:69)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:309)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:302)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:288)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:462)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:379)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: java.lang.IllegalStateException: Input image must store pixels as ints. Convert your input image using 0
	at thirdparty.romainguy.BlendComposite$BlendingContext.compose(BlendComposite.java:111)
	at com.sksamuel.scrimage.composite.BlenderComposite.apply(BlenderComposite.java:23)
	at com.sksamuel.scrimage.composite.RedComposite.apply(RedComposite.java:5)
	at com.sksamuel.scrimage.ImmutableImage.composite(ImmutableImage.java:509)
	at com.karumi.shot.screenshots.ScreenshotsDiffGenerator.generateDiff(ScreenshotsDiffGenerator.scala:37)
	at com.karumi.shot.screenshots.ScreenshotsDiffGenerator.$anonfun$generateDiffs$1(ScreenshotsDiffGenerator.scala:21)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:116)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:113)
	at scala.collection.parallel.immutable.ParVector$ParVectorIterator.map2combiner(ParVector.scala:66)
	at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1056)
	at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
	at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
	at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
	at scala.collection.parallel.ParIterableLike$Map.tryLeaf(ParIterableLike.scala:1053)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
	at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync(Tasks.scala:379)
	at scala.collection.parallel.ForkJoinTasks$WrappedTask.sync$(Tasks.scala:379)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.sync(Tasks.scala:440)
	at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult(Tasks.scala:423)
	at scala.collection.parallel.ForkJoinTasks.executeAndWaitResult$(Tasks.scala:416)
	at scala.collection.parallel.ForkJoinTaskSupport.executeAndWaitResult(TaskSupport.scala:60)
	at scala.collection.parallel.ExecutionContextTasks.executeAndWaitResult(Tasks.scala:555)
	at scala.collection.parallel.ExecutionContextTasks.executeAndWaitResult$(Tasks.scala:555)
	at scala.collection.parallel.ExecutionContextTaskSupport.executeAndWaitResult(TaskSupport.scala:84)
	at scala.collection.parallel.ParIterableLike$ResultMapping.leaf(ParIterableLike.scala:960)
	at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
	at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
	at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
	at scala.collection.parallel.ParIterableLike$ResultMapping.tryLeaf(ParIterableLike.scala:955)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)```

@Jawnnypoo
Copy link
Author

Was it working previously with the latest version of this library?

@robertgorterns
Copy link

Previously it was working with the last release of shot + java 11. But now my project uses java 17, the main release of shot didn't work, so I tried this branch but I got this error that I hadn't had before

@Jawnnypoo
Copy link
Author

@pedrovgs I think you'll have to set up CI in a way that it doesn't need release signing unless it is actually pushing out the artifacts to Maven Central

@Jawnnypoo
Copy link
Author

Removed release signing, should pass now

@robertgorterns
Copy link

After recording my screenshots again it's working fine!

@vudzkostek
Copy link

vudzkostek commented Apr 15, 2023

Verified that this also solves issue described under #268. Hope it will be released soon, for now I will use local build in project because it prevents us from upgrading AGP, ComposeCompiler and couple of other things that require JDK 17.

But, as @robertgorterns wrote, it requires re-recording of all screenoshots so worth mentioning in changelog @pedrovgs

@robertgorterns
Copy link

also when the screenshot tests fail I don't get the proper error response, but the response I commented earlier

@amatsegor
Copy link

amatsegor commented May 10, 2023

@pedrovgs as far as I can see, all the changes are approved and MR is kind of good to go. When could a release with this fix be expected?

Co-authored-by: Nicholas Lythall <nic.lyth@gmail.com>
Copy link

@robertgorterns robertgorterns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two build errors

Files incorrectly formatted: /Users/runner/work/Shot/Shot/core/src/main/scala/com/karumi/shot/screenshots/ScreenshotsDiffGenerator.scala

Error: /Users/runner/work/Shot/Shot/core/src/main/scala/com/karumi/shot/screenshots/ScreenshotsDiffGenerator.scala:35:96: not found: value BufferedImage
Error: /Users/runner/work/Shot/Shot/core/src/main/scala/com/karumi/shot/screenshots/ScreenshotsDiffGenerator.scala:36:91: not found: value BufferedImage

@robertgorterns
Copy link

@Jawnnypoo There are still Build errors with that latest commit

@thomasflad
Copy link

@Jawnnypoo Thanks again for the work in this PR. Is there something missing to finish it? It seems close

@pedrovgs
Copy link
Owner

pedrovgs commented Jul 7, 2023

The update has been finally impemented here

@pedrovgs pedrovgs closed this Jul 7, 2023
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

Successfully merging this pull request may close these issues.

Shot build fails locally on M1 with JDK 17
8 participants