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

Spock can be compiled on JDK 10 [WIP] #862

Merged
merged 2 commits into from
Aug 28, 2018

Conversation

MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Jul 27, 2018

Hi,

I did some work on #808 and I can compile Spock with JDK 10. There are several important things though:

Regards,
Martin

@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch from 6d78da7 to da6951e Compare July 27, 2018 15:25
@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch from da6951e to f1fd684 Compare July 27, 2018 15:38
@codecov
Copy link

codecov bot commented Jul 27, 2018

Codecov Report

Merging #862 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #862      +/-   ##
============================================
+ Coverage        75%   75.01%   +<.01%     
  Complexity     3422     3422              
============================================
  Files           368      368              
  Lines         10528    10545      +17     
  Branches       1323     1331       +8     
============================================
+ Hits           7897     7910      +13     
- Misses         2166     2169       +3     
- Partials        465      466       +1
Impacted Files Coverage Δ Complexity Δ
...ckframework/spring/mock/DelegatingInterceptor.java 52.5% <0%> (-5%) 6% <0%> (-1%)
.../spockframework/mock/runtime/MockInstantiator.java 58.33% <0%> (-1.67%) 5% <0%> (ø)
...ck/runtime/DynamicProxyMockInterceptorAdapter.java 100% <0%> (ø) 4% <0%> (ø) ⬇️
...org/spockframework/compiler/ConditionRewriter.java 54.49% <0%> (+0.05%) 44% <0%> (ø) ⬇️
...spockframework/runtime/ExpressionInfoRenderer.java 92.85% <0%> (+0.12%) 20% <0%> (ø) ⬇️
...n/java/org/spockframework/util/ReflectionUtil.java 78.81% <0%> (+0.18%) 66% <0%> (ø) ⬇️
.../java/org/spockframework/runtime/SpockRuntime.java 71.73% <0%> (+0.31%) 20% <0%> (ø) ⬇️
...pockframework/mock/runtime/InteractionBuilder.java 80.28% <0%> (+0.86%) 26% <0%> (ø) ⬇️
.../spockframework/builder/CollectionSlotFactory.java 88.88% <0%> (+1.38%) 6% <0%> (ø) ⬇️
.../spockframework/util/StringMessagePrintStream.java 86.15% <0%> (+3.07%) 24% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eeb1e14...644aeb0. Read the comment docs.

@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch 4 times, most recently from e435c1c to 240a2bc Compare August 24, 2018 13:44
@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 24, 2018

@leonard84 Hi Leonard, could you please give me some feedback for the PR?

PS: https://travis-ci.org/spockframework/spock/builds/420159380 - best build so far

@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch from 1d34ca6 to 6ad6bde Compare August 26, 2018 19:07
def trace

if (javaVersion >= 9) {
trace = Arrays.stream(exception.getStackTrace())
Copy link
Member

Choose a reason for hiding this comment

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

can be done with groovy functions without requiring Java8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

settings.gradle Outdated
@@ -5,7 +5,7 @@ include "spock-spring"
include "spock-spring:spring2-test"
include "spock-spring:spring3-test"
include "spock-guice"
include "spock-tapestry"
// include "spock-tapestry"
Copy link
Member

Choose a reason for hiding this comment

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

only if javaVersion >1.8

Copy link
Contributor Author

@MartyIX MartyIX Aug 27, 2018

Choose a reason for hiding this comment

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

Fixed.

build.gradle Outdated
tasks.withType(Javadoc) {
//options.addStringOption('-release', releaseVersion)
Copy link
Member

Choose a reason for hiding this comment

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

what about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

build.gradle Outdated
maxGroovyVersion = snapshotVersion ? "3.9.99" : "2.9.99" // TODO lock these down once Groovy 3 gets close to RC stage
if (System.getProperty("groovyVersion")) {
groovyVersion = System.getProperty("groovyVersion")
}
fullVersion = baseVersion + ((!snapshotVersion && releaseCandidate) ? "-RC$releaseCandidate" : "") + "-groovy-$variant" + (snapshotVersion ? "-SNAPSHOT" : '')
variantLessVersion = baseVersion + (snapshotVersion ? "-SNAPSHOT" : (releaseCandidate ? "-RC$releaseCandidate" : ""))
javaVersions = [1.7, 1.8]
javaVersions = [1.8, 9, 10, 11]
Copy link
Member

Choose a reason for hiding this comment

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

Spock 1.x should still support Java 7, it should work if you add it back in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

build.gradle Outdated
@@ -33,24 +35,32 @@ ext {
"org.codehaus.groovy:groovy-test:${groovyVersion}",
"org.codehaus.groovy:groovy-sql:${groovyVersion}",
"org.codehaus.groovy:groovy-xml:${groovyVersion}",
"org.codehaus.groovy:groovy-jaxb:${groovyVersion}",
Copy link
Member

Choose a reason for hiding this comment

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

why do we need jaxb?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch from 2e61416 to d50ca96 Compare August 27, 2018 17:29
@MartyIX MartyIX force-pushed the feature/compile-on-jdk10 branch from e2b2502 to abe0c37 Compare August 27, 2018 17:56
@MartyIX
Copy link
Contributor Author

MartyIX commented Aug 27, 2018

@leonard84 I have cleaned up the commit as much as I could.

if (javaVersion >= 9) {
groovyDependency += ["javax.xml.bind:jaxb-api:2.3.0"]
}

libs = [
jetbrainsAnnotations: "org.jetbrains:annotations:13.0",
ant: "org.apache.ant:ant:1.9.7",
asm: "org.ow2.asm:asm:6.2",
bytebuddy: "net.bytebuddy:byte-buddy:1.8.3",
Copy link
Member

Choose a reason for hiding this comment

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

There are still new fixed/features related to Java 11 compatibility in byte-buddy. I propose to upgrade it to the least stable version - 1.8.18.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tried locally 1.8.17 and some tests fail. I don't believe it is possible due to raphw/byte-buddy#486

Personally, I would rather make this PR work and then somebody can improve it further and add support for Java 11 (#843). To be honest, I don't anything about the stuff mentioned in #843.

Copy link
Member

@szpak szpak Aug 27, 2018

Choose a reason for hiding this comment

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

Sounds reasonably having the build failing with the newer version. Thanks for trying to keep Spock building on Java 10!

.travis.yml Outdated
@@ -20,6 +20,8 @@ dist: precise # downgrade to avoid jdk7 SSL Bug https://github.com/docker-librar
jdk:
- oraclejdk7 # openjdk7 has SSL Bug avoid jdk7 SSL Bug https://github.com/docker-library/openjdk/issues/117
- oraclejdk8
- openjdk9
Copy link
Member

Choose a reason for hiding this comment

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

Java 9 is already eol, the build on travis was green, so I'd say we drop it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@leonard84 leonard84 merged commit a962d8c into spockframework:master Aug 28, 2018
@leonard84
Copy link
Member

Thanks for your contribution @MartyIX

} else if (variant == 2.5) {
groovyVersion = "2.5.2"
minGroovyVersion = "2.5.0"
minGroovyVersion = "2.5.2"
Copy link
Member

Choose a reason for hiding this comment

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

@MartyIX Was it really needed for Java 10 compatibility or you changed in accidentally (and 2.5.0 is still fine)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@szpak I think I've upgraded the dependency because of this issue https://issues.apache.org/jira/browse/GROOVY-8710. You can certainly try to downgrade it and see if it still works.

@MartyIX MartyIX deleted the feature/compile-on-jdk10 branch September 10, 2018 12:58
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.

3 participants