-
Notifications
You must be signed in to change notification settings - Fork 135
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
Fix 6.1 checkstyle report finalizer failure #1176
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c526a21
Start writing a test and fix deprecation warnings
CRogers ea379d8
Finally get a test failure
CRogers fec27a3
Jump throguh some hoops
CRogers 320ecbe
Fix problem and upgrade to 6.1 to get new code
CRogers 01ca418
Configure the task eagerly before the property is finalised, also dow…
CRogers 529ce44
Fix mistakenly changed files
CRogers 272e3ce
Add generated changelog entries
CRogers 642a72b
Attempt to use testkit
CRogers 1c3e659
Revert "Attempt to use testkit"
CRogers dc4ba46
Merge branch 'fix-junit-reportsw-gradle-6.1' of github.com:palantir/g…
CRogers c72f068
Use afterEvaluate to really make sure it works
CRogers 4d362d9
Fix imports
CRogers bbbe9ed
Format files before merge
CRogers 95245eb
Merge branch 'develop' of github.com:palantir/gradle-baseline into fi…
CRogers b7a0163
Fix format
CRogers 0961d54
Remove deprecation
CRogers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: fix | ||
fix: | ||
description: Errors of the form `The value for Report xml property 'required' is | ||
final and cannot be changed any further.` in Gradle 6.1 are now fixed for the | ||
`com.palantir.junit-reports` plugin. | ||
links: | ||
- https://github.com/palantir/gradle-baseline/pull/1176 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
gradle-baseline-java/src/test/groovy/com/palantir/baseline/JunitReportsPluginSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* (c) Copyright 2020 Palantir Technologies Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.baseline | ||
|
||
import nebula.test.IntegrationSpec | ||
import nebula.test.functional.ExecutionResult | ||
import spock.lang.Unroll | ||
|
||
@Unroll | ||
class JunitReportsPluginSpec extends IntegrationSpec { | ||
private static final List<String> GRADLE_TEST_VERSIONS = ['5.6.4', '6.1'] | ||
|
||
def '#gradleVersionNumber: configures the checkstlye plugin correctly'() { | ||
setup: | ||
gradleVersion = gradleVersionNumber | ||
|
||
when: | ||
buildFile << ''' | ||
apply plugin: 'java' | ||
apply plugin: 'checkstyle' | ||
apply plugin: 'com.palantir.junit-reports' | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
'''.stripIndent() | ||
|
||
file('src/main/java/foo/Foo.java') << ''' | ||
package foo; | ||
public class Foo {} | ||
'''.stripIndent() | ||
|
||
ExecutionResult executionResult = runTasks('checkstyleMain') | ||
|
||
then: | ||
// Running checkstyle inside nebula does not work as there are classpath problems that result in the `groovy-all` | ||
// not being on Gradle's classpath. So the best we can do to verify that the checkstyle actually ran is to | ||
// verify we get the classpath error that happens when the checkstyle class runs :( | ||
// https://github.com/gradle/gradle/issues/3995 | ||
executionResult.standardError.contains 'java.lang.ClassNotFoundException: groovy.util.AntBuilder' | ||
|
||
where: | ||
gradleVersionNumber << GRADLE_TEST_VERSIONS | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to just not use nebula for this one test? i.e. to go through all the ProjectBuilder stuff manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can run with a specified gradle version without using nebula?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also happens in gradle test kit and the other 3rd party
gradleTest
framework :(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can https://docs.gradle.org/current/userguide/test_kit.html#sub:gradle-runner-gradle-version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if you disable debug it will not cause issues. Gradle test runner debug mode is a little too magical on your classpath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I gave using testkit/ProjectBuilder directly a go and I just couldn't get it to work (kept saying the existing code worked on Gradle 6.1) :( So this (or no test) may have to suffice.