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

Upgrade 5.x release branch further to Gradle 6 with new release setup #84

Merged
merged 7 commits into from
Sep 28, 2020

Conversation

Cervator
Copy link
Member

@Cervator Cervator commented Sep 13, 2020

Builds on #78 and overhauls Gradle some more with the existing setup in TeraNUI + MovingBlocks/TeraNUI#30

Draft PR because this shouldn't be merged to the 5.1.5 release branch (we already released that), plus the new release setup works on release/v5.x style branches that define long-lived release branches in parallel from whatever is the main thing (v7.x here in develop) and then just uses the version field to figure out what to publish, including snapshot vs release (amusingly some of that logic I stole from latest Gestalt, then used for JNBullet, then used for TeraNUI and now it has come full circle and ended up in an older Gestalt version again) . Then after a release we just tag for historical reference. So if this looks good I'll just push to that new branch instead.

This includes a new-school multibranch pipeline release job in the shiny new Jenkins, configured via code not UI: http://jenkins.terasology.io/teraorg/job/Nanoware/job/Gestalt/job/release%252Fv5.x/

One potential thing to fix: Something about the way the unit tests run fails in this branch, both locally and in Jenkins:

    <failure message="org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 14." type="org.gradle.api.internal.tasks.testing.TestSuiteExecutionException">org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 14.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:296)
	at org.junit.platform.launcher.core.DefaultLauncher.&lt;init&gt;(DefaultLauncher.java:62)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:91)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:67)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:97)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	... 25 more

I'm going to guess that's probably an easy fix, but I've been incredibly lucky with Gradle tonight so I'm going to leave it at this for now and not push my luck further :-)

Another minor annoyance, which isn't new: the base javadoc setup in Jenkins only lets it archive one location per job like this :-( I think that was partly from back when there were freestyle builds and Maven builds - the Maven ones were split into sub-jobs per Maven module, which could then add their own unique things. Not sure that's even a thing for Maven anymore (Maven-specific pipeline thingies) and it never was for Gradle.

While this is applied to the v5.x release line it shouldn't be hard to also apply to v7.x - I ended up redoing a bunch of the Gradle work in this older branch which I did for the newer line already. Similar stuff, will handle when able and this here looks good 👍

@Cervator Cervator added the Type: Improvement Request for or addition/enhancement of a feature label Sep 13, 2020
@Cervator Cervator changed the title Upgrade 5x release branch further to Gradle 6 with new release setup Upgrade 5.x release branch further to Gradle 6 with new release setup Sep 13, 2020
Copy link
Member

@keturn keturn left a comment

Choose a reason for hiding this comment

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

This builds for me, including as a part of an included build from Terasology/libs from both command line and IntelliJ IDEA. 🎉

gradle has a bunch of things to say about deprecations, things to change to be more forward-compatible or to support various build optimization strategies, but this PR is already such a big leap forward I wouldn't hold it back for that sort of thing.

One thing that does strike me as quirky is that it uses a subprojects {} block in the root project to apply common.gradle, but explicitly edits the subprojects individual build.gradle files to apply publish.gradle.

You could also run gradle wrapper one more time to refresh the gradlew and gradlew.bat scripts.

gradle/common.gradle Show resolved Hide resolved
Copy link
Contributor

@DarkWeird DarkWeird left a comment

Choose a reason for hiding this comment

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

I left two solution with test problem.
You problem: not consistent configuration for tests.
You said to Gradle: "Use Junit Platform" and not said to dependecies: "Fetch TestEngine for tests"

@@ -1 +1 @@
version=5.1.5
version=5.1.6-SNAPSHOT
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh NOOOOOOO!!!!
SNAPSHOT again!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, just so the build doesn't fail as it tries to publish 5.1.5 a second time ;-) When this is complete and tested post-merge it'll be 5.1.6 don't worry :-)


// Extra details provided for unit tests
test {
useJUnitPlatform()
Copy link
Contributor

Choose a reason for hiding this comment

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

You want using Junit Platform (part of junit 5).

If you want to left junit 4 there, then use pure junit4 "runner":

Suggested change
useJUnitPlatform()
useJUnit()

compile group: 'com.google.guava', name: 'guava', version: '19.0'

// These dependencies are only needed for running tests
testCompile group: 'junit', name: 'junit', version: '4.12'
Copy link
Contributor

Choose a reason for hiding this comment

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

You using Junit 4 !
If you want use Junit Platform (gradle's test section) and Junit 4 tests behind:

Suggested change
testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation("junit:junit:4.13")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.7.0")

or add this for migrate layer :D

Suggested change
testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation("junit:junit:4.13")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.7.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")

If you want use pure Junit 5 - then you must migrate tests first. :3 (You can do it with Idea's Migrate command)

Copy link

@casals casals left a comment

Choose a reason for hiding this comment

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

Builds OK here

@casals
Copy link

casals commented Sep 14, 2020

Should be OK to merge along with #78 pending revision on @DarkWeird's comments

@Cervator
Copy link
Member Author

Thanks for the review and testing all! Will fix up and push to the new branch then.

@keturn the newer Gradle in the latest release line is already way better than what's here, since I redid all that once already. I did a less grand overhaul here just because it is a doomed release line anyway. It is a little messier in some places than it could be.

@DarkWeird thanks for pointing out the test issue! Figured it was something like that

@Cervator
Copy link
Member Author

Okay I think the unit test issue is resolved although I got some weird new failures locally - they didn't show up in Jenkins, however. Might just be weird build state in my workspace.

java.lang.ClassNotFoundException: ModuleAClass

	at org.terasology.module.SandboxTest.findClass(SandboxTest.java:136)
	at org.terasology.module.SandboxTest.accessToNormalMethod(SandboxTest.java:74)
...

@Cervator Cervator marked this pull request as ready for review September 28, 2020 02:53
@Cervator Cervator merged commit d8b35c0 into MovingBlocks:5.1.5 Sep 28, 2020
@Cervator Cervator added this to the v5.1.6 milestone Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants