Skip to content

Commit

Permalink
[#141] Rework test for issue with @tostring in Gradle 6.0
Browse files Browse the repository at this point in the history
Related issue in Gradle: gradle/gradle#11466
  • Loading branch information
szpak committed Dec 23, 2019
1 parent ef3e0f6 commit 4374ee6
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 25 deletions.
22 changes: 13 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# gradle-nexus-staging-plugin changelog

## 0.21.2 - Unreleased

- Workaround incompatibility with Gradle 6.0 caused by a Gradle bug ([#11466](https://github.com/gradle/gradle/issues/11466)) - [#141](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/141) - PR by [Lars Grefer](https://github.com/larsgrefer)

## 0.21.1 - 2019-09-05

- Fix incompatibility of unsupported releasing with legacy upload task with Gradle 5
Expand All @@ -19,10 +23,10 @@
## 0.20.0 - 2019-01-05

- Reuse explicitly created staging repository ID if provided by external plugin - [#77](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/77)
- Fix releasing from Travis - workaround Gradle limitation with Nexus stating repositories with external plugin - [nexus-publish-plugin](https://github.com/marcphilipp/nexus-publish-plugin/) [#76](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/76)
- Fix releasing from Travis - workaround Gradle limitation with Nexus stating repositories with external plugin - [nexus-publish-plugin](https://github.com/marcphilipp/nexus-publish-plugin/) [#76](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/76)
- Raise minimal required Gradle version to 4.8 due to internals modernisation
- Runtime compatibility with Gradle 5.0 and 5.1

**Deprecation note**. Support for implicitly created staging repositories is deprecated. It has been always problematic, slow and error prone
to find a proper staging repository and the recent [changes](https://github.com/travis-ci/travis-ci/issues/9555) in Travis just emphasised that.
Thanks to the new [nexus-publish-plugin](https://github.com/marcphilipp/nexus-publish-plugin/) plugin by
Expand All @@ -31,32 +35,32 @@ explicitly created staging repositories in Nexus. At least in a case of using `m
plugin (the `uploadArchives` task) please refer to [that issue](https://github.com/marcphilipp/nexus-publish-plugin/issues/8).

The original code has not been removed and *should* still work for the time being (if you don't use Travis), but it is no longer officially
supported (e.g. the E2E tests has been switched to the new approach).
supported (e.g. the E2E tests has been switched to the new approach).

## 0.12.0 - 2018-09-29

- Java 11 compatibility (basic path verified by e2e tests) - [#73](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/73)
- Fix crash on non-upload task named 'uploadArchives' - [#67](https://github.com/szpak/CDeliveryBoy/issues/#67)
- Drop support for Java 7
- Drop Gradle 2.x support (not supported by used plugins)
- Drop Gradle 2.x support (not supported by used plugins)
- Upgrade project dependencies
- Upgrade Gradle to 4.10.2

## 0.11.0 - 2017-08-18

- Fail when applied on non-root project - [#47](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/47)
- Less confusing log output without "info" logging enabled - [#60](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/60)
- Less confusing log output without "info" logging enabled - [#60](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/60)
- Upgrade project dependencies
- Upgrade Gradle to 4.1 (compatibility with Gradle 2.0+ should be still maintained)

## 0.10.0 - 2017-08-18

- Configurable repository description in close/release operation - [#63](https://github.com/Codearte/gradle-nexus-staging-plugin/pull/63) - contribution by [akomakom](https://github.com/akomakom)

## 0.9.0 - 2017-06-05

This release provides no new features or bugfixes. It is focused on acceptance E2E testing and Continuous Delivery
with [CDeliveryBoy](https://travis-ci.org/szpak/CDeliveryBoy).
with [CDeliveryBoy](https://travis-ci.org/szpak/CDeliveryBoy).

- Acceptance tests at Gradle level run before release against real Nexus - [#40](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/40)
- Automatic `CHANGELOG.md` synchronization with GitHub releases - [#52](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/52)
Expand All @@ -71,14 +75,14 @@ with [CDeliveryBoy](https://travis-ci.org/szpak/CDeliveryBoy).
- Make functional tests work also on Windows - [#39](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/39)

**Deprecation note**. The ~~promoteRepository~~ and ~~closeAndPromoteRepository~~ tasks are marked as deprecated and will be removed
in one of the future versions. `releaseRepository` and `closeAndReleaseRepository` can be used as drop-in replacements.
in one of the future versions. `releaseRepository` and `closeAndReleaseRepository` can be used as drop-in replacements.

## 0.7.0 - 2017-03-27

- Verify that repository has been really closed - [#21](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/21)
- Re-enable sharing stagingRepositoryId between close and promote - [#46](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/46)
- Basic functional tests with different Gradle versions - [#41](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/41)
- Suggest longer timeout if failed on time related operations even without `--info` enabled - [#34](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/34)
- Suggest longer timeout if failed on time related operations even without `--info` enabled - [#34](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/34)
- Longer default retry period - [#12](https://github.com/Codearte/gradle-nexus-staging-plugin/issues/12)

## 0.6.1 - 2017-03-20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import com.google.common.base.Predicates
import io.codearte.gradle.nexus.NexusStagingPlugin
import nebula.test.functional.ExecutionResult
import nebula.test.functional.GradleRunner
import org.gradle.api.GradleException
import org.gradle.internal.jvm.Jvm
import org.gradle.util.GradleVersion
import spock.lang.Issue
import spock.lang.PendingFeature
import spock.util.Exceptions

import java.util.regex.Pattern
Expand All @@ -31,6 +34,9 @@ class GradleVersionFuncSpec extends BaseNexusStagingFunctionalSpec implements Fu
${getPluginConfigurationWithNotExistingNexusServer()}
${getLegacyModeConfigurationIfRequested(isInLegacyMode as boolean)} //"as" for Idea
//following to cover regression in @ToString on Extension - https://github.com/Codearte/gradle-nexus-staging-plugin/issues/141
println nexusStaging
""".stripIndent()
when:
ExecutionResult result = runTasksWithFailure('getStagingProfile')
Expand All @@ -47,27 +53,42 @@ class GradleVersionFuncSpec extends BaseNexusStagingFunctionalSpec implements Fu
legacyModeMessage = isInLegacyMode ? "(legacy)" : ""
}

def "should not fail on #legacyModeMessage toString issue with Gradle #requestedGradleVersion"() {
@Issue("https://github.com/Codearte/gradle-nexus-staging-plugin/issues/141")
@PendingFeature(exceptions = GradleException, //StackOverflowError as root cause would be better
reason = "Bug in Gradle 6.x - https://github.com/gradle/gradle/issues/11466")
def "should not fail on @ToString for extension class in Gradle 6.x"() {
given:
gradleVersion = requestedGradleVersion.version
classpathFilter = Predicates.and(GradleRunner.CLASSPATH_DEFAULT, FILTER_SPOCK_JAR)
memorySafeMode = true //shutdown Daemon after a few seconds of inactivity
gradleVersion = LATEST_GRADLE_VERSION.version
and:
buildFile << """
${getApplyPluginBlock()}
${getPluginConfigurationWithNotExistingNexusServer()}
import groovy.transform.ToString
${getLegacyModeConfigurationIfRequested(isInLegacyMode as boolean)} //"as" for Idea
@ToString(includeFields = true, includeNames = true, includePackage = false)
class ToStringBugDemonstrationExtension {
final Property<String> bugId
println nexusStaging
""".stripIndent()
when:
ExecutionResult result = runTasksSuccessfully("help")
then:
result.wasExecuted(':help')
where:
[requestedGradleVersion, isInLegacyMode] << [applyJavaCompatibilityAdjustment(resolveRequestedGradleVersions()).unique(), [false, true]].combinations()
legacyModeMessage = isInLegacyMode ? "(legacy)" : ""
ToStringBugDemonstrationExtension(Project project) {
bugId = project.getObjects().property(String)
}
}
class ToStringBugDemonstrationPlugin implements Plugin<Project> {
void apply(Project project) {
def extension = project.extensions.create("toStringExtension", ToStringBugDemonstrationExtension, project)
project.task("printBugId") {
doLast {
println "Bug ID: \${extension.bugId}"
}
}
}
}
apply plugin: ToStringBugDemonstrationPlugin
println "ToString: " + toStringExtension //in fact not needed in that case
"""
expect:
runTasksSuccessfully("printBugId")
}

private String getPluginConfigurationWithNotExistingNexusServer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import org.gradle.api.provider.Property
@SuppressWarnings("UnstableApiUsage")
@CompileStatic
@Slf4j
//TODO: Re-enable once https://github.com/gradle/gradle/issues/11466 is fixed in Gradle
//@ToString(includeFields = true, includeNames = true, includePackage = false)
class NexusStagingExtension {

String serverUrl
Expand Down

0 comments on commit 4374ee6

Please sign in to comment.