From b6c3888bc88d6fc0608510dfd5e46a27b995b1b4 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 4 Jan 2019 13:21:42 +0100 Subject: [PATCH] Added events to store information about passing tasks --- .../cloud/release/internal/Releaser.java | 11 +- .../release/internal/ReleaserProperties.java | 2 +- .../cloud/release/internal/git/GitRepo.java | 2 +- .../cloud/release/internal/pom/BomParser.java | 2 +- .../cloud/release/internal/pom/PomReader.java | 2 +- .../release/internal/pom/PomUpdater.java | 2 +- .../internal/pom/ProjectPomUpdater.java | 2 +- .../internal/pom/SpringCloudConstants.java | 2 +- .../cloud/release/internal/pom/Versions.java | 2 +- .../tech/MakeBuildUnstableException.java | 28 +++++ .../release/internal/pom/PomReaderTests.java | 2 +- .../release/internal/pom/PomUpdaterTests.java | 2 +- .../release/internal/pom/VersionsTests.java | 2 +- .../projects/project/children/pom.xml | 2 +- .../children/pom_case_from_contract.xml | 2 +- .../project/children/pom_different_group.xml | 2 +- .../pom_different_group_boot_parent.xml | 2 +- ...different_group_skip_deployment_plugin.xml | 2 +- ...nt_group_skip_deployment_plugin_mngmnt.xml | 2 +- ...m_different_group_skip_deployment_prop.xml | 2 +- .../children/pom_matching_artifact.xml | 2 +- .../project/children/pom_matching_parent.xml | 2 +- .../children/pom_matching_parent_v2.xml | 2 +- .../children/pom_matching_properties.xml | 2 +- .../test/resources/projects/project/pom.xml | 2 +- .../project/pom_matching_artifact.xml | 2 +- .../pom_matching_artifact_same_version.xml | 2 +- .../projects/project/pom_matching_parent.xml | 2 +- .../project/pom_matching_parent_v2.xml | 2 +- .../project/pom_matching_properties.xml | 2 +- .../pom_matching_with_parent_suffix.xml | 2 +- .../project/pom_with_parent_suffix.xml | 2 +- .../release/internal/ReleaserApplication.java | 2 +- .../cloud/release/internal/spring/Args.java | 27 +++- .../internal/spring/BuildCompleted.java | 30 +++++ .../internal/spring/OptionsProcessor.java | 18 ++- .../spring/ReleaserConfiguration.java | 13 +- .../internal/spring/SpringReleaser.java | 21 +++- .../cloud/release/internal/spring/Task.java | 26 +++- .../internal/spring/TaskCollector.java | 116 ++++++++++++++++++ .../internal/spring/TaskCompleted.java | 43 +++++++ .../cloud/release/internal/spring/Tasks.java | 69 +---------- .../internal/ReleaserApplicationTests.java | 28 ----- .../internal/spring/AcceptanceTests.java | 14 ++- .../spring/CompositeConsumerTests.java | 16 --- .../spring/OptionsProcessorTests.java | 2 +- .../spring/ReleaserApplicationEventTests.java | 67 ++++++++++ .../internal/spring/SpringReleaserTests.java | 4 +- 48 files changed, 422 insertions(+), 173 deletions(-) create mode 100644 spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/tech/MakeBuildUnstableException.java create mode 100644 spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/BuildCompleted.java create mode 100644 spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/TaskCollector.java create mode 100644 spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/TaskCompleted.java delete mode 100644 spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/ReleaserApplicationTests.java create mode 100644 spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserApplicationEventTests.java diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/Releaser.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/Releaser.java index 1d688300..ff7dd500 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/Releaser.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/Releaser.java @@ -4,16 +4,18 @@ import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.cloud.release.internal.docs.DocumentationUpdater; -import org.springframework.cloud.release.internal.gradle.GradleUpdater; -import org.springframework.cloud.release.internal.post.PostReleaseActions; -import org.springframework.cloud.release.internal.sagan.SaganUpdater; -import org.springframework.cloud.release.internal.template.TemplateGenerator; import org.springframework.cloud.release.internal.git.ProjectGitHandler; +import org.springframework.cloud.release.internal.gradle.GradleUpdater; import org.springframework.cloud.release.internal.pom.ProjectPomUpdater; import org.springframework.cloud.release.internal.pom.ProjectVersion; import org.springframework.cloud.release.internal.pom.Projects; +import org.springframework.cloud.release.internal.post.PostReleaseActions; import org.springframework.cloud.release.internal.project.ProjectBuilder; +import org.springframework.cloud.release.internal.sagan.SaganUpdater; +import org.springframework.cloud.release.internal.tech.MakeBuildUnstableException; +import org.springframework.cloud.release.internal.template.TemplateGenerator; import org.springframework.util.Assert; /** @@ -199,6 +201,7 @@ public class Releaser { log.info("\nSuccessfully updated Sagan for branch [{}]", currentBranch); } catch (Exception ex) { log.error("\n\n[BUILD UNSTABLE] WARNING! FAILED TO UPDATE SAGAN, DUE TO THE FOLLOWING EXCEPTION", ex); + throw new MakeBuildUnstableException(ex); } } diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java index a260c284..437cfc1e 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GitRepo.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GitRepo.java index 910bee8f..bc2c310d 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GitRepo.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/git/GitRepo.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/BomParser.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/BomParser.java index 83e243b1..9a2b0f90 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/BomParser.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/BomParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomReader.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomReader.java index 594aaae5..e9654e8c 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomReader.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomUpdater.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomUpdater.java index 9d7c6bf4..f51b9540 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomUpdater.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/PomUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/ProjectPomUpdater.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/ProjectPomUpdater.java index e86100b3..f88294d8 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/ProjectPomUpdater.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/ProjectPomUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/SpringCloudConstants.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/SpringCloudConstants.java index 99bc04ab..0fc8e70e 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/SpringCloudConstants.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/SpringCloudConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/Versions.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/Versions.java index 699ced8c..51ded225 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/Versions.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/pom/Versions.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/tech/MakeBuildUnstableException.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/tech/MakeBuildUnstableException.java new file mode 100644 index 00000000..19c0b1be --- /dev/null +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/tech/MakeBuildUnstableException.java @@ -0,0 +1,28 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * 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 org.springframework.cloud.release.internal.tech; + +/** + * Exception to be thrown if one wants to continue with the build + * and throw this exception at the end of the release + */ +public class MakeBuildUnstableException extends RuntimeException { + + public MakeBuildUnstableException(Throwable cause) { + super(cause); + } +} diff --git a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomReaderTests.java b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomReaderTests.java index ecdd44e3..aae406e3 100644 --- a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomReaderTests.java +++ b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomUpdaterTests.java b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomUpdaterTests.java index dc1e38a5..5b5b56bf 100644 --- a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomUpdaterTests.java +++ b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/PomUpdaterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/VersionsTests.java b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/VersionsTests.java index 7d046e4b..7e26c75b 100644 --- a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/VersionsTests.java +++ b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/pom/VersionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2017 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-release-tools-core/src/test/resources/projects/project/children/pom.xml b/spring-cloud-release-tools-core/src/test/resources/projects/project/children/pom.xml index 039b9bf6..22fadf05 100644 --- a/spring-cloud-release-tools-core/src/test/resources/projects/project/children/pom.xml +++ b/spring-cloud-release-tools-core/src/test/resources/projects/project/children/pom.xml @@ -1,6 +1,6 @@