Split version updates into two steps to fix antora docs generation

This commit is contained in:
Ryan Baxter
2024-07-18 11:34:20 -04:00
parent b896a862c2
commit 5b120ae04c
185 changed files with 9111 additions and 22 deletions

View File

@@ -33,12 +33,16 @@ public class AbstractSpringCloudAcceptanceTests extends AbstractSpringAcceptance
public File springCloudBuildProject;
public File springCloudBusProject;
@BeforeEach
public void setupCloud() throws Exception {
this.springCloudConsulProject = new File(
AbstractSpringAcceptanceTests.class.getResource("/projects/spring-cloud-consul").toURI());
this.springCloudBuildProject = new File(
AbstractSpringAcceptanceTests.class.getResource("/projects/spring-cloud-build").toURI());
this.springCloudBusProject = new File(
AbstractSpringAcceptanceTests.class.getResource("/projects/spring-cloud-bus").toURI());
TestUtils.prepareLocalRepo();
FileSystemUtils.copyRecursively(file("/projects/"), this.temporaryFolder);
}

View File

@@ -100,7 +100,7 @@ public class SpringMetaReleaseAcceptanceTests extends AbstractSpringCloudMetaAcc
.properties("test.metarelease=true", "releaser.git.create-release-notes-for-milestone=false")
.properties(metaReleaseArgs(project, tempDirTestSamplesProject, tempDirReleaseTrainDocs,
tempDirSpringCloud, tempDirReleaseTrainWiki, tempDirAllTestSample).bomBranch("v2022.0.2")
.addFixedVersions(v2022_0_4()).distributeReleaseTrainSourceReleaseBundle(true)
.addFixedVersions(v2022_0_6()).distributeReleaseTrainSourceReleaseBundle(true)
.releaseTrainSourceReleaseBundle(true).projectReleaseBundle(true).commercial(true)
.build()),
context -> {
@@ -131,12 +131,12 @@ public class SpringMetaReleaseAcceptanceTests extends AbstractSpringCloudMetaAcc
thenUpdateReleaseTrainDocsWasCalled(postReleaseActions);
BDDMockito.then(creator).should(times(1))
.createReleaseTrainSourceBundle(List.of(new ProjectVersion("spring-cloud-consul", "4.0.2"),
new ProjectVersion("spring-cloud-starter-build", "2022.0.4")), "2022.0.4");
new ProjectVersion("spring-cloud-starter-build", "2022.0.6")), "2022.0.6");
BDDMockito.then(creator).should(times(1)).createReleaseBundle(
List.of("org/springframework/cloud/spring-cloud-consul*",
"org/springframework/cloud/spring-cloud-starter-consul*"),
"4.0.2", "TNZ-spring-cloud-consul-commercial");
BDDMockito.then(creator).should(times(1)).distributeReleaseTrainSourceBundle("2022.0.4");
BDDMockito.then(creator).should(times(1)).distributeReleaseTrainSourceBundle("2022.0.6");
// This should never be called when releasing a release train since
// distributing a release train source bundle
// will distribute individual project release bundles
@@ -158,7 +158,7 @@ public class SpringMetaReleaseAcceptanceTests extends AbstractSpringCloudMetaAcc
.properties("test.metarelease=true", "releaser.git.create-release-notes-for-milestone=false")
.properties(metaReleaseArgsForParallel(project, tempDirTestSamplesProject, tempDirReleaseTrainDocs,
tempDirSpringCloud, tempDirReleaseTrainWiki, tempDirAllTestSample).bomBranch("v2022.0.2")
.addFixedVersions(v2022_0_4())
.addFixedVersions(v2022_0_6())
.metaReleaseGroups("example1,example2",
"spring-cloud-build,spring-cloud-consul,spring-cloud-release")
.build()),
@@ -207,7 +207,7 @@ public class SpringMetaReleaseAcceptanceTests extends AbstractSpringCloudMetaAcc
properties("debugx=true").properties("test.metarelease=true")
.properties(metaReleaseArgs(project, tempDirTestSamplesProject, tempDirReleaseTrainDocs,
tempDirSpringCloud, tempDirReleaseTrainWiki, tempDirAllTestSample)
.bomBranch("v2022.0.2").addFixedVersions(v2022_0_4()).build()),
.bomBranch("v2022.0.2").addFixedVersions(v2022_0_6()).build()),
context -> {
SpringReleaser releaser = context.getBean(SpringReleaser.class);
NonAssertingTestProjectGitHandler nonAssertingTestProjectGitHandler = context
@@ -375,7 +375,7 @@ public class SpringMetaReleaseAcceptanceTests extends AbstractSpringCloudMetaAcc
"releaser.flow.default-enabled=false")
.properties(metaReleaseArgs(project, tempDirTestSamplesProject, tempDirReleaseTrainDocs,
tempDirSpringCloud, tempDirReleaseTrainWiki, tempDirAllTestSample)
.bomBranch("v2022.0.2").addFixedVersions(v2022_0_4()).build()),
.bomBranch("v2022.0.2").addFixedVersions(v2022_0_6()).build()),
context -> {
SpringReleaser releaser = context.getBean(SpringReleaser.class);
NonAssertingTestProjectGitHandler nonAssertingTestProjectGitHandler = context

View File

@@ -136,6 +136,7 @@ public class SpringSingleProjectAcceptanceTests extends AbstractSpringCloudAccep
Iterable<RevCommit> commits = listOfCommits(project);
Iterator<RevCommit> iterator = commits.iterator();
tagIsPresentInOrigin(origin, "v4.0.2");
commitIsPresent(iterator, "Bumping dependency versions after release");
commitIsPresent(iterator, "Bumping versions to 4.0.3-SNAPSHOT after release");
commitIsPresent(iterator, "Going back to snapshots");
commitIsPresent(iterator, "Update SNAPSHOT to 4.0.2");
@@ -169,6 +170,71 @@ public class SpringSingleProjectAcceptanceTests extends AbstractSpringCloudAccep
});
}
// This test verifies that the actual antora documentation generation actually works
// during a release.
// We use Spring Cloud Bus as an example project and override the test antora build
// and sync commands in the ArgsBuilder
// configuration. The anotra command is the actual antora command to build the docs.
// The docs sync command checks that the index.html
// file for the release and the snapshot exist.
@Test
public void should_perform_a_release_of_sc_bus(@TempDir File tempDirSpringCloudBusOrigin,
@TempDir File tempDirSpringCloudBusProject) throws Exception {
checkoutReleaseTrainBranch("/projects/spring-cloud-release/", "v2023.0.3");
File origin = cloneToTemporaryDirectory(tempDirSpringCloudBusOrigin, this.springCloudBusProject);
pomVersionIsEqualTo(origin, "4.1.2-SNAPSHOT");
pomParentVersionIsEqualTo(origin, "spring-cloud-bus-dependencies", "4.1.3-SNAPSHOT");
File project = cloneToTemporaryDirectory(tempDirSpringCloudBusProject, tmpFile("spring-cloud-bus"));
GitTestUtils.setOriginOnProjectToTmp(origin, project);
run(this.runner, properties("debugx=true").properties(new ArgsBuilder(project, tempDirTestSamplesProject,
tempDirReleaseTrainDocs, tempDirSpringCloud, tempDirReleaseTrainWiki, tempDirAllTestSample)
.releaseTrainUrl("/projects/spring-cloud-release/").bomBranch("v2023.0.3")
.projectName("spring-cloud-bus").expectedVersion("4.1.2")
.antoraCommand("./mvnw clean antora -Pdocs")
.syncAntoraDocsCommand(
"[ -f {{site-path}}/index.html ] && [ -f {{site-path}}/4.1-SNAPSHOT/index.html ]")
.build()),
context -> {
SpringReleaser releaser = context.getBean(SpringReleaser.class);
TestProjectGitHubHandler gitHubHandler = context.getBean(TestProjectGitHubHandler.class);
SaganClient saganClient = context.getBean(SaganClient.class);
PostReleaseActions postReleaseActions = context.getBean(PostReleaseActions.class);
TestExecutionResultHandler testExecutionResultHandler = context
.getBean(TestExecutionResultHandler.class);
ExecutionResult result = releaser.release(new OptionsBuilder().interactive(true).options());
Iterable<RevCommit> commits = listOfCommits(project);
Iterator<RevCommit> iterator = commits.iterator();
then(GitTestUtils.openGitProject(origin).tagList().call().stream()
.anyMatch(r -> r.getName().equals("refs/tags/v4.1.2"))).isTrue();
commitIsPresent(iterator, "Bumping dependency versions after release");
commitIsPresent(iterator, "Bumping versions to 4.1.3-SNAPSHOT after release");
commitIsPresent(iterator, "Going back to snapshots");
commitIsPresent(iterator, "Update SNAPSHOT to 4.1.2");
pomVersionIsEqualTo(project, "4.1.3-SNAPSHOT");
pomParentVersionIsEqualTo(project, "spring-cloud-bus-dependencies", "4.1.4-SNAPSHOT");
then(gitHubHandler.closedMilestones).isTrue();
then(emailTemplate()).doesNotExist();
then(blogTemplate()).doesNotExist();
then(tweetTemplate()).doesNotExist();
then(releaseNotesTemplate()).doesNotExist();
// once for updating GA
// second time to update SNAPSHOT
BDDMockito.then(saganClient).should(times(2)).addRelease(BDDMockito.eq("spring-cloud-bus"),
BDDMockito.any());
BDDMockito.then(saganClient).should().deleteRelease("spring-cloud-bus", "4.1.2-SNAPSHOT");
then(gitHubHandler.issueCreatedInSpringGuides).isFalse();
then(gitHubHandler.issueCreatedInStartSpringIo).isFalse();
thenRunUpdatedTestsWereNotCalled(postReleaseActions);
// print results
testExecutionResultHandler.accept(result);
then(testExecutionResultHandler.exitedSuccessOrUnstable).isTrue();
});
}
// issue #74
@Test
public void should_perform_a_release_of_sc_build(@TempDir File tempDirSpringCloudConsulOrigin,
@@ -198,6 +264,7 @@ public class SpringSingleProjectAcceptanceTests extends AbstractSpringCloudAccep
Iterator<RevCommit> iterator = commits.iterator();
tagIsPresentInOrigin(origin, "v2.1.6.RELEASE");
// we're running against camden sc-release
commitIsPresent(iterator, "Bumping dependency versions after release");
commitIsPresent(iterator, "Bumping versions to 2.1.7.SNAPSHOT after release");
commitIsPresent(iterator, "Going back to snapshots");
commitIsPresent(iterator, "Update SNAPSHOT to 2.1.6.RELEASE");

View File

@@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2

View File

@@ -0,0 +1,45 @@
# Contributing
Spring Cloud is released under the non-restrictive Apache 2.0 license,
and follows a very standard Github development process, using Github
tracker for issues and merging pull requests into master. If you want
to contribute even something trivial please do not hesitate, but
follow the guidelines below.
## Sign the Contributor License Agreement
Before we accept a non-trivial patch or pull request we will need you to sign the
[Contributor License Agreement](https://cla.pivotal.io/sign/spring).
Signing the contributor's agreement does not grant anyone commit rights to the main
repository, but it does mean that we can accept your contributions, and you will get an
author credit if we do. Active contributors might be asked to join the core team, and
given the ability to merge pull requests.
## Code of Conduct
This project adheres to the Contributor Covenant [code of
conduct](https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc). By participating, you are expected to uphold this code. Please report
unacceptable behavior to spring-code-of-conduct@pivotal.io.
## Code Conventions and Housekeeping
None of these is essential for a pull request, but they will all help. They can also be
added after the original pull request but before a merge.
* Use the Spring Framework code format conventions. If you use Eclipse
you can import formatter settings using the
`eclipse-code-formatter.xml` file from the
[Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the
[Eclipse Code Formatter Plugin](https://plugins.jetbrains.com/plugin/6546) to import the same file.
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
`@author` tag identifying you, and preferably at least a paragraph on what the class is
for.
* Add the ASF license header comment to all new `.java` files (copy from existing files
in the project)
* Add yourself as an `@author` to the .java files that you modify substantially (more
than cosmetic changes).
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
* A few unit tests would help a lot as well -- someone has to do it.
* If no-one else is using your branch, please rebase it against the current master (or
other target branch in the main project).
* When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
message (where XXXX is the issue number).

View File

@@ -0,0 +1,20 @@
<!--
Thanks for raising a Spring Cloud issue. What sort of issue are you raising?
Question
Please ask questions about how to use something, or to understand why something isn't
working as you expect it to, on Stack Overflow using the spring-cloud tag.
Bug report
Please provide details of the problem, including the version of Spring Cloud that you
are using. If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.
Enhancement
Please start by describing the problem that you are trying to solve. There may already
be a solution, or there may be a way to solve it that you hadn't considered.
-->

View File

@@ -0,0 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
Please provide details of the problem, including the version of Spring Cloud that you
are using.
**Sample**
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,32 @@
name: Deploy Docs
on:
push:
branches-ignore: [ gh-pages ]
tags: '**'
repository_dispatch:
types: request-build-reference # legacy
#schedule:
#- cron: '0 10 * * *' # Once per day at 10am UTC
workflow_dispatch:
permissions:
actions: write
jobs:
build:
runs-on: ubuntu-latest
# if: github.repository_owner == 'spring-cloud'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: docs-build
fetch-depth: 1
- name: Dispatch (partial build)
if: github.ref_type == 'branch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }}
- name: Dispatch (full build)
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD)

View File

@@ -0,0 +1,38 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build
on:
push:
branches: [ main, 3.1.x ]
pull_request:
branches: [ main, 3.1.x ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: ./mvnw -s .settings.xml clean org.jacoco:jacoco-maven-plugin:prepare-agent install -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
if: always() # always run even if the previous step fails
with:
report_paths: '**/surefire-reports/TEST-*.xml'
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: surefire-reports
path: '**/surefire-reports/*'

View File

@@ -0,0 +1,26 @@
*~
#*
*#
.#*
.classpath
.project
.settings
.springBeans
.gradle
build
bin
target/
_site/
*.swp
.idea
*.iml
.factorypath
.vscode/
.flattened-pom.xml
node
node_modules
build
/package.json
package-lock.json

View File

@@ -0,0 +1 @@
-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom

View File

@@ -0,0 +1,117 @@
/*
* Copyright 2007-present 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.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

View File

@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers>
<server>
<id>repo.spring.io</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<!--
N.B. this profile is only here to support users and IDEs that do not use Maven 3.3.
It isn't needed on the command line if you use the wrapper script (mvnw) or if you use
a native Maven with the right version. Eclipse users should points their Maven tooling to
this settings file, or copy the profile into their ~/.m2/settings.xml.
-->
<id>spring</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>

View File

@@ -0,0 +1,12 @@
require 'asciidoctor'
require 'erb'
require './src/main/ruby/readme.rb'
options = {:mkdirs => true, :safe => :unsafe, :attributes => ['linkcss', 'allow-uri-read']}
guard 'shell' do
watch(/^src\/[A-Z-a-z][^#]*\.adoc$/) {|m|
SpringCloud::Build.render_file('src/main/asciidoc/README.adoc', :to_file => './README.adoc')
Asciidoctor.render_file('src/main/asciidoc/spring-cloud-bus.adoc', options.merge(:to_dir => 'target/generated-docs'))
}
end

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
https://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.

View File

@@ -0,0 +1,349 @@
////
DO NOT EDIT THIS FILE. IT WAS GENERATED.
Manual changes to this file will be lost when it is generated again.
Edit the files in the src/main/asciidoc/ directory instead.
////
[[spring-cloud-bus]]
= Spring Cloud Bus
:page-section-summary-toc: 1
[[quick-start]]
== Quick Start
[[building]]
== Building
:jdkversion: 17
[[basic-compile-and-test]]
== Basic Compile and Test
To build the source you will need to install JDK {jdkversion}.
Spring Cloud uses Maven for most build-related activities, and you
should be able to get off the ground quite quickly by cloning the
project you are interested in and typing
----
$ ./mvnw install
----
NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command
in place of `./mvnw` in the examples below. If you do that you also
might need to add `-P spring` if your local Maven settings do not
contain repository declarations for spring pre-release artifacts.
NOTE: Be aware that you might need to increase the amount of memory
available to Maven by setting a `MAVEN_OPTS` environment variable with
a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in
the `.mvn` configuration, so if you find you have to do it to make a
build succeed, please raise a ticket to get the settings added to
source control.
The projects that require middleware (i.e. Redis) for testing generally
require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running.
[[documentation]]
== Documentation
The spring-cloud-build module has a "docs" profile, and if you switch
that on it will try to build asciidoc sources using https://docs.antora.org/antora/latest/[Antora] from
`modules/ROOT/`.
As part of that process it will look for a
`docs/src/main/asciidoc/README.adoc` and process it by loading all the includes, but not
parsing or rendering it, just copying it to `${main.basedir}`
(defaults to `$\{basedir}`, i.e. the root of the project). If there are
any changes in the README it will then show up after a Maven build as
a modified file in the correct place. Just commit it and push the change.
[[working-with-the-code]]
== Working with the code
If you don't have an IDE preference we would recommend that you use
https://www.springsource.com/developer/sts[Spring Tools Suite] or
https://eclipse.org[Eclipse] when working with the code. We use the
https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools
should also work without issue as long as they use Maven 3.3.3 or better.
[[activate-the-spring-maven-profile]]
=== Activate the Spring Maven profile
Spring Cloud projects require the 'spring' Maven profile to be activated to resolve
the spring milestone and snapshot repositories. Use your preferred IDE to set this
profile to be active, or you may experience build errors.
[[importing-into-eclipse-with-m2eclipse]]
=== Importing into eclipse with m2eclipse
We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
marketplace".
NOTE: Older versions of m2e do not support Maven 3.3, so once the
projects are imported into Eclipse you will also need to tell
m2eclipse to use the right profile for the projects. If you
see many different errors related to the POMs in the projects, check
that you have an up to date installation. If you can't upgrade m2e,
add the "spring" profile to your `settings.xml`. Alternatively you can
copy the repository settings from the "spring" profile of the parent
pom into your `settings.xml`.
[[importing-into-eclipse-without-m2eclipse]]
=== Importing into eclipse without m2eclipse
If you prefer not to use m2eclipse you can generate eclipse project metadata using the
following command:
[indent=0]
----
$ ./mvnw eclipse:eclipse
----
The generated eclipse projects can be imported by selecting `import existing projects`
from the `file` menu.
[[contributing]]
== Contributing
:spring-cloud-build-branch: main
Spring Cloud is released under the non-restrictive Apache 2.0 license,
and follows a very standard Github development process, using Github
tracker for issues and merging pull requests into main. If you want
to contribute even something trivial please do not hesitate, but
follow the guidelines below.
[[sign-the-contributor-license-agreement]]
== Sign the Contributor License Agreement
Before we accept a non-trivial patch or pull request we will need you to sign the
https://cla.pivotal.io/sign/spring[Contributor License Agreement].
Signing the contributor's agreement does not grant anyone commit rights to the main
repository, but it does mean that we can accept your contributions, and you will get an
author credit if we do. Active contributors might be asked to join the core team, and
given the ability to merge pull requests.
[[code-of-conduct]]
== Code of Conduct
This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/main/docs/src/main/asciidoc/code-of-conduct.adoc[code of
conduct]. By participating, you are expected to uphold this code. Please report
unacceptable behavior to spring-code-of-conduct@pivotal.io.
[[code-conventions-and-housekeeping]]
== Code Conventions and Housekeeping
None of these is essential for a pull request, but they will all help. They can also be
added after the original pull request but before a merge.
* Use the Spring Framework code format conventions. If you use Eclipse
you can import formatter settings using the
`eclipse-code-formatter.xml` file from the
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
Cloud Build] project. If using IntelliJ, you can use the
https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter
Plugin] to import the same file.
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
`@author` tag identifying you, and preferably at least a paragraph on what the class is
for.
* Add the ASF license header comment to all new `.java` files (copy from existing files
in the project)
* Add yourself as an `@author` to the .java files that you modify substantially (more
than cosmetic changes).
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
* A few unit tests would help a lot as well -- someone has to do it.
* If no-one else is using your branch, please rebase it against the current main (or
other target branch in the main project).
* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
message (where XXXX is the issue number).
[[checkstyle]]
== Checkstyle
Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are:
.spring-cloud-build-tools/
----
└── src
   ├── checkstyle
   │   └── checkstyle-suppressions.xml <3>
   └── main
   └── resources
   ├── checkstyle-header.txt <2>
   └── checkstyle.xml <1>
----
<1> Default Checkstyle rules
<2> File header setup
<3> Default suppression rules
[[checkstyle-configuration]]
=== Checkstyle configuration
Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins.
.pom.xml
----
<properties>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <1>
<maven-checkstyle-plugin.failsOnViolation>true
</maven-checkstyle-plugin.failsOnViolation> <2>
<maven-checkstyle-plugin.includeTestSourceDirectory>true
</maven-checkstyle-plugin.includeTestSourceDirectory> <3>
</properties>
<build>
<plugins>
<plugin> <4>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
</plugin>
<plugin> <5>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
<reporting>
<plugins>
<plugin> <5>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</build>
----
<1> Fails the build upon Checkstyle errors
<2> Fails the build upon Checkstyle violations
<3> Checkstyle analyzes also the test sources
<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules
<5> Add checkstyle plugin to your build and reporting phases
If you need to suppress some rules (e.g. line length needs to be longer), then it's enough for you to define a file under `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example:
.projectRoot/src/checkstyle/checkstyle-suppresions.xml
----
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
</suppressions>
----
It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script:
```bash
$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
$ touch .springformat
```
[[ide-setup]]
== IDE setup
[[intellij-idea]]
=== Intellij IDEA
In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.
The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/main/spring-cloud-build-tools[Spring Cloud Build] project.
.spring-cloud-build-tools/
----
└── src
   ├── checkstyle
   │   └── checkstyle-suppressions.xml <3>
   └── main
   └── resources
   ├── checkstyle-header.txt <2>
   ├── checkstyle.xml <1>
   └── intellij
      ├── Intellij_Project_Defaults.xml <4>
      └── Intellij_Spring_Boot_Java_Conventions.xml <5>
----
<1> Default Checkstyle rules
<2> File header setup
<3> Default suppression rules
<4> Project defaults for Intellij that apply most of Checkstyle rules
<5> Project style conventions for Intellij that apply most of Checkstyle rules
.Code style
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-code-style.png[Code style]
Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file.
.Inspection profiles
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-inspections.png[Code style]
Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file.
.Checkstyle
To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-checkstyle.png[Checkstyle]
Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` section. There, you'll have to define where the checkstyle rules should be picked from. In the image above, we've picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build's GitHub repository (e.g. for the `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables:
- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL.
- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL.
- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`.
IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources.
[[duplicate-finder]]
== Duplicate Finder
Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath.
[[duplicate-finder-configuration]]
=== Duplicate Finder configuration
Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the projecst's `pom.xml`.
.pom.xml
[source,xml]
----
<build>
<plugins>
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
----
For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation].
You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build.
If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project:
[source,xml]
----
<build>
<plugins>
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
<configuration>
<ignoredClassPatterns>
<ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
<ignoredClassPattern>.*module-info</ignoredClassPattern>
</ignoredClassPatterns>
<ignoredResourcePatterns>
<ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
</ignoredResourcePatterns>
</configuration>
</plugin>
</plugins>
</build>
----

View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
To report security vulnerabilities, please go to https://pivotal.io/security.

View File

@@ -0,0 +1,33 @@
antora:
extensions:
- require: '@springio/antora-extensions'
root_component_name: 'cloud-bus'
site:
title: Spring Cloud Bus
url: https://docs.spring.io/spring-cloud-bus/reference/
content:
sources:
- url: ./..
branches: HEAD
start_path: docs
worktrees: true
asciidoc:
attributes:
page-stackoverflow-url: https://stackoverflow.com/tags/spring-cloud
page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
chomp: 'all'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
sourcemap: true
urls:
latest_version_segment: ''
runtime:
log:
failure_level: warn
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.15/ui-bundle.zip

View File

@@ -0,0 +1,12 @@
name: cloud-bus
version: true
title: spring-cloud-bus
nav:
- modules/ROOT/nav.adoc
ext:
collector:
run:
command: ./mvnw --no-transfer-progress -B process-resources -Pdocs -pl docs -Dantora-maven-plugin.phase=none -Dgenerate-docs.phase=none -Dgenerate-readme.phase=none -Dgenerate-cloud-resources.phase=none -Dmaven-dependency-plugin-for-docs.phase=none -Dmaven-dependency-plugin-for-docs-classes.phase=none -DskipTests
local: true
scan:
dir: ./target/classes/antora-resources/

View File

@@ -0,0 +1,8 @@
* xref:index.adoc[]
* xref:quickstart.adoc[]
* xref:spring-cloud-bus.adoc[]
** xref:spring-cloud-bus/bus-endpoints.adoc[]
** xref:spring-cloud-bus/addressing.adoc[]
** xref:spring-cloud-bus/configuration.adoc[]
** xref:spring-cloud-bus/custom-events.adoc[]
* xref:appendix.adoc[]

View File

@@ -0,0 +1,13 @@
:doctype: book
:idprefix:
:idseparator: -
:tabsize: 4
:numbered:
:sectanchors:
:sectnums:
:icons: font
:hide-uri-scheme:
:docinfo: shared,private
:sc-ext: java
:project-full-name: Spring Cloud Bus

View File

@@ -0,0 +1,14 @@
:numbered!:
[appendix]
[[common-application-properties]]
= Common application properties
:page-section-summary-toc: 1
Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches.
This appendix provides a list of common Spring Cloud Bus properties and references to the underlying classes that consume them.
NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list.
Also, you can define your own properties.
include::partial$_configprops.adoc[]

View File

@@ -0,0 +1,6 @@
[[configuration-properties]]
= Configuration Properties
Below you can find a list of configuration properties.
include::partial$_configprops.adoc[]

View File

@@ -0,0 +1,9 @@
[[spring-cloud-bus-intro]]
= Introduction
Spring Cloud Bus links the nodes of a distributed system with a lightweight message
broker. This broker can then be used to broadcast state changes (such as configuration
changes) or other management instructions. A key idea is that the bus is like a
distributed actuator for a Spring Boot application that is scaled out. However, it can
also be used as a communication channel between apps. This project provides starters for
either an AMQP broker or Kafka as the transport.

View File

@@ -0,0 +1,31 @@
[[spring-cloud-gateway-quickstart]]
= Quickstart
Spring Cloud Bus works by adding Spring Boot autconfiguration if it detects itself on the
classpath. To enable the bus, add `spring-cloud-starter-bus-amqp` or
`spring-cloud-starter-bus-kafka` to your dependency management. Spring Cloud takes care of
the rest. Make sure the broker (RabbitMQ or Kafka) is available and configured. When
running on localhost, you need not do anything. If you run remotely, use Spring Cloud
Connectors or Spring Boot conventions to define the broker credentials, as shown in the
following example for Rabbit:
.application.yml
----
spring:
rabbitmq:
host: mybroker.com
port: 5672
username: user
password: secret
----
The bus currently supports sending messages to all nodes listening or all nodes for a
particular service (as defined by Eureka). The `/bus/*` actuator namespace has some HTTP
endpoints. Currently, two are implemented. The first, `/bus/env`, sends key/value pairs to
update each node's Spring Environment. The second, `/bus/refresh`, reloads each
application's configuration, as though they had all been pinged on their `/refresh`
endpoint.
NOTE: The Spring Cloud Bus starters cover Rabbit and Kafka, because those are the two most
common implementations. However, Spring Cloud Stream is quite flexible, and the binder
works with `spring-cloud-bus`.

View File

@@ -0,0 +1,5 @@
[[spring-cloud-bus]]
= Spring Cloud Bus
:page-section-summary-toc: 1
*{spring-cloud-version}*

View File

@@ -0,0 +1,43 @@
[[addressing]]
= Addressing Instances
:page-section-summary-toc: 1
[[addressing-an-instance]]
== Addressing an Instance
Each instance of the application has a service ID, whose value can be set with
`spring.cloud.bus.id` and whose value is expected to be a colon-separated list of
identifiers, in order from least specific to most specific. The default value is
constructed from the environment as a combination of the `spring.application.name` and
`server.port` (or `spring.application.index`, if set). The default value of the ID is
constructed in the form of `app:index:id`, where:
* `app` is the `vcap.application.name`, if it exists, or `spring.application.name`
* `index` is the `vcap.application.instance_index`, if it exists,
`spring.application.index`, `local.server.port`, `server.port`, or `0` (in that order).
* `id` is the `vcap.application.instance_id`, if it exists, or a random value.
The HTTP endpoints accept a "`destination`" path parameter, such as
`/busrefresh/customers:9000`, where `destination` is a service ID. If the ID
is owned by an instance on the bus, it processes the message, and all other instances
ignore it.
[[addressing-all-instances-of-a-service]]
== Addressing All Instances of a Service
The "`destination`" parameter is used in a Spring `PathMatcher` (with the path separator
as a colon -- `:`) to determine if an instance processes the message. Using the example
from earlier, `/busenv/customers:**` targets all instances of the
"`customers`" service regardless of the rest of the service ID.
[[service-id-must-be-unique]]
== Service ID Must Be Unique
The bus tries twice to eliminate processing an event -- once from the original
`ApplicationEvent` and once from the queue. To do so, it checks the sending service ID
against the current service ID. If multiple instances of a service have the same ID,
events are not processed. When running on a local machine, each service is on a different
port, and that port is part of the ID. Cloud Foundry supplies an index to differentiate.
To ensure that the ID is unique outside Cloud Foundry, set `spring.application.index` to
something unique for each instance of a service.

View File

@@ -0,0 +1,44 @@
[[bus-endpoints]]
= Bus Endpoints
:page-section-summary-toc: 1
Spring Cloud Bus provides two endpoints, `/actuator/busrefresh` and `/actuator/busenv`
that correspond to individual actuator endpoints in Spring Cloud Commons,
`/actuator/refresh` and `/actuator/env` respectively.
[[bus-refresh-endpoint]]
== Bus Refresh Endpoint
The `/actuator/busrefresh` endpoint clears the `RefreshScope` cache and rebinds
`@ConfigurationProperties`. See the <<refresh-scope,Refresh Scope>> documentation for
more information.
To expose the `/actuator/busrefresh` endpoint, you need to add following configuration to your
application:
[source,properties]
----
management.endpoints.web.exposure.include=busrefresh
----
[[bus-env-endpoint]]
== Bus Env Endpoint
The `/actuator/busenv` endpoint updates each instances environment with the specified
key/value pair across multiple instances.
To expose the `/actuator/busenv` endpoint, you need to add following configuration to your
application:
[source,properties]
----
management.endpoints.web.exposure.include=busenv
----
The `/actuator/busenv` endpoint accepts `POST` requests with the following shape:
[source,json]
----
{
"name": "key1",
"value": "value1"
}
----

View File

@@ -0,0 +1,76 @@
[[configuration]]
= Configuration
:page-section-summary-toc: 1
[[customizing-the-message-broker]]
== Customizing the Message Broker
Spring Cloud Bus uses https://cloud.spring.io/spring-cloud-stream[Spring Cloud Stream] to
broadcast the messages. So, to get messages to flow, you need only include the binder
implementation of your choice in the classpath. There are convenient starters for the bus
with AMQP (RabbitMQ) and Kafka (`spring-cloud-starter-bus-[amqp|kafka]`). Generally
speaking, Spring Cloud Stream relies on Spring Boot autoconfiguration conventions for
configuring middleware. For instance, the AMQP broker address can be changed with
`spring.rabbitmq.{asterisk}` configuration properties. Spring Cloud Bus has a handful of
native configuration properties in `spring.cloud.bus.{asterisk}` (for example,
`spring.cloud.bus.destination` is the name of the topic to use as the external
middleware). Normally, the defaults suffice.
To learn more about how to customize the message broker settings, consult the Spring Cloud
Stream documentation.
[[tracing-bus-events]]
== Tracing Bus Events
Bus events (subclasses of `RemoteApplicationEvent`) can be traced by setting
`spring.cloud.bus.trace.enabled=true`. If you do so, the Spring Boot `TraceRepository`
(if it is present) shows each event sent and all the acks from each service instance. The
following example comes from the `/trace` endpoint:
[source,json]
----
{
"timestamp": "2015-11-26T10:24:44.411+0000",
"info": {
"signal": "spring.cloud.bus.ack",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "stores:8081",
"destination": "*:**"
}
},
{
"timestamp": "2015-11-26T10:24:41.864+0000",
"info": {
"signal": "spring.cloud.bus.sent",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "customers:9000",
"destination": "*:**"
}
},
{
"timestamp": "2015-11-26T10:24:41.862+0000",
"info": {
"signal": "spring.cloud.bus.ack",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "customers:9000",
"destination": "*:**"
}
}
----
The preceding trace shows that a `RefreshRemoteApplicationEvent` was sent from
`customers:9000`, broadcast to all services, and received (acked) by `customers:9000` and
`stores:8081`.
To handle the ack signals yourself, you could add an `@EventListener` for the
`AckRemoteApplicationEvent` and `SentApplicationEvent` types to your app (and enable
tracing). Alternatively, you could tap into the `TraceRepository` and mine the data from
there.
NOTE: Any Bus application can trace acks. However, sometimes, it is
useful to do this in a central service that can do more complex
queries on the data or forward it to a specialized tracing service.

View File

@@ -0,0 +1,76 @@
[[custom-events]]
= Custom Events
:page-section-summary-toc: 1
[[broadcasting-your-own-events]]
== Broadcasting Your Own Events
The Bus can carry any event of type `RemoteApplicationEvent`. The default transport is
JSON, and the deserializer needs to know which types are going to be used ahead of time.
To register a new type, you must put it in a subpackage of
`org.springframework.cloud.bus.event`.
To customise the event name, you can use `@JsonTypeName` on your custom class or rely on
the default strategy, which is to use the simple name of the class.
NOTE: Both the producer and the consumer need access to the class definition.
[[registering-events-in-custom-packages]]
=== Registering events in custom packages
If you cannot or do not want to use a subpackage of `org.springframework.cloud.bus.event`
for your custom events, you must specify which packages to scan for events of type
`RemoteApplicationEvent` by using the `@RemoteApplicationEventScan` annotation. Packages
specified with `@RemoteApplicationEventScan` include subpackages.
For example, consider the following custom event, called `MyEvent`:
[source,java]
----
package com.acme;
public class MyEvent extends RemoteApplicationEvent {
...
}
----
You can register that event with the deserializer in the following way:
[source,java]
----
package com.acme;
@Configuration
@RemoteApplicationEventScan
public class BusConfiguration {
...
}
----
Without specifying a value, the package of the class where `@RemoteApplicationEventScan`
is used is registered. In this example, `com.acme` is registered by using the package of
`BusConfiguration`.
You can also explicitly specify the packages to scan by using the `value`, `basePackages`
or `basePackageClasses` properties on `@RemoteApplicationEventScan`, as shown in the
following example:
[source,java]
----
package com.acme;
@Configuration
//@RemoteApplicationEventScan({"com.acme", "foo.bar"})
//@RemoteApplicationEventScan(basePackages = {"com.acme", "foo.bar", "fizz.buzz"})
@RemoteApplicationEventScan(basePackageClasses = BusConfiguration.class)
public class BusConfiguration {
...
}
----
All of the preceding examples of `@RemoteApplicationEventScan` are equivalent, in that the
`com.acme` package is registered by explicitly specifying the packages on
`@RemoteApplicationEventScan`.
NOTE: You can specify multiple base packages to scan.

View File

@@ -0,0 +1,14 @@
|===
|Name | Default | Description
|spring.cloud.bus.ack.destination-service | | Service that wants to listen to acks. By default null (meaning all services).
|spring.cloud.bus.ack.enabled | `+++true+++` | Flag to switch off acks (default on).
|spring.cloud.bus.content-type | | The bus mime-type.
|spring.cloud.bus.destination | | Name of Spring Cloud Stream destination for messages.
|spring.cloud.bus.enabled | `+++true+++` | Flag to indicate that the bus is enabled.
|spring.cloud.bus.env.enabled | `+++true+++` | Flag to switch off environment change events (default on).
|spring.cloud.bus.id | `+++application+++` | The identifier for this application instance.
|spring.cloud.bus.refresh.enabled | `+++true+++` | Flag to switch off refresh events (default on).
|spring.cloud.bus.trace.enabled | `+++false+++` | Flag to switch on tracing of acks (default off).
|===

View File

@@ -0,0 +1,10 @@
{
"dependencies": {
"antora": "3.2.0-alpha.4",
"@antora/atlas-extension": "1.0.0-alpha.2",
"@antora/collector-extension": "1.0.0-alpha.3",
"@asciidoctor/tabs": "1.0.0-beta.6",
"@springio/antora-extensions": "1.11.1",
"@springio/asciidoctor-extensions": "1.0.0-alpha.10"
}
}

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-docs</artifactId>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-parent</artifactId>
<version>4.1.2-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<name>Spring Cloud Bus Docs</name>
<description>Spring Cloud Bus Docs</description>
<properties>
<docs.main>spring-cloud-bus</docs.main>
<main.basedir>${basedir}/..</main.basedir>
<configprops.inclusionPattern>spring.cloud.bus.*</configprops.inclusionPattern>
<!-- Don't upload docs jar to central / repo.spring.io -->
<maven-deploy-plugin-default.phase>none</maven-deploy-plugin-default.phase>
</properties>
<build>
<sourceDirectory>src/main/asciidoc</sourceDirectory>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>docs</id>
<build>
<resources>
<resource>
<directory>src/main/antora/resources/antora-resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.spring.maven.antora</groupId>
<artifactId>antora-component-version-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,20 @@
version: @antora-component.version@
prerelease: @antora-component.prerelease@
asciidoc:
attributes:
attribute-missing: 'warn'
chomp: 'all'
project-root: @maven.multiModuleProjectDirectory@
github-repo: @docs.main@
github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@
github-issues: https://github.com/spring-cloud/@docs.main@/issues/
github-wiki: https://github.com/spring-cloud/@docs.main@/wiki
spring-cloud-version: @project.version@
github-tag: @github-tag@
version-type: @version-type@
docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@
raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
project-version: @project.version@
project-name: @docs.main@

View File

@@ -0,0 +1,18 @@
[[spring-cloud-bus]]
= Spring Cloud Bus
:page-section-summary-toc: 1
[[quick-start]]
== Quick Start
[[building]]
== Building
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/building.adoc[]
[[contributing]]
== Contributing
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/contributing.adoc[]

View File

@@ -0,0 +1,335 @@
#!/bin/bash -x
set -e
# Set default props like MAVEN_PATH, ROOT_FOLDER etc.
function set_default_props() {
# The script should be run from the root folder
ROOT_FOLDER=`pwd`
echo "Current folder is ${ROOT_FOLDER}"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
echo "You're not in the root folder of the project!"
exit 1
fi
# Prop that will let commit the changes
COMMIT_CHANGES="no"
MAVEN_PATH=${MAVEN_PATH:-}
echo "Path to Maven is [${MAVEN_PATH}]"
REPO_NAME=${PWD##*/}
echo "Repo name is [${REPO_NAME}]"
SPRING_CLOUD_STATIC_REPO=${SPRING_CLOUD_STATIC_REPO:-git@github.com:spring-cloud/spring-cloud-static.git}
echo "Spring Cloud Static repo is [${SPRING_CLOUD_STATIC_REPO}"
}
# Check if gh-pages exists and docs have been built
function check_if_anything_to_sync() {
git remote set-url --push origin `git config remote.origin.url | sed -e 's/^git:/https:/'`
if ! (git remote set-branches --add origin gh-pages && git fetch -q); then
echo "No gh-pages, so not syncing"
exit 0
fi
if ! [ -d docs/target/generated-docs ] && ! [ "${BUILD}" == "yes" ]; then
echo "No gh-pages sources in docs/target/generated-docs, so not syncing"
exit 0
fi
}
function retrieve_current_branch() {
# Code getting the name of the current branch. For master we want to publish as we did until now
# https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
# If there is a branch already passed will reuse it - otherwise will try to find it
CURRENT_BRANCH=${BRANCH}
if [[ -z "${CURRENT_BRANCH}" ]] ; then
CURRENT_BRANCH=$(git symbolic-ref -q HEAD)
CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/}
CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD}
fi
echo "Current branch is [${CURRENT_BRANCH}]"
git checkout ${CURRENT_BRANCH} || echo "Failed to check the branch... continuing with the script"
}
# Switches to the provided value of the release version. We always prefix it with `v`
function switch_to_tag() {
git checkout v${VERSION}
}
# Build the docs if switch is on
function build_docs_if_applicable() {
if [[ "${BUILD}" == "yes" ]] ; then
./mvnw clean install -P docs -pl docs -DskipTests
fi
}
# Get the name of the `docs.main` property
# Get allowed branches - assumes that a `docs` module is available under `docs` profile
function retrieve_doc_properties() {
MAIN_ADOC_VALUE=$("${MAVEN_PATH}"mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${docs.main}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
ALLOW_PROPERTY=${ALLOW_PROPERTY:-"docs.allowed.branches"}
ALLOWED_BRANCHES_VALUE=$("${MAVEN_PATH}"mvn -q \
-Dexec.executable="echo" \
-Dexec.args="\${${ALLOW_PROPERTY}}" \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
-P docs \
-pl docs)
echo "Extracted '${ALLOW_PROPERTY}' from Maven build [${ALLOWED_BRANCHES_VALUE}]"
}
# Stash any outstanding changes
function stash_changes() {
git diff-index --quiet HEAD && dirty=$? || (echo "Failed to check if the current repo is dirty. Assuming that it is." && dirty="1")
if [ "$dirty" != "0" ]; then git stash; fi
}
# Switch to gh-pages branch to sync it with current branch
function add_docs_from_target() {
local DESTINATION_REPO_FOLDER
if [[ -z "${DESTINATION}" && -z "${CLONE}" ]] ; then
DESTINATION_REPO_FOLDER=${ROOT_FOLDER}
elif [[ "${CLONE}" == "yes" ]]; then
mkdir -p ${ROOT_FOLDER}/target
local clonedStatic=${ROOT_FOLDER}/target/spring-cloud-static
if [[ ! -e "${clonedStatic}/.git" ]]; then
echo "Cloning Spring Cloud Static to target"
git clone ${SPRING_CLOUD_STATIC_REPO} ${clonedStatic} && git checkout gh-pages
else
echo "Spring Cloud Static already cloned - will pull changes"
cd ${clonedStatic} && git checkout gh-pages && git pull origin gh-pages
fi
DESTINATION_REPO_FOLDER=${clonedStatic}/${REPO_NAME}
mkdir -p ${DESTINATION_REPO_FOLDER}
else
if [[ ! -e "${DESTINATION}/.git" ]]; then
echo "[${DESTINATION}] is not a git repository"
exit 1
fi
DESTINATION_REPO_FOLDER=${DESTINATION}/${REPO_NAME}
mkdir -p ${DESTINATION_REPO_FOLDER}
echo "Destination was provided [${DESTINATION}]"
fi
cd ${DESTINATION_REPO_FOLDER}
git checkout gh-pages
git pull origin gh-pages
# Add git branches
###################################################################
if [[ -z "${VERSION}" ]] ; then
copy_docs_for_current_version
else
copy_docs_for_provided_version
fi
commit_changes_if_applicable
}
# Copies the docs by using the retrieved properties from Maven build
function copy_docs_for_current_version() {
if [[ "${CURRENT_BRANCH}" == "master" ]] ; then
echo -e "Current branch is master - will copy the current docs only to the root folder"
for f in docs/target/generated-docs/*; do
file=${f#docs/target/generated-docs/*}
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
# Not ignored...
cp -rf $f ${ROOT_FOLDER}/
git add -A ${ROOT_FOLDER}/$file
fi
done
COMMIT_CHANGES="yes"
else
echo -e "Current branch is [${CURRENT_BRANCH}]"
<<<<<<< Updated upstream
# https://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin
if [[ ",${WHITELISTED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then
=======
# http://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin
if [[ ",${ALLOWED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then
>>>>>>> Stashed changes
mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH}
echo -e "Branch [${CURRENT_BRANCH}] is allowed! Will copy the current docs to the [${CURRENT_BRANCH}] folder"
for f in docs/target/generated-docs/*; do
file=${f#docs/target/generated-docs/*}
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
# Not ignored...
# We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
if [[ "${file}" == "${MAIN_ADOC_VALUE}.html" ]] ; then
# We don't want to copy the spring-cloud-sleuth.html
# we want it to be converted to index.html
cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
else
cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}
git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/$file
fi
fi
done
COMMIT_CHANGES="yes"
else
echo -e "Branch [${CURRENT_BRANCH}] is not on the allow list! Check out the Maven [${ALLOW_PROPERTY}] property in
[docs] module available under [docs] profile. Won't commit any changes to gh-pages for this branch."
fi
fi
}
# Copies the docs by using the explicitly provided version
function copy_docs_for_provided_version() {
local FOLDER=${DESTINATION_REPO_FOLDER}/${VERSION}
mkdir -p ${FOLDER}
echo -e "Current tag is [v${VERSION}] Will copy the current docs to the [${FOLDER}] folder"
for f in ${ROOT_FOLDER}/docs/target/generated-docs/*; do
file=${f#${ROOT_FOLDER}/docs/target/generated-docs/*}
copy_docs_for_branch ${file} ${FOLDER}
done
COMMIT_CHANGES="yes"
CURRENT_BRANCH="v${VERSION}"
}
# Copies the docs from target to the provided destination
# Params:
# $1 - file from target
# $2 - destination to which copy the files
function copy_docs_for_branch() {
local file=$1
local destination=$2
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^${file}$; then
# Not ignored...
# We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
if [[ ("${file}" == "${MAIN_ADOC_VALUE}.html") || ("${file}" == "${REPO_NAME}.html") ]] ; then
# We don't want to copy the spring-cloud-sleuth.html
# we want it to be converted to index.html
cp -rf $f ${destination}/index.html
git add -A ${destination}/index.html
else
cp -rf $f ${destination}
git add -A ${destination}/$file
fi
fi
}
function commit_changes_if_applicable() {
if [[ "${COMMIT_CHANGES}" == "yes" ]] ; then
COMMIT_SUCCESSFUL="no"
git commit -a -m "Sync docs from ${CURRENT_BRANCH} to gh-pages" && COMMIT_SUCCESSFUL="yes" || echo "Failed to commit changes"
# Uncomment the following push if you want to auto push to
# the gh-pages branch whenever you commit to master locally.
# This is a little extreme. Use with care!
###################################################################
if [[ "${COMMIT_SUCCESSFUL}" == "yes" ]] ; then
git push origin gh-pages
fi
fi
}
# Switch back to the previous branch and exit block
function checkout_previous_branch() {
# If -version was provided we need to come back to root project
cd ${ROOT_FOLDER}
git checkout ${CURRENT_BRANCH} || echo "Failed to check the branch... continuing with the script"
if [ "$dirty" != "0" ]; then git stash pop; fi
exit 0
}
# Assert if properties have been properly passed
function assert_properties() {
echo "VERSION [${VERSION}], DESTINATION [${DESTINATION}], CLONE [${CLONE}]"
if [[ "${VERSION}" != "" && (-z "${DESTINATION}" && -z "${CLONE}") ]] ; then echo "Version was set but destination / clone was not!"; exit 1;fi
if [[ ("${DESTINATION}" != "" && "${CLONE}" != "") && -z "${VERSION}" ]] ; then echo "Destination / clone was set but version was not!"; exit 1;fi
if [[ "${DESTINATION}" != "" && "${CLONE}" == "yes" ]] ; then echo "Destination and clone was set. Pick one!"; exit 1;fi
}
# Prints the usage
function print_usage() {
cat <<EOF
The idea of this script is to update gh-pages branch with the generated docs. Without any options
the script will work in the following manner:
- if there's no gh-pages / target for docs module then the script ends
- for master branch the generated docs are copied to the root of gh-pages branch
- for any other branch (if that branch is allowed) a subfolder with branch name is created
and docs are copied there
- if the version switch is passed (-v) then a tag with (v) prefix will be retrieved and a folder
with that version number will be created in the gh-pages branch. WARNING! No allow verification will take place
- if the destination switch is passed (-d) then the script will check if the provided dir is a git repo and then will
switch to gh-pages of that repo and copy the generated docs to `docs/<project-name>/<version>`
- if the destination switch is passed (-d) then the script will check if the provided dir is a git repo and then will
switch to gh-pages of that repo and copy the generated docs to `docs/<project-name>/<version>`
USAGE:
You can use the following options:
-v|--version - the script will apply the whole procedure for a particular library version
-d|--destination - the root of destination folder where the docs should be copied. You have to use the full path.
E.g. point to spring-cloud-static folder. Can't be used with (-c)
-b|--build - will run the standard build process after checking out the branch
-c|--clone - will automatically clone the spring-cloud-static repo instead of providing the destination.
Obviously can't be used with (-d)
EOF
}
# ==========================================
# ____ ____ _____ _____ _____ _______
# / ____|/ ____| __ \|_ _| __ \__ __|
# | (___ | | | |__) | | | | |__) | | |
# \___ \| | | _ / | | | ___/ | |
# ____) | |____| | \ \ _| |_| | | |
# |_____/ \_____|_| \_\_____|_| |_|
#
# ==========================================
while [[ $# > 0 ]]
do
key="$1"
case ${key} in
-v|--version)
VERSION="$2"
shift # past argument
;;
-d|--destination)
DESTINATION="$2"
shift # past argument
;;
-b|--build)
BUILD="yes"
;;
-c|--clone)
CLONE="yes"
;;
-h|--help)
print_usage
exit 0
;;
*)
echo "Invalid option: [$1]"
print_usage
exit 1
;;
esac
shift # past argument or value
done
assert_properties
set_default_props
check_if_anything_to_sync
if [[ -z "${VERSION}" ]] ; then
retrieve_current_branch
else
switch_to_tag
fi
build_docs_if_applicable
retrieve_doc_properties
stash_changes
add_docs_from_target
checkout_previous_branch

View File

@@ -0,0 +1,26 @@
Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions. AMQP and Kafka broker implementations are included with the project. Alternatively, any link:https://spring.io/projects/spring-cloud-stream[Spring Cloud Stream] binder found on the classpath will work out of the box as a transport.
## Getting Started
As long as Spring Cloud Bus AMQP and RabbitMQ are on the
classpath any Spring Boot application will try to contact a RabbitMQ
server on `localhost:5672` (the default value of
`spring.rabbitmq.addresses`):
```java
@Configuration
@EnableAutoConfiguration
@RestController
public class Application {
@RequestMapping("/")
public String home() {
return "Hello World";
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
```

View File

@@ -0,0 +1,23 @@
8445b044de0845b9435d5ca828a07e8a03f7c7ca branch 'main' of github.com:spring-cloud/spring-cloud-bus
fe9e42180820c94988f2bc817c3fbae709bb854e not-for-merge branch '1.0.0.M2' of github.com:spring-cloud/spring-cloud-bus
bd144126e14feed9603fe6cd3e5a37107d5e2e60 not-for-merge branch '1.0.0.M3' of github.com:spring-cloud/spring-cloud-bus
369e393115952d70edaf00f19d941c2b4cff1dd6 not-for-merge branch '1.0.0.RC1' of github.com:spring-cloud/spring-cloud-bus
b26be221b2bd301ddbd06af39e8bde0b38ad0f41 not-for-merge branch '1.0.0.RELEASE' of github.com:spring-cloud/spring-cloud-bus
e49f99094121838835bc853958e75f3a36a267d3 not-for-merge branch '1.0.1.RELEASE' of github.com:spring-cloud/spring-cloud-bus
1464dd0f0e070369485c44df395b992e86d87dc4 not-for-merge branch '1.0.2.RELEASE' of github.com:spring-cloud/spring-cloud-bus
64f0252fb8d91027c542c4c984968e41e02d9ee6 not-for-merge branch '1.0.3.RELEASE' of github.com:spring-cloud/spring-cloud-bus
a70dda9c68fda523b92181c9a42642d0c86565b9 not-for-merge branch '1.0.x' of github.com:spring-cloud/spring-cloud-bus
6bf43bfd653741cc7174657b14c06e635a8d3f81 not-for-merge branch '1.1.x' of github.com:spring-cloud/spring-cloud-bus
31940b2fd40c4d796c0d52d393f1962d063b8b16 not-for-merge branch '1.2.x' of github.com:spring-cloud/spring-cloud-bus
f00b4c2ec0d74c2c147063076455c695f02403e0 not-for-merge branch '1.3.x' of github.com:spring-cloud/spring-cloud-bus
2d46c687c78e322666c1b66a96a708123df2de03 not-for-merge branch '2.0.x' of github.com:spring-cloud/spring-cloud-bus
c3b6feea2d878c508059f3208217b35a35afa0a1 not-for-merge branch '2.1.x' of github.com:spring-cloud/spring-cloud-bus
7ca22f129b3edd969b3ea7d91797d05b35a115db not-for-merge branch '2.2.x' of github.com:spring-cloud/spring-cloud-bus
45de9276badef94fe08061e15e9a5b85509260ff not-for-merge branch '3.0.x' of github.com:spring-cloud/spring-cloud-bus
7f1a400692c814456c544ab14d7e5e434388737d not-for-merge branch '3.1.x' of github.com:spring-cloud/spring-cloud-bus
9662ac236349ad36422550f38c1aee490d12d191 not-for-merge branch '4.0.x' of github.com:spring-cloud/spring-cloud-bus
e8b8207b2d0025be7b43f211c9ea05a36cf4759b not-for-merge branch 'antora' of github.com:spring-cloud/spring-cloud-bus
798cf84f044a3882acdbbcfdc33e4b9fc2424080 not-for-merge branch 'dependabot/maven/testcontainers.version-1.15.0' of github.com:spring-cloud/spring-cloud-bus
e3e1ec9b64aafc84bdbe8e740f72e5458de72301 not-for-merge branch 'docs-build' of github.com:spring-cloud/spring-cloud-bus
33caf2d4246328459cda33b19c9064ec0b56ea38 not-for-merge branch 'gh-pages' of github.com:spring-cloud/spring-cloud-bus
dd7b7141ee793ec26ef08393257e028c31004eee not-for-merge tag 'v4.1.2' of github.com:spring-cloud/spring-cloud-bus

View File

@@ -0,0 +1 @@
ref: refs/heads/main

View File

@@ -0,0 +1,18 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:spring-cloud/spring-cloud-bus.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
[lfs]
repositoryformatversion = 0
[branch "docs-build"]
remote = origin
merge = refs/heads/docs-build

View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View File

@@ -0,0 +1,174 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}

View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View File

@@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View File

@@ -0,0 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View File

@@ -0,0 +1,53 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View File

@@ -0,0 +1,169 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View File

@@ -0,0 +1,42 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View File

@@ -0,0 +1,78 @@
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi

View File

@@ -0,0 +1,77 @@
#!/bin/sh
# An example hook script to validate a patch (and/or patch series) before
# sending it via email.
#
# The hook should exit with non-zero status after issuing an appropriate
# message if it wants to prevent the email(s) from being sent.
#
# To enable this hook, rename this file to "sendemail-validate".
#
# By default, it will only check that the patch(es) can be applied on top of
# the default upstream branch without conflicts in a secondary worktree. After
# validation (successful or not) of the last patch of a series, the worktree
# will be deleted.
#
# The following config variables can be set to change the default remote and
# remote ref that are used to apply the patches against:
#
# sendemail.validateRemote (default: origin)
# sendemail.validateRemoteRef (default: HEAD)
#
# Replace the TODO placeholders with appropriate checks according to your
# needs.
validate_cover_letter () {
file="$1"
# TODO: Replace with appropriate checks (e.g. spell checking).
true
}
validate_patch () {
file="$1"
# Ensure that the patch applies without conflicts.
git am -3 "$file" || return
# TODO: Replace with appropriate checks for this patch
# (e.g. checkpatch.pl).
true
}
validate_series () {
# TODO: Replace with appropriate checks for the whole series
# (e.g. quick build, coding style checks, etc.).
true
}
# main -------------------------------------------------------------------------
if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
then
remote=$(git config --default origin --get sendemail.validateRemote) &&
ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
git config --replace-all sendemail.validateWorktree "$worktree"
else
worktree=$(git config --get sendemail.validateWorktree)
fi || {
echo "sendemail-validate: error: failed to prepare worktree" >&2
exit 1
}
unset GIT_DIR GIT_WORK_TREE
cd "$worktree" &&
if grep -q "^diff --git " "$1"
then
validate_patch "$1"
else
validate_cover_letter "$1"
fi &&
if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
then
git config --unset-all sendemail.validateWorktree &&
trap 'git worktree remove -ff "$worktree"' EXIT &&
validate_series
fi

View File

@@ -0,0 +1,128 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

View File

@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@@ -0,0 +1,14 @@
0000000000000000000000000000000000000000 8445b044de0845b9435d5ca828a07e8a03f7c7ca Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721240374 -0400 clone: from github.com:spring-cloud/spring-cloud-bus.git
8445b044de0845b9435d5ca828a07e8a03f7c7ca 3a0f899ba6804aeb567ed0437936b8d8b0b8c48a Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241311 -0400 revert: Revert "Bumping versions to 4.1.3-SNAPSHOT after release"
3a0f899ba6804aeb567ed0437936b8d8b0b8c48a 74134cf60dccfef0469a1720d7afb4ee2bb6f921 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241320 -0400 revert: Revert "Going back to snapshots"
74134cf60dccfef0469a1720d7afb4ee2bb6f921 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241324 -0400 revert: Revert "Update SNAPSHOT to 4.1.2"
5fbd5cef4a98df979047dd51dc2a1c4951c35c98 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721242706 -0400 checkout: moving from main to docs-build
5fbd5cef4a98df979047dd51dc2a1c4951c35c98 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721242743 -0400 checkout: moving from docs-build to main
5fbd5cef4a98df979047dd51dc2a1c4951c35c98 e3e1ec9b64aafc84bdbe8e740f72e5458de72301 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721242773 -0400 checkout: moving from main to docs-build
e3e1ec9b64aafc84bdbe8e740f72e5458de72301 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721242793 -0400 checkout: moving from docs-build to main
5fbd5cef4a98df979047dd51dc2a1c4951c35c98 e3e1ec9b64aafc84bdbe8e740f72e5458de72301 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721243349 -0400 checkout: moving from main to docs-build
e3e1ec9b64aafc84bdbe8e740f72e5458de72301 af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721243555 -0400 commit: updating antora sources
af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721243563 -0400 checkout: moving from docs-build to main
5fbd5cef4a98df979047dd51dc2a1c4951c35c98 af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721243884 -0400 checkout: moving from main to docs-build
af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 bd817cb93cc1d46638fe8b737bb2fc5affdd5f5b Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721244230 -0400 commit: fixing pom
bd817cb93cc1d46638fe8b737bb2fc5affdd5f5b 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721244236 -0400 checkout: moving from docs-build to main

View File

@@ -0,0 +1,3 @@
0000000000000000000000000000000000000000 e3e1ec9b64aafc84bdbe8e740f72e5458de72301 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721242773 -0400 branch: Created from refs/remotes/origin/docs-build
e3e1ec9b64aafc84bdbe8e740f72e5458de72301 af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721243555 -0400 commit: updating antora sources
af7d3bd36db12bcdbdb4d5dff0fae95f0f7ac260 bd817cb93cc1d46638fe8b737bb2fc5affdd5f5b Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721244230 -0400 commit: fixing pom

View File

@@ -0,0 +1,4 @@
0000000000000000000000000000000000000000 8445b044de0845b9435d5ca828a07e8a03f7c7ca Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721240374 -0400 clone: from github.com:spring-cloud/spring-cloud-bus.git
8445b044de0845b9435d5ca828a07e8a03f7c7ca 3a0f899ba6804aeb567ed0437936b8d8b0b8c48a Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241311 -0400 revert: Revert "Bumping versions to 4.1.3-SNAPSHOT after release"
3a0f899ba6804aeb567ed0437936b8d8b0b8c48a 74134cf60dccfef0469a1720d7afb4ee2bb6f921 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241320 -0400 revert: Revert "Going back to snapshots"
74134cf60dccfef0469a1720d7afb4ee2bb6f921 5fbd5cef4a98df979047dd51dc2a1c4951c35c98 Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721241324 -0400 revert: Revert "Update SNAPSHOT to 4.1.2"

View File

@@ -0,0 +1 @@
0000000000000000000000000000000000000000 8445b044de0845b9435d5ca828a07e8a03f7c7ca Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com> 1721240374 -0400 clone: from github.com:spring-cloud/spring-cloud-bus.git

View File

@@ -0,0 +1,3 @@
x<01><>MN1 <0C>Y<EFBFBD>V<><56>Q~%<25><10><>Xj{<7B>L<EFBFBD><4C> <0C>LFI<06>ۓ<EFBFBD>X<><58><EFBFBD>><3E><>Oi<><69>
<EFBFBD><EFBFBD><EFBFBD><13>W:R<><52>h<EFBFBD>.<1A>)C<><43><EFBFBD>a<EFBFBD>D<EFBFBD><44>-><3E>\<5C>!<21>N <20>$\<5C>v<EFBFBD>Mo<4D>w<EFBFBD>ya<79>m<><6D>3<EFBFBD><33>!e8\<5C> {<7B>U)ÃQ<C383> <0C><><EFBFBD>><3E><1F><>ʅ<>)<29>r<EFBFBD><72><EFBFBD>X<EFBFBD><58><EFBFBD>!M<> <20><>
<EFBFBD><EFBFBD><12><02>`<60><><EFBFBD>7<EFBFBD>4e<07><>\a<>_<EFBFBD>e<EFBFBD><65><EFBFBD>T<19>\<5C>&@.<2E><>_<>ߏ/o'<27><>v<Ӆ|<7C>

View File

@@ -0,0 +1,2 @@
x<01><>MN<4D>0<10>Y<EFBFBD><14>n<11>x<EFBFBD>ı<EFBFBD><10>b<05>-<07>Ϙ<04><>rDo<44>)W`5ҧ<35><D2A7><EFBFBD>^X<>i,<2C>Z{U23xt<78>T@<40>d<EFBFBD>6<EFBFBD><36>><3E><>'<27>B2<42><32>`{L)<29><><EFBFBD><0Z*R<>1<EFBFBD><31> ug<75>4<EFBFBD>Ѹ<EFBFBD>53y<33>%KR<4B><52> K<><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> g<>mIS<49><53>se<1F><><EFBFBD><EEB795><EFBFBD>K<EFBFBD><4B><EFBFBD><EFBFBD>y˰<>&,<2C>T<><54><EFBFBD>FnP#<23>Jk<4A>_<EFBFBD>?JŞ<4A>8ؽ<><D8BD>+ <0C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><11><02><>
<EFBFBD><EFBFBD>8<0E>

View File

@@ -0,0 +1 @@
x<01><>AN<41>0EY<45><14>n<11>=3Nl !Ć}<7D>Ɖ<>H\<5C>.<2E><>'<27>+<2B>}<7D><><EFBFBD><EFBFBD><EFBFBD>y]<5D>d<>]+1&Gؓ3<D893>zb<7A>:J <0C><>I<EFBFBD><02>@ɤ`<60>YJ<59><4A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0F>;<3B>{<7B><>C<EFBFBD>4<EFBFBD><34><EFBFBD>nrA7<>%<25>6<EFBFBD>ǫl<C7AB>"<22>-x<><78>h<EFBFBD><68><EFBFBD><EFBFBD>=<3D><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>-<2D>x<EFBFBD><78>v<EFBFBD><76>͗Ѝy}3<>A6<41>4k<34>v<EFBFBD>O<EFBFBD><15><>T<1D>W,

View File

@@ -0,0 +1 @@
x<01><>An<41> <10><><EFBFBD>9<EFBFBD><39><EFBFBD>Z<EFBFBD>RUE=Bo0<6F>!q<15><>Ajn_<6E>3t<33><74>ů˾o

View File

@@ -0,0 +1,121 @@
# pack-refs with: peeled fully-peeled sorted
fe9e42180820c94988f2bc817c3fbae709bb854e refs/remotes/origin/1.0.0.M2
bd144126e14feed9603fe6cd3e5a37107d5e2e60 refs/remotes/origin/1.0.0.M3
369e393115952d70edaf00f19d941c2b4cff1dd6 refs/remotes/origin/1.0.0.RC1
b26be221b2bd301ddbd06af39e8bde0b38ad0f41 refs/remotes/origin/1.0.0.RELEASE
e49f99094121838835bc853958e75f3a36a267d3 refs/remotes/origin/1.0.1.RELEASE
1464dd0f0e070369485c44df395b992e86d87dc4 refs/remotes/origin/1.0.2.RELEASE
64f0252fb8d91027c542c4c984968e41e02d9ee6 refs/remotes/origin/1.0.3.RELEASE
a70dda9c68fda523b92181c9a42642d0c86565b9 refs/remotes/origin/1.0.x
6bf43bfd653741cc7174657b14c06e635a8d3f81 refs/remotes/origin/1.1.x
31940b2fd40c4d796c0d52d393f1962d063b8b16 refs/remotes/origin/1.2.x
f00b4c2ec0d74c2c147063076455c695f02403e0 refs/remotes/origin/1.3.x
2d46c687c78e322666c1b66a96a708123df2de03 refs/remotes/origin/2.0.x
c3b6feea2d878c508059f3208217b35a35afa0a1 refs/remotes/origin/2.1.x
7ca22f129b3edd969b3ea7d91797d05b35a115db refs/remotes/origin/2.2.x
45de9276badef94fe08061e15e9a5b85509260ff refs/remotes/origin/3.0.x
7f1a400692c814456c544ab14d7e5e434388737d refs/remotes/origin/3.1.x
9662ac236349ad36422550f38c1aee490d12d191 refs/remotes/origin/4.0.x
e8b8207b2d0025be7b43f211c9ea05a36cf4759b refs/remotes/origin/antora
798cf84f044a3882acdbbcfdc33e4b9fc2424080 refs/remotes/origin/dependabot/maven/testcontainers.version-1.15.0
e3e1ec9b64aafc84bdbe8e740f72e5458de72301 refs/remotes/origin/docs-build
33caf2d4246328459cda33b19c9064ec0b56ea38 refs/remotes/origin/gh-pages
8445b044de0845b9435d5ca828a07e8a03f7c7ca refs/remotes/origin/main
8921aa119b432c54e7862363ca31e5421db21a85 refs/tags/1.0.0.M1
bd144126e14feed9603fe6cd3e5a37107d5e2e60 refs/tags/v1.0.0.M3
369e393115952d70edaf00f19d941c2b4cff1dd6 refs/tags/v1.0.0.RC1
0e10717af997bc9c1192b6dcad25488ea65e31a5 refs/tags/v1.0.0.RC2
f70e25981ee0564e401072caa7623942e99d9f3f refs/tags/v1.0.0.RC3
a87b1db6b5cbdad09aa75a2058ffc9f63a2b0d1e refs/tags/v1.0.0.RELEASE
e49f99094121838835bc853958e75f3a36a267d3 refs/tags/v1.0.1.RELEASE
1464dd0f0e070369485c44df395b992e86d87dc4 refs/tags/v1.0.2.RELEASE
64f0252fb8d91027c542c4c984968e41e02d9ee6 refs/tags/v1.0.3.RELEASE
ed180031911a3c8e776286ad295db18299b15253 refs/tags/v1.1.0.M1
a282f2fd97d2c4d9a785b89ede52c1fd3a9ffd52 refs/tags/v1.1.0.M2
88779bf77e32cc247efb4e0dade6bb370ffba277 refs/tags/v1.1.0.M3
04ce561d4d4ad12b45903bd2bf35592abc6d7668 refs/tags/v1.1.0.M4
404e6ac13b40faf888f2d765f67b571d52d51081 refs/tags/v1.1.0.M5
0d197a9037f5bce6d401cd46489359a3d632e49e refs/tags/v1.1.0.RC1
700ace536e1977161925b35d4227a5a3700c9953 refs/tags/v1.1.0.RC2
708087e0272f4878f7241371ae3d4594f317a72e refs/tags/v1.1.0.RELEASE
94174df768cc73ba1343d74a9cb96c937ed8fcab refs/tags/v1.1.1.RELEASE
35b53ba927a997f1bacc15bd2243462dcc047bea refs/tags/v1.2.0.M1
afebf7330e2654fb810d335a44882a1c1065a5ad refs/tags/v1.2.0.RC1
fe34beba8c71e409a7f57d3cb610f936bab5277d refs/tags/v1.2.0.RELEASE
896560df808260e57c81d401e4ceaab8f3dc1cce refs/tags/v1.2.1.RELEASE
b6f470837edf1ae24d1221217c7e5cc089008eb3 refs/tags/v1.2.2.RELEASE
968e387bb454e60bb695b71db302f801c666d317 refs/tags/v1.3.0.M1
^a6db47353f30f3f375c6c3ebafd7c576ad48e2ba
4d75d9666c371673717103e4b517e822edd28cd4 refs/tags/v1.3.0.RELEASE
25e7890345d68539a1934da4f38839c6084307c2 refs/tags/v1.3.1.RELEASE
1c3cae40e7d0962d51a520657fbd42feb619cb6a refs/tags/v1.3.2.RC1
29c216c41d5eaf9e937846380b4d7baa6fd0d959 refs/tags/v1.3.2.RELEASE
cc75705c436ea3d95946ef859a568e5ddba8ed54 refs/tags/v1.3.3.RELEASE
b909287d70f483437c0b9399e4827613e57aef81 refs/tags/v1.3.4.RELEASE
8c4ea8ad555e87e5166037c82e7fcbcf32eefa61 refs/tags/v1.3.5.RELEASE
7ee380793c744227042fde0079936d511e59b742 refs/tags/v2.0.0.M1
cb2d840af1d47c4cb047ec2fa5c671c15ec1fe4c refs/tags/v2.0.0.M2
f67585b1b04cb464ac38f661d75a0549c7374919 refs/tags/v2.0.0.M3
c1cd51e70bd1d071468ff095b118430cc3ad1472 refs/tags/v2.0.0.M4
e0596e8128867e1893f7c6cf3423812f66ab77f0 refs/tags/v2.0.0.M5
8576a71e331a0873ecaf0eabe75083a3b1105f1a refs/tags/v2.0.0.M6
f61c8eebb80b41473f8c725546379233049339ef refs/tags/v2.0.0.M7
142f90dee998a4b8277661536643dd5ae7c2ec01 refs/tags/v2.0.0.RC1
597baded52c30202b9b3743b964159885292e3e5 refs/tags/v2.0.0.RC2
1974b23bec5867cbc8c8ff35b7fe41c2d947b0a8 refs/tags/v2.0.0.RELEASE
8cc6ddc9b1183da379c1c37a1b99333a1daac590 refs/tags/v2.0.1.RELEASE
365834fc97ac6d13b5899becfccd606377983a04 refs/tags/v2.0.2.RELEASE
647acce61ebd76dac94ea1ff5b9c7ef6f53b12e7 refs/tags/v2.1.0.M1
cd5f299fb3e869751993002bee27806fa8f1284b refs/tags/v2.1.0.M2
1a6ec6880740f84ce9d322ee38a9bfce0e5c8534 refs/tags/v2.1.0.RC1
74d896eb2a7b016e1d0991e062c6aca8d8877268 refs/tags/v2.1.0.RC2
779a4f40a1bf091e501396467f3b8086d3924573 refs/tags/v2.1.0.RC3
79cb162309d9980fa85df17adccf8ee126a363d4 refs/tags/v2.1.0.RELEASE
17510d30c822f19ef8f73a0b98f35aa09b12030f refs/tags/v2.1.1.RELEASE
063595e0294987e3faea81263605806eb9498156 refs/tags/v2.1.2.RELEASE
8d2d234e0a8821042becc44429e848b37a2d51a8 refs/tags/v2.1.3.RELEASE
e2733514282a3ba050b949a915249a2b7f46e894 refs/tags/v2.1.4.RELEASE
dfc23d2add26e53ab3e7133b7df8f94c6594cd73 refs/tags/v2.2.0.M1
907312192b6f7463b045082de8dd11f290a12d26 refs/tags/v2.2.0.M2
05ffc7240b53c89f591ea6b6af4187a61fbb19eb refs/tags/v2.2.0.M3
27db6026c9c4e66bf8a3bdda0e80ace76de6adeb refs/tags/v2.2.0.RC1
764c4a2e4283086d8a2bfc6cec3c9739431a4d49 refs/tags/v2.2.0.RC2
84de69d4e02544b726338fe03e5167daeb68e52b refs/tags/v2.2.0.RELEASE
22ba14a285b99129a05267eb4a34bc812065d129 refs/tags/v2.2.1.RELEASE
286b62f1448746e6ade6c86ed251499cf4319cf1 refs/tags/v2.2.2.RELEASE
02acecbfbfb5221967088ca6ffe56ff3253cf0d6 refs/tags/v2.2.3.RELEASE
7959e19c9a03ffa7c777dfd9bcc1955c6b9ae607 refs/tags/v2.2.4.RELEASE
b898bb90c0def99897f4a9e77af10c66ce5713bf refs/tags/v3.0.0
5da65b2491f196905253cb1a32659b6a62175a90 refs/tags/v3.0.0-M2
c8bfcd894928c0bff5c3f2ba67bd32815ab1e5e4 refs/tags/v3.0.0-M3
0959a3a42220836f53cf10016671aa10ca4ca3c0 refs/tags/v3.0.0-M4
df967da0d58b93fb57be470bdb3e9a0da0156081 refs/tags/v3.0.0-M5
8d88bc42837081978728623c089182467ea11961 refs/tags/v3.0.0-M6
13ec6af55a07d9d4295f505882abe6fde7be9634 refs/tags/v3.0.0-RC1
a6b97bce521e810b6d297c54bf6c22cd43a10a3e refs/tags/v3.0.0.M1
2eac8e7c85762788ecf999e7f8561ff885999914 refs/tags/v3.0.1
3d1f20c1fc236a048b9fe6b6f49050384f26c49a refs/tags/v3.0.2
65423af0c0ad73a59736abb0f388b728fe86e0bc refs/tags/v3.0.3
10117369ea66f528515ef0dc0006ea610d777b46 refs/tags/v3.1.0
68571b7ed03cac9e277d7cbd262bdf1f7337412a refs/tags/v3.1.0-M1
6a45b1cb7de7b536c55fd5bb15a0ce4a481129fd refs/tags/v3.1.0-M2
6c4980df8e34b5e750fc2d6eec58e3abe29aa9cc refs/tags/v3.1.0-M3
51f1039d1d3b64eacfcb634a74354b407e78a477 refs/tags/v3.1.0-RC1
c620219e9b87f900e29188db3d7ac51d3de1703f refs/tags/v3.1.2
da3a1c7013c415b6d4e2cdfffff4455dce120b2f refs/tags/v3.1.3
d43b0a28430e9fb383af8ec608fa9c86c8f594bc refs/tags/v4.0.0
daa95cc2f3971eaf0c7e27def7c9f9502e3d0442 refs/tags/v4.0.0-M1
c0f2a87a5cb9e165a22241cd41e9eee1a8ec29e3 refs/tags/v4.0.0-M2
8a88f39f0f50b74fd712ee6219c2a92df9dd69ae refs/tags/v4.0.0-M3
18f1980aefc10805267bd6de9dd20b0077a525b2 refs/tags/v4.0.0-M4
e694bd46afbeeca7656f962c2ad5c2bfef3c92a6 refs/tags/v4.0.0-M5
16ad2e3a081b0cc575bd591395d0f2c7336fe719 refs/tags/v4.0.0-RC1
ef0a09fc7b553383ab9f3d14a1a7911b56a4ba10 refs/tags/v4.0.0-RC2
5f7889a885483fc1c6f5f0e5057897550a13190a refs/tags/v4.0.0-RC3
4f62ec1a80505da1faa7a6910859a395afe3fe7c refs/tags/v4.0.1
85c0df313cfd146f3f19141d67be5d9727ba2b26 refs/tags/v4.0.3
410aaec75448dd3bae2fcc176f2fbab481c9bc2e refs/tags/v4.1.0
cf0c1bf98671c6f30bd09c003bdd771e946dfe45 refs/tags/v4.1.0-M1
3714c6eee611cda1cfc77c1cc0b562f89f3210f8 refs/tags/v4.1.0-M2
de5f981ffa02251298f019207ebac190176c3edd refs/tags/v4.1.0-RC1
dcf7024ff47aef6d0427a4154296b48b2715b73a refs/tags/v4.1.1

View File

@@ -0,0 +1 @@
bd817cb93cc1d46638fe8b737bb2fc5affdd5f5b

View File

@@ -0,0 +1 @@
5fbd5cef4a98df979047dd51dc2a1c4951c35c98

View File

@@ -0,0 +1 @@
ref: refs/remotes/origin/main

View File

@@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

View File

@@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-bus-parent</artifactId>
<version>4.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-cloud-bus-parent</name>
<description>Spring Cloud Bus Parent</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>4.1.3-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modules>
<module>spring-cloud-bus-dependencies</module>
<module>spring-cloud-bus</module>
<module>spring-cloud-bus-rsocket</module>
<module>spring-cloud-bus-tests</module>
<module>spring-cloud-starter-bus-amqp</module>
<module>spring-cloud-starter-bus-kafka</module>
<module>spring-cloud-starter-bus-stream</module>
<module>docs</module>
</modules>
<properties>
<spring-cloud-commons.version>4.1.4-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-stream.version>4.1.3-SNAPSHOT</spring-cloud-stream.version>
<spring-cloud-function.version>4.1.3-SNAPSHOT</spring-cloud-function.version>
<bintray.package>bus</bintray.package>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>spring</id>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-dependencies</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-dependencies</artifactId>
<version>${spring-cloud-commons.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-test-support</artifactId>
<version>${spring-cloud-commons.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<version>${spring-cloud-stream.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-dependencies</artifactId>
<version>${spring-cloud-stream.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-dependencies</artifactId>
<version>${spring-cloud-function.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-rsocket</artifactId>
<version>${spring-cloud-function.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<scm>
<url>https://github.com/spring-cloud/spring-cloud-bus</url>
<connection>scm:git:git://github.com/spring-cloud/spring-cloud-bus.git
</connection>
<developerConnection>
scm:git:ssh://git@github.com/spring-cloud/spring-cloud-bus.git
</developerConnection>
<tag>HEAD</tag>
</scm>
</project>

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>4.1.3-SNAPSHOT</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-bus-dependencies</artifactId>
<version>4.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-cloud-bus-dependencies</name>
<description>Spring Cloud Bus Dependencies</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-stream</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-rsocket</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>spring</id>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-bus-rsocket</artifactId>
<packaging>jar</packaging>
<name>spring-cloud-bus-rsocket</name>
<description>Spring Cloud Bus</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-parent</artifactId>
<version>4.1.2-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<properties>
<rsocket-routing.version>0.2.0</rsocket-routing.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-rsocket</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</dependency>
<dependency>
<groupId>io.rsocket.routing</groupId>
<artifactId>rsocket-routing-client-spring</artifactId>
<version>${rsocket-routing.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-test-support</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus.rsocket;
import io.rsocket.RSocket;
import io.rsocket.routing.client.spring.RoutingClientProperties;
import io.rsocket.routing.client.spring.RoutingRSocketRequester;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.bus.BusAutoConfiguration;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.cloud.bus.BusRefreshAutoConfiguration;
import org.springframework.cloud.bus.ConditionalOnBusEnabled;
import org.springframework.cloud.bus.PathServiceMatcherAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Spencer Gibb
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnBusEnabled
@EnableConfigurationProperties(BusRSocketProperties.class)
@ConditionalOnClass({ RSocket.class, RoutingRSocketRequester.class })
@AutoConfigureBefore({ BusAutoConfiguration.class, BusRefreshAutoConfiguration.class,
PathServiceMatcherAutoConfiguration.class })
public class BusRSocketAutoConfiguration {
@Bean
public RoutingClientDestinationFactory routingClientDestinationFactory(BusRSocketProperties properties) {
return new RoutingClientDestinationFactory(properties);
}
@Bean
public RSocketRequesterBusBridge rSocketRequesterBusBridge(RoutingRSocketRequester requester) {
return new RSocketRequesterBusBridge(requester);
}
@Bean
public RSocketServiceMatcher rSocketServiceMatcher(BusProperties properties,
RoutingClientProperties routingClientProperties) {
return new RSocketServiceMatcher(properties.getId(), routingClientProperties);
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright 2012-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
*
* https://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.bus.rsocket;
import java.util.HashMap;
import java.util.Map;
import io.rsocket.routing.client.spring.RoutingClientProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import static org.springframework.cloud.bus.BusEnvironmentPostProcessor.addOrReplace;
/**
* {@link EnvironmentPostProcessor} that sets the default properties for the RSocket
* Routing Client.
*/
public class BusRSocketEnvironmentPostProcessor implements EnvironmentPostProcessor {
static final String DEFAULTS_PROPERTY_SOURCE_NAME = "springCloudBusRSocketDefaultProperties";
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
Map<String, Object> defaults = new HashMap<>();
defaults.put(RoutingClientProperties.CONFIG_PREFIX + ".tags.bus", true);
addOrReplace(environment.getPropertySources(), defaults, DEFAULTS_PROPERTY_SOURCE_NAME, false);
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus.rsocket;
import java.util.LinkedHashMap;
import java.util.Map;
import io.rsocket.routing.common.MutableKey;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.CollectionUtils;
@ConfigurationProperties("spring.cloud.bus.rsocket")
public class BusRSocketProperties implements InitializingBean {
private final Map<MutableKey, String> defaultTags = new LinkedHashMap<>();
@Override
public void afterPropertiesSet() {
if (CollectionUtils.isEmpty(defaultTags)) {
defaultTags.put(MutableKey.of("bus"), "true");
}
}
public Map<MutableKey, String> getDefaultTags() {
return this.defaultTags;
}
@Override
public String toString() {
return new ToStringCreator(this).append("defaultTags", defaultTags).toString();
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus.rsocket;
import java.util.HashMap;
import java.util.Map;
import io.rsocket.routing.client.spring.RoutingRSocketRequester;
import io.rsocket.routing.common.Key;
import io.rsocket.routing.common.WellKnownKey;
import io.rsocket.routing.frames.RoutingType;
import org.springframework.cloud.bus.BusBridge;
import org.springframework.cloud.bus.BusConstants;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import org.springframework.util.StringUtils;
public class RSocketRequesterBusBridge implements BusBridge {
public RSocketRequesterBusBridge(RoutingRSocketRequester requester) {
this.requester = requester;
}
private final RoutingRSocketRequester requester;
@Override
public void send(RemoteApplicationEvent event) {
requester.route(BusConstants.BUS_CONSUMER).address(builder -> {
builder.routingType(RoutingType.MULTICAST);
// get tags out of destination
getTagsFromDestination(event.getDestinationService()).forEach(builder::with);
}).data(event).send().subscribe();
}
static Map<Key, String> getTagsFromDestination(String delimitedProperties) {
String[] properties = StringUtils.tokenizeToStringArray(delimitedProperties, ":");
Map<Key, String> map = new HashMap<>();
for (String property : properties) {
int index = lowestIndexOf(property, "=");
String key = (index > 0) ? property.substring(0, index) : property;
String value = (index > 0) ? property.substring(index + 1) : null;
try {
WellKnownKey wellKnownKey = WellKnownKey.valueOf(key);
map.put(Key.of(wellKnownKey), value);
}
catch (IllegalArgumentException e) {
try {
WellKnownKey wellKnownKey = WellKnownKey.valueOf(key.toUpperCase());
map.put(Key.of(wellKnownKey), value);
}
catch (IllegalArgumentException e2) {
// not a WellKnownKey, use string
map.put(Key.of(key), value);
}
}
}
return map;
}
private static int lowestIndexOf(String property, String... candidates) {
int index = -1;
for (String candidate : candidates) {
int candidateIndex = property.indexOf(candidate);
if (candidateIndex > 0) {
index = (index != -1) ? Math.min(index, candidateIndex) : candidateIndex;
}
}
return index;
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus.rsocket;
import java.util.HashMap;
import java.util.Map;
import io.rsocket.routing.client.spring.RoutingClientProperties;
import io.rsocket.routing.common.Key;
import io.rsocket.routing.common.WellKnownKey;
import org.springframework.cloud.bus.ServiceMatcher;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import org.springframework.util.AntPathMatcher;
import static org.springframework.cloud.bus.rsocket.RSocketRequesterBusBridge.getTagsFromDestination;
/**
* A pass thru patcher that allows the RSocket Routing broker to determine which instances
* to send to.
*/
public class RSocketServiceMatcher implements ServiceMatcher {
private final String busId;
private final RoutingClientProperties properties;
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
private final Map<Key, String> localTags = new HashMap<>();
public RSocketServiceMatcher(String busId, RoutingClientProperties properties) {
this.busId = busId;
this.properties = properties;
convertLocalTags(properties);
}
@Override
public boolean isFromSelf(RemoteApplicationEvent event) {
String originService = event.getOriginService();
String serviceId = getBusId();
return antPathMatcher.match(originService, serviceId);
}
@Override
public boolean isForSelf(RemoteApplicationEvent event) {
Map<Key, String> tags = getTagsFromDestination(event.getDestinationService());
for (Map.Entry<Key, String> entry : tags.entrySet()) {
String existingValue = localTags.get(entry.getKey());
if (existingValue == null || !existingValue.equals(entry.getValue())) {
return false;
}
}
return true;
}
private void convertLocalTags(RoutingClientProperties properties) {
properties.getTags().forEach((key, value) -> {
if (key.getWellKnownKey() != null) {
localTags.put(Key.of(key.getWellKnownKey()), value);
}
else {
localTags.put(Key.of(key.getKey()), value);
}
});
localTags.put(Key.of(WellKnownKey.SERVICE_NAME), properties.getServiceName());
}
@Override
public String getBusId() {
return busId;
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus.rsocket;
import java.util.ArrayList;
import org.springframework.cloud.bus.event.Destination;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
public class RoutingClientDestinationFactory implements Destination.Factory {
private final BusRSocketProperties properties;
public RoutingClientDestinationFactory(BusRSocketProperties properties) {
this.properties = properties;
}
@Override
public Destination getDestination(String originalDestination) {
ArrayList<String> entries = new ArrayList<>();
properties.getDefaultTags().forEach((key, s) -> {
String keyStr = (key.getWellKnownKey() != null) ? key.getWellKnownKey().name() : key.getKey();
entries.add(keyStr + "=" + s);
});
String defaultTags = StringUtils.collectionToDelimitedString(entries, ":");
return () -> {
String destination = (ObjectUtils.isEmpty(originalDestination)) ? defaultTags
: defaultTags + ":" + originalDestination;
if (ObjectUtils.isEmpty(destination)) {
throw new IllegalArgumentException("destination may not be empty");
}
return destination;
};
}
}

View File

@@ -0,0 +1,3 @@
# Environment Post Processor
org.springframework.boot.env.EnvironmentPostProcessor=\
org.springframework.cloud.bus.rsocket.BusRSocketEnvironmentPostProcessor

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-bus-tests</artifactId>
<packaging>jar</packaging>
<name>spring-cloud-bus-tests</name>
<description>Spring Cloud Bus Tests</description>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus-parent</artifactId>
<version>4.1.2-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<properties>
<testcontainers.version>1.17.6</testcontainers.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>rabbitmq</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,114 @@
/*
* Copyright 2015-2020 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
*
* https://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.bus;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.RabbitMQContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.bus.event.EnvironmentChangeRemoteApplicationEvent;
import org.springframework.cloud.stream.binder.ProducerProperties;
import org.springframework.cloud.stream.config.BindingServiceProperties;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = { "management.endpoints.web.exposure.include=*",
"spring.cloud.stream.bindings.springCloudBusOutput.producer.errorChannelEnabled=true",
"logging.level.org.springframework.cloud.bus=TRACE", "spring.cloud.bus.id=app:1",
"spring.autoconfigure.exclude=org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration" })
@Testcontainers
public class BusAmqpIntegrationTests {
@Container
private static final RabbitMQContainer rabbitMQContainer = new RabbitMQContainer(
"rabbitmq:3.7.25-management-alpine");
private static ConfigurableApplicationContext context;
@Autowired
private BindingServiceProperties bindingServiceProperties;
@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
registry.add("spring.rabbitmq.host", rabbitMQContainer::getHost);
registry.add("spring.rabbitmq.port", rabbitMQContainer::getAmqpPort);
}
@BeforeAll
static void before() {
context = new SpringApplicationBuilder(TestConfig.class).properties("server.port=0",
"spring.rabbitmq.host=" + rabbitMQContainer.getHost(),
"spring.rabbitmq.port=" + rabbitMQContainer.getAmqpPort(),
"management.endpoints.web.exposure.include=*", "spring.cloud.bus.id=app:2",
"spring.autoconfigure.exclude=org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration")
.run();
}
@AfterAll
static void after() {
if (context != null) {
context.close();
}
}
@Test
void remoteEventsAreSentViaAmqp(@Autowired WebTestClient client, @Autowired TestConfig testConfig)
throws InterruptedException {
assertThat(rabbitMQContainer.isRunning());
HashMap<String, String> map = new HashMap<>();
map.put("name", "foo");
map.put("value", "bar");
client.post().uri("/actuator/busenv").bodyValue(map).exchange().expectStatus().is2xxSuccessful();
TestConfig remoteTestConfig = context.getBean(TestConfig.class);
assertThat(remoteTestConfig.latch.await(5, TimeUnit.SECONDS)).isTrue();
assertThat(testConfig.latch.await(5, TimeUnit.SECONDS)).isTrue();
ProducerProperties producerProperties = bindingServiceProperties.getProducerProperties(BusConstants.OUTPUT);
assertThat(producerProperties.isErrorChannelEnabled()).isTrue();
}
@SpringBootConfiguration
@EnableAutoConfiguration
static class TestConfig implements ApplicationListener<EnvironmentChangeRemoteApplicationEvent> {
CountDownLatch latch = new CountDownLatch(1);
@Override
public void onApplicationEvent(EnvironmentChangeRemoteApplicationEvent event) {
latch.countDown();
}
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2012-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
*
* https://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.bus;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.bus.endpoint.EnvironmentBusEndpoint;
import org.springframework.cloud.bus.endpoint.RefreshBusEndpoint;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(properties = { "spring.jmx.enabled=true", "endpoints.default.jmx.enabled=true",
"management.endpoints..jmx.exposure.include=busrefresh,busenv", "debug=true" })
public class BusJmxEndpointTests {
@Autowired(required = false)
private RefreshBusEndpoint refreshBusEndpoint;
@Autowired(required = false)
private EnvironmentBusEndpoint environmentBusEndpoint;
@Test
public void contextLoads() {
assertThat(this.refreshBusEndpoint).isNotNull();
assertThat(this.environmentBusEndpoint).isNotNull();
}
@SpringBootConfiguration
@EnableAutoConfiguration
protected static class TestConfig {
}
}

Some files were not shown because too many files have changed in this diff Show More