diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

NativeDepsPluginTest requires Java 11 #168

Closed jmini closed 2 years ago

jmini commented 2 years ago

When I run ./gradlew build using Java 8 I get this error:

com.diffplug.gradle.swt.NativeDepsPluginTest > assertPluginWorks FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /var/folders/d9/hsnvfz416qz37w3_v1kpj5pw0000gn/T/junit3217243612717905599 with arguments [test, --stacktrace]

    Output:

    > Configure project :
    p2AsMaven eclipse-swt-deps is dirty.
    Initalizing maven group eclipse-swt-deps from p2
    Only needs to be done once, future builds will be much faster
    p2AsMaven eclipse-swt-deps installing from p2
    Buildfile: /var/folders/d9/hsnvfz416qz37w3_v1kpj5pw0000gn/T/goomph-ant-build8045953443048996787.xml
    [p2.mirror] Messages while mirroring artifact descriptors.
    BUILD SUCCESSFUL

    BUILD SUCCESSFUL
    Total time: 43 seconds
    p2AsMaven eclipse-swt-deps creating maven repo
    p2AsMaven eclipse-swt-deps is complete.

    > Task :compileJava NO-SOURCE
    > Task :processResources NO-SOURCE
    > Task :classes UP-TO-DATE

    > Task :compileTestJava FAILED
    /private/var/folders/d9/hsnvfz416qz37w3_v1kpj5pw0000gn/T/junit3217243612717905599/src/test/java/undertest/NeedsSwt.java:8: error: cannot access Display
                Assert.assertEquals("org.eclipse.swt.widgets.Display", org.eclipse.swt.widgets.Display.class.getName());
                                                                                              ^
      bad class file: /private/var/folders/d9/hsnvfz416qz37w3_v1kpj5pw0000gn/T/junit3217243612717905599/build/p2asmaven/maven/eclipse-swt-deps/org.eclipse.swt.cocoa.macosx.x86_64/3.117.0.v20210906-0842/org.eclipse.swt.cocoa.macosx.x86_64-3.117.0.v20210906-0842.jar(org/eclipse/swt/widgets/Display.class)
        class file has wrong version 55.0, should be 52.0
        Please remove or make sure it appears in the correct subdirectory of the classpath.
    1 error

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':compileTestJava'.
    > Compilation failed; see the compiler error output for details.

I did not look at all the details, but I can imagine that the SWT version used by the plugin inside the test is now requiring Java 11.

nedtwigg commented 2 years ago

I'm open to a PR that fixes for Java 8, but since SWT has bumped minimum to 11 for a little while now it's not high on my priority list.

jmini commented 2 years ago

Are you building with Java 8 or 11 ?

I have the feeling, if you build with java 11, the test is not doing that much, see L28:

https://github.com/diffplug/goomph/blob/40f9c82b8f44d1ef25a435fdac0714a89d295370/src/test/java/com/diffplug/gradle/swt/NativeDepsPluginTest.java#L28

A quick fix is to change this line to run only with java 11…

jmini commented 2 years ago

I would appreciate if this plugin (I am more using the eclipseMavenCentral one) continues to be built with 8. I have some legacy builds that use this version and we did not moved them to a Java 11 version yet.

nedtwigg commented 2 years ago

It's still built with Java 8, and I've got no plans to change that :)

https://github.com/diffplug/goomph/blob/40f9c82b8f44d1ef25a435fdac0714a89d295370/.circleci/config.yml#L7-L8

It gets tested against Java 8 and Java 11, but the Java 8 test is broken due to the issue you have identified here.

jmini commented 2 years ago

So if I followed correctly, PR https://github.com/diffplug/goomph/pull/169 is a correct fix for the Java 8 build.

nedtwigg commented 2 years ago

I think the test really does require Java 8, but it uses the latest EclipseRelease, so it was grabbing an SWT that needs Java 11. Effing mess :). Fixed now.