mirror of
https://github.com/spring-cloud/spring-cloud-build.git
synced 2026-09-17 21:09:00 +00:00
Compare commits
138
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70f7d413f3 | ||
|
|
94efa8767a | ||
|
|
06f8a97e59 | ||
|
|
51c41e52f6 | ||
|
|
b1a8036d3f | ||
|
|
a5be66e84f | ||
|
|
941bba5970 | ||
|
|
1235c2153a | ||
|
|
3312992760 | ||
|
|
717978e9eb | ||
|
|
af4bc6f95c | ||
|
|
1afb77ea41 | ||
|
|
33b42d3a4b | ||
|
|
079317a3fe | ||
|
|
5d8b1fa812 | ||
|
|
c6a0a473ec | ||
|
|
b167397c23 | ||
|
|
b02a62f33d | ||
|
|
d810f71a84 | ||
|
|
cc07cbcde5 | ||
|
|
9d88a2c0de | ||
|
|
8a3f69227e | ||
|
|
db5c07d175 | ||
|
|
c0b4f01f4e | ||
|
|
2e19f63b25 | ||
|
|
fc96d209c7 | ||
|
|
c780d61513 | ||
|
|
b1bfba6477 | ||
|
|
a8f202ab85 | ||
|
|
637a075b76 | ||
|
|
758e7241a2 | ||
|
|
377f8ab000 | ||
|
|
c71f50931b | ||
|
|
200efcb348 | ||
|
|
ed42b3a69a | ||
|
|
2a7cf5d7be | ||
|
|
3a6c453d61 | ||
|
|
098dba54c2 | ||
|
|
9d8a2e134e | ||
|
|
2a3797bdaa | ||
|
|
92c70e3253 | ||
|
|
6ece1d5969 | ||
|
|
f01646cffd | ||
|
|
ac503a0448 | ||
|
|
46a0f7cd0c | ||
|
|
bf7db5e2dd | ||
|
|
7d473e0ba2 | ||
|
|
c011c51240 | ||
|
|
3f62e003c0 | ||
|
|
6ed8684df3 | ||
|
|
1b2b6bfb2c | ||
|
|
dcf98e5632 | ||
|
|
4faff54278 | ||
|
|
1a67bf0b89 | ||
|
|
f2f55d458f | ||
|
|
dfff168439 | ||
|
|
643ca5161e | ||
|
|
083caea6b2 | ||
|
|
1d35ef3be7 | ||
|
|
f9aad5f2f5 | ||
|
|
efdb76462e | ||
|
|
39c493473b | ||
|
|
f7f7f81534 | ||
|
|
941340a588 | ||
|
|
1e7306187b | ||
|
|
3c6e1cfaa6 | ||
|
|
929f134f7f | ||
|
|
4fcaad3875 | ||
|
|
5c21bf991e | ||
|
|
620f5a4ade | ||
|
|
12ac72d4b3 | ||
|
|
adfcaa2525 | ||
|
|
6a8cc81e0a | ||
|
|
18da776da9 | ||
|
|
02d30876cf | ||
|
|
7013634e77 | ||
|
|
80aa70eaa9 | ||
|
|
e1ea303044 | ||
|
|
06547a6ff7 | ||
|
|
32f586b20c | ||
|
|
d43a3e1b7d | ||
|
|
3afd0a2bd3 | ||
|
|
7de33c920c | ||
|
|
8e73741657 | ||
|
|
5503649e5b | ||
|
|
277160fb32 | ||
|
|
fb4e0c6b59 | ||
|
|
8c47c5fcf7 | ||
|
|
fb4e94d07c | ||
|
|
3f2eb50c74 | ||
|
|
6176fb3ba7 | ||
|
|
d885a49ddd | ||
|
|
8d1f5b2c53 | ||
|
|
e96bbbdda1 | ||
|
|
1b8e3471c0 | ||
|
|
2a25b01f99 | ||
|
|
eaa807396c | ||
|
|
a3874d2c62 | ||
|
|
181fb388fc | ||
|
|
3673bb8944 | ||
|
|
eafe8ff067 | ||
|
|
e7b3617cca | ||
|
|
47a1177134 | ||
|
|
dc5e21e1b8 | ||
|
|
66d630b974 | ||
|
|
cd389e7a3b | ||
|
|
8125841e11 | ||
|
|
e46b1072a8 | ||
|
|
6d67ffe1a3 | ||
|
|
7ebdff56bb | ||
|
|
a3ede5ccc1 | ||
|
|
8590eece60 | ||
|
|
ea3ab78228 | ||
|
|
f068c529d5 | ||
|
|
b157cc00be | ||
|
|
531b596883 | ||
|
|
0014bcb71f | ||
|
|
d16c66f632 | ||
|
|
dc6a2070e3 | ||
|
|
d783dad589 | ||
|
|
88a6c5c63a | ||
|
|
423ec17482 | ||
|
|
cedbdc586d | ||
|
|
f0aea46bb8 | ||
|
|
7496cb5b80 | ||
|
|
5a691a5ede | ||
|
|
5512e6e613 | ||
|
|
2cd5817a32 | ||
|
|
62ce24f573 | ||
|
|
f0d77c65cb | ||
|
|
93e0430a0c | ||
|
|
2c7d425bed | ||
|
|
40a436a9a7 | ||
|
|
323b5f2678 | ||
|
|
8d5da126d3 | ||
|
|
af8ca0befb | ||
|
|
6f6d6aa856 | ||
|
|
0b737621f0 |
@@ -10,7 +10,6 @@ jobs:
|
||||
branches:
|
||||
ignore:
|
||||
- gh-pages # list of branches to ignore
|
||||
resource_class: large
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
|
||||
@@ -18,3 +18,4 @@ _site/
|
||||
.factorypath
|
||||
.vscode/
|
||||
.flattened-pom.xml
|
||||
.DS_Store
|
||||
|
||||
+90
-11
@@ -179,6 +179,7 @@ $ touch .springformat
|
||||
==== 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/master/spring-cloud-build-tools[Spring Cloud Build] project.
|
||||
|
||||
.spring-cloud-build-tools/
|
||||
----
|
||||
@@ -219,12 +220,30 @@ image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring
|
||||
|
||||
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/master/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/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL.
|
||||
- `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/master/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/master/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.
|
||||
|
||||
== Flattening the POMs
|
||||
|
||||
To avoid propagating build setup that is required to build a Spring Cloud project, we're using the maven flatten plugin. It has the advantage of letting you use whatever features you need while publishing "clean" pom to the repository.
|
||||
|
||||
In order to add it, add the `org.codehaus.mojo:flatten-maven-plugin` to your `pom.xml`.
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
----
|
||||
|
||||
== Reusing the documentation
|
||||
|
||||
Spring Cloud Build publishes its `spring-cloud-build-docs` module that contains
|
||||
@@ -240,33 +259,91 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId> <1>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId> <1>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId> <2>
|
||||
<artifactId>maven-dependency-plugin</artifactId> <2>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId> <3>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId> <4>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId> <3>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId> <5>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId> <4>
|
||||
<artifactId>maven-antrun-plugin</artifactId> <6>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
----
|
||||
<1> This plugin downloads the resources of the `spring-cloud-build-docs` module
|
||||
<2> This plugin unpacks the resources of the `spring-cloud-build-docs` module
|
||||
<3> This plugin is required to parse the Asciidoctor documentation
|
||||
<4> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
|
||||
<2> This plugin downloads sets up all the git information of the project
|
||||
<2> This plugin downloads the resources of the `spring-cloud-build-docs` module
|
||||
<3> This plugin unpacks the resources of the `spring-cloud-build-docs` module
|
||||
<4> This plugin generates an `adoc` file with all the configuration properties from the classpath
|
||||
<5> This plugin is required to parse the Asciidoctor documentation
|
||||
<6> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
|
||||
|
||||
IMPORTANT: The order of plugin declaration is important!
|
||||
|
||||
In order for the build to generate the `adoc` file with all your configuration properties, your `docs` module should contain all the dependencies on the classpath, that you would want to scan for configuration properties. The file will be output to `${docsModule}/src/main/asciidoc/_configprops.adoc` file (configurable via the `configprops.path` property).
|
||||
|
||||
If you want to modify which of the configuration properties are put in the table, you can tweak the `configprops.inclusionPattern` pattern to include only a subset of the properties (e.g. `<configprops.inclusionPattern>spring.sleuth.*</configprops.inclusionPattern>`).
|
||||
|
||||
Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<attributes>
|
||||
<docinfo>shared</docinfo>
|
||||
<allow-uri-read>true</allow-uri-read>
|
||||
<nofooter/>
|
||||
<toc>left</toc>
|
||||
<toc-levels>4</toc-levels>
|
||||
<sectlinks>true</sectlinks>
|
||||
<sources-root>${project.basedir}/src</sources-root>
|
||||
<asciidoc-sources-root>${project.basedir}/src/main/asciidoc</asciidoc-sources-root>
|
||||
<generated-resources-root>${project.basedir}/target/generated-resources
|
||||
</generated-resources-root>
|
||||
<!-- Use this attribute the reference code from another module -->
|
||||
<!-- Note the @ at the end, lowering the precedence of the attribute -->
|
||||
<project-root>${maven.multiModuleProjectDirectory}@</project-root>
|
||||
<!-- It's mandatory for you to pass the docs.main property -->
|
||||
<github-repo>${docs.main}</github-repo>
|
||||
<github-raw>
|
||||
https://raw.githubusercontent.com/spring-cloud/${docs.main}/${github-tag}@
|
||||
</github-raw>
|
||||
<github-code>https://github.com/spring-cloud/${docs.main}/tree/${github-tag}@
|
||||
</github-code>
|
||||
<github-issues>https://github.com/spring-cloud/${docs.main}/issues/@</github-issues>
|
||||
<github-wiki>https://github.com/spring-cloud/${docs.main}/wiki@</github-wiki>
|
||||
<github-master-code>https://github.com/spring-cloud/${docs.main}/tree/master
|
||||
</github-master-code>
|
||||
<index-link>${index-link}@</index-link>
|
||||
|
||||
<!-- Spring Cloud specific -->
|
||||
<!-- for backward compatibility -->
|
||||
<spring-cloud-version>${project.version}@</spring-cloud-version>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<github-tag>${github-tag}@</github-tag>
|
||||
<version-type>${version-type}@</version-type>
|
||||
<docs-url>${docs-url}@</docs-url>
|
||||
<raw-docs-url>${raw-docs-url}@</raw-docs-url>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<project-name>${docs.main}@</project-name>
|
||||
</attributes>
|
||||
----
|
||||
|
||||
== Updating the guides
|
||||
|
||||
We assume that your project contains guides under the `guides` folder.
|
||||
@@ -294,4 +371,6 @@ $ ./mvnw clean deploy -Pguides
|
||||
|
||||
what will happen is that for GA project versions, we will clone `gs-guide1`, `gs-guide2` and `gs-guide3` and update their contents with the ones being under your `guides` project.
|
||||
|
||||
You can skip this by either not adding the `guides` profile, or passing the `-DskipGuides` system property when the profile is turned on.
|
||||
You can skip this by either not adding the `guides` profile, or passing the `-DskipGuides` system property when the profile is turned on.
|
||||
|
||||
You can configure the project version passed to guides via the `guides-project.version` (defaults to `${project.version}`). The phase at which guides get updated can be configured by `guides-update.phase` (defaults to `deploy`).
|
||||
@@ -0,0 +1,4 @@
|
||||
releaser:
|
||||
maven:
|
||||
buildCommand: ./scripts/build.sh {{systemProps}}
|
||||
# deployCommand: echo "skip deploy"
|
||||
+98
-1
@@ -10,21 +10,109 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.2.0.M2</version>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<docs.main>spring-cloud-build</docs.main>
|
||||
<!-- Comma separated list of whitelisted branches -->
|
||||
<docs.whitelisted.branches>1.2.x,1.3.x,2.0.x,2.1.x</docs.whitelisted.branches>
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
<gmavenplus-plugin.version>1.8.1</gmavenplus-plugin.version>
|
||||
<groovy.version>2.5.8</groovy.version>
|
||||
<!-- We don't want to downloaded sources of our own project-->
|
||||
<maven-dependency-plugin-for-docs.phase>none</maven-dependency-plugin-for-docs.phase>
|
||||
<docs.resources.dir>${project.basedir}/src/main/</docs.resources.dir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Script -->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-xml</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-nio</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${groovy.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main</directory>
|
||||
<excludes>
|
||||
<exclude>groovy/**/*.*</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>${build-helper-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/groovy</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<version>${gmavenplus-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>addSources</goal>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>groovydoc-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
@@ -36,6 +124,10 @@
|
||||
<id>docs</id>
|
||||
<build>
|
||||
<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>
|
||||
@@ -44,6 +136,10 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
@@ -77,6 +173,7 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<!-- <skip>true</skip> -->
|
||||
<executable>${basedir}/src/test/bash/run-bats.sh</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
META-INF/
|
||||
org/
|
||||
@@ -42,6 +42,24 @@ $ mvn deploy -P central -DaltReleaseDeploymentRepository=sonatype-nexus-staging:
|
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
|
||||
|
||||
== Flattening the POMs
|
||||
|
||||
To avoid propagating build setup that is required to build a Spring Cloud project, we're using the maven flatten plugin. It has the advantage of letting you use whatever features you need while publishing "clean" pom to the repository.
|
||||
|
||||
In order to add it, add the `org.codehaus.mojo:flatten-maven-plugin` to your `pom.xml`.
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
----
|
||||
|
||||
== Reusing the documentation
|
||||
|
||||
Spring Cloud Build publishes its `spring-cloud-build-docs` module that contains
|
||||
@@ -57,33 +75,54 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId> <1>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId> <1>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId> <2>
|
||||
<artifactId>maven-dependency-plugin</artifactId> <2>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId> <3>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId> <4>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId> <3>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId> <5>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId> <4>
|
||||
<artifactId>maven-antrun-plugin</artifactId> <6>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
----
|
||||
<1> This plugin downloads the resources of the `spring-cloud-build-docs` module
|
||||
<2> This plugin unpacks the resources of the `spring-cloud-build-docs` module
|
||||
<3> This plugin is required to parse the Asciidoctor documentation
|
||||
<4> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
|
||||
<2> This plugin downloads sets up all the git information of the project
|
||||
<2> This plugin downloads the resources of the `spring-cloud-build-docs` module
|
||||
<3> This plugin unpacks the resources of the `spring-cloud-build-docs` module
|
||||
<4> This plugin generates an `adoc` file with all the configuration properties from the classpath
|
||||
<5> This plugin is required to parse the Asciidoctor documentation
|
||||
<6> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
|
||||
|
||||
IMPORTANT: The order of plugin declaration is important!
|
||||
|
||||
In order for the build to generate the `adoc` file with all your configuration properties, your `docs` module should contain all the dependencies on the classpath, that you would want to scan for configuration properties. The file will be output to `${docsModule}/src/main/asciidoc/_configprops.adoc` file (configurable via the `configprops.path` property).
|
||||
|
||||
If you want to modify which of the configuration properties are put in the table, you can tweak the `configprops.inclusionPattern` pattern to include only a subset of the properties (e.g. `<configprops.inclusionPattern>spring.sleuth.*</configprops.inclusionPattern>`).
|
||||
|
||||
Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/pom.xml[tags=attributes,indent=0]
|
||||
----
|
||||
|
||||
== Updating the guides
|
||||
|
||||
We assume that your project contains guides under the `guides` folder.
|
||||
|
||||
@@ -131,6 +131,7 @@ $ touch .springformat
|
||||
==== 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/master/spring-cloud-build-tools[Spring Cloud Build] project.
|
||||
|
||||
.spring-cloud-build-tools/
|
||||
----
|
||||
@@ -171,8 +172,8 @@ image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring
|
||||
|
||||
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/master/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/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL.
|
||||
- `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/master/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/master/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.
|
||||
IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources.
|
||||
|
||||
@@ -4,14 +4,20 @@
|
||||
|
||||
set -e
|
||||
|
||||
export GIT_BIN ROOT_FOLDER COMMIT_CHANGES MAVEN_PATH MAVEN_EXEC REPO_NAME SPRING_CLOUD_STATIC_REPO
|
||||
export GIT_BIN ROOT_FOLDER COMMIT_CHANGES MAVEN_PATH MAVEN_EXEC REPO_NAME SPRING_CLOUD_STATIC_REPO SPRING_CLOUD_STATIC_REPO_DESTINATION
|
||||
export CURRENT_BRANCH PREVIOUS_BRANCH
|
||||
export GITHUB_REPO_USERNAME_ENV="${GITHUB_REPO_USERNAME_ENV:-GITHUB_REPO_USERNAME}"
|
||||
export GITHUB_REPO_PASSWORD_ENV="${GITHUB_REPO_PASSWORD_ENV:-GITHUB_REPO_PASSWORD}"
|
||||
REPO_USER="${!GITHUB_REPO_USERNAME_ENV}"
|
||||
REPO_PASS="${!GITHUB_REPO_PASSWORD_ENV}"
|
||||
export SPRING_CLOUD_STATIC_REPO_DESTINATION="${SPRING_CLOUD_STATIC_REPO_DESTINATION:-$( dirname "$(mktemp)")/}"
|
||||
|
||||
GIT_BIN="${GIT_BIN:-git}"
|
||||
|
||||
# The script should be executed from the root folder
|
||||
ROOT_FOLDER="$( pwd )"
|
||||
echo "Current folder is ${ROOT_FOLDER}"
|
||||
echo "Current folder is [${ROOT_FOLDER}]"
|
||||
echo "Spring Cloud Static repo is [${SPRING_CLOUD_STATIC_REPO_DESTINATION}]"
|
||||
|
||||
# Set default props like MAVEN_PATH, ROOT_FOLDER etc.
|
||||
function set_default_props() {
|
||||
@@ -42,20 +48,29 @@ function add_oauth_token_to_remote_url() {
|
||||
local remote
|
||||
remote="$( "${GIT_BIN}" config remote.origin.url | sed -e 's/^git:/https:/' )"
|
||||
echo "Current remote [${remote}]"
|
||||
if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" && ${remote} != *"@"* ]]; then
|
||||
echo "OAuth token found. Will reuse it to push the code"
|
||||
if [[ ${remote} != *".git" ]]; then
|
||||
echo "Remote doesn't end with [.git]"
|
||||
remote="${remote}.git"
|
||||
echo "Remote with [.git] suffix: [${remote}]"
|
||||
fi
|
||||
if [[ "${REPO_USER}" != "" && ${remote} != *"@"* ]]; then
|
||||
withUserAndPass=${remote/https:\/\//https://${REPO_USER}:${REPO_PASS}@}
|
||||
echo "Username and password found. Will reuse it to push the code to [${withUserAndPass}]"
|
||||
"${GIT_BIN}" remote set-url --push origin "${withUserAndPass}"
|
||||
elif [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" && ${remote} != *"@"* ]]; then
|
||||
withToken=${remote/https:\/\//https://${RELEASER_GIT_OAUTH_TOKEN}@}
|
||||
echo "OAuth token found. Will reuse it to push the code to [${withToken}]"
|
||||
"${GIT_BIN}" remote set-url --push origin "${withToken}"
|
||||
else
|
||||
echo "No OAuth token found"
|
||||
"${GIT_BIN}" remote set-url --push origin "$( "${GIT_BIN}" config remote.origin.url | sed -e 's/^git:/https:/' )"
|
||||
echo "No OAuth token found. Will push to [${remote}]"
|
||||
"${GIT_BIN}" remote set-url --push origin "${remote}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if gh-pages exists and docs have been built
|
||||
function check_if_anything_to_sync() {
|
||||
add_oauth_token_to_remote_url
|
||||
if ! ("${GIT_BIN}" remote set-branches --add origin gh-pages && "${GIT_BIN}" fetch -q) && [[ "${RELEASE_TRAIN}" != "yes" ]] ; then
|
||||
if [[ "${RELEASE_TRAIN}" != "yes" ]] && ! ("${GIT_BIN}" remote set-branches --add origin gh-pages && "${GIT_BIN}" fetch -q) ; then
|
||||
echo "No gh-pages, so not syncing"
|
||||
exit 0
|
||||
fi
|
||||
@@ -86,6 +101,8 @@ function retrieve_current_branch() {
|
||||
function switch_to_tag() {
|
||||
if [[ "${RELEASE_TRAIN}" != "yes" ]] ; then
|
||||
"${GIT_BIN}" checkout v"${VERSION}"
|
||||
else
|
||||
echo "Not switching to tag"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -93,6 +110,8 @@ function switch_to_tag() {
|
||||
function build_docs_if_applicable() {
|
||||
if [[ "${BUILD}" == "yes" ]] ; then
|
||||
./mvnw clean install -P docs -pl docs -DskipTests
|
||||
else
|
||||
echo "Not building docs"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -100,13 +119,10 @@ function build_docs_if_applicable() {
|
||||
# Get whitelisted branches - assumes that a `docs` module is available under `docs` profile
|
||||
# shellcheck disable=SC2016
|
||||
function retrieve_doc_properties() {
|
||||
MAIN_ADOC_VALUE=$("${MAVEN_EXEC}" -q \
|
||||
-Dexec.executable="echo" \
|
||||
-Dexec.args='${docs.main}' \
|
||||
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
|
||||
-P docs \
|
||||
-pl docs | tail -1 )
|
||||
echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
|
||||
if [[ "${RELEASE_TRAIN}" == "yes" ]]; then
|
||||
echo "Will not extract any properties for release train"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
WHITELIST_PROPERTY=${WHITELIST_PROPERTY:-"docs.whitelisted.branches"}
|
||||
@@ -137,13 +153,21 @@ function add_docs_from_target() {
|
||||
DESTINATION_REPO_FOLDER="${ROOT_FOLDER}"
|
||||
elif [[ "${CLONE}" == "yes" ]]; then
|
||||
mkdir -p "${ROOT_FOLDER}"/target
|
||||
local clonedStatic="${ROOT_FOLDER}"/target/spring-cloud-static
|
||||
local clonedStatic="${SPRING_CLOUD_STATIC_REPO_DESTINATION}"/spring-cloud-static
|
||||
if [[ ! -e "${clonedStatic}/.git" ]]; then
|
||||
echo "Cloning Spring Cloud Static to target"
|
||||
echo "Cloning Spring Cloud Static to [${clonedStatic}]"
|
||||
"${GIT_BIN}" clone "${SPRING_CLOUD_STATIC_REPO}" "${clonedStatic}" && cd "${clonedStatic}" && "${GIT_BIN}" checkout gh-pages
|
||||
else
|
||||
echo "Spring Cloud Static already cloned - will pull changes"
|
||||
cd "${clonedStatic}" && "${GIT_BIN}" checkout gh-pages && "${GIT_BIN}" pull origin gh-pages
|
||||
echo "Spring Cloud Static already cloned to [${clonedStatic}] - will pull changes"
|
||||
local pullSuccessful="false"
|
||||
cd "${clonedStatic}" && "${GIT_BIN}" checkout gh-pages && "${GIT_BIN}" pull origin gh-pages && pullSuccessful="true" || echo "Failed to clone and pull versions - will remove the folder and clone it again"
|
||||
if [[ "${pullSuccessful}" == "false" ]]; then
|
||||
cd "${ROOT_FOLDER}"
|
||||
echo "Removing the [${clonedStatic}] folder"
|
||||
rm -rf "${clonedStatic}"
|
||||
echo "Cloning Spring Cloud Static again"
|
||||
"${GIT_BIN}" clone "${SPRING_CLOUD_STATIC_REPO}" "${clonedStatic}" && cd "${clonedStatic}" && "${GIT_BIN}" checkout gh-pages
|
||||
fi
|
||||
fi
|
||||
if [[ -z "${RELEASE_TRAIN}" ]] ; then
|
||||
DESTINATION_REPO_FOLDER="${clonedStatic}/${REPO_NAME}"
|
||||
@@ -204,15 +228,8 @@ function copy_docs_for_current_version() {
|
||||
echo "The file [${file}] shouldn't be ignored"
|
||||
# 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_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html"
|
||||
else
|
||||
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
|
||||
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
|
||||
"${GIT_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/${file}" || echo "Failed to add the file [${file}]"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
COMMIT_CHANGES="yes"
|
||||
@@ -246,14 +263,7 @@ function copy_docs_for_branch() {
|
||||
echo "Copying file [${file}] to destination [${destination}]"
|
||||
if ! "${GIT_BIN}" 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
|
||||
else
|
||||
cp -rf "${f}" "${destination}"
|
||||
fi
|
||||
cp -rf "${f}" "${destination}"
|
||||
"${GIT_BIN}" add -A "${destination}"
|
||||
fi
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
spring-cloud-build.adoc
|
||||
Regular → Executable
@@ -0,0 +1,112 @@
|
||||
package org.springframework.cloud.internal
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
import org.springframework.core.io.Resource
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class Main {
|
||||
|
||||
@CompileStatic
|
||||
static void main(String... args) {
|
||||
String outputFile = args[0]
|
||||
String inclusionPattern = args.length > 1 ? args[1] : ".*"
|
||||
File parent = new File(outputFile).parentFile
|
||||
if (!parent.exists()) {
|
||||
println "No parent directory [${parent.toString()}] found. Won't generate the configuration properties file"
|
||||
return
|
||||
}
|
||||
new Generator().generate(outputFile, inclusionPattern)
|
||||
}
|
||||
|
||||
static class Generator {
|
||||
void generate(String outputFile, String inclusionPattern) {
|
||||
println "Parsing all configuration metadata"
|
||||
Resource[] resources = getResources()
|
||||
println "Found [${resources.length}] configuration metadata jsons"
|
||||
TreeSet names = new TreeSet()
|
||||
def descriptions = [:]
|
||||
int count = 0
|
||||
int matchingPropertyCount = 0
|
||||
int propertyCount = 0
|
||||
Pattern pattern = Pattern.compile(inclusionPattern)
|
||||
resources.each { Resource resource ->
|
||||
if (resourceNameContainsPattern(resource)) {
|
||||
count++
|
||||
def slurper = new JsonSlurper()
|
||||
slurper.parseText(resource.inputStream.text).properties.each { val ->
|
||||
propertyCount++
|
||||
if (!pattern.matcher(val.name).matches()) {
|
||||
return
|
||||
}
|
||||
matchingPropertyCount++
|
||||
names.add val.name
|
||||
descriptions[val.name] = new ConfigValue(val.name, val.description, val.defaultValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
println "Found [${count}] Cloud projects configuration metadata jsons. [${matchingPropertyCount}/${propertyCount}] were matching the pattern [${inclusionPattern}]"
|
||||
println "Successfully built the description table"
|
||||
if (names.empty) {
|
||||
println("Will not update the table, since no configuration properties were found!")
|
||||
return
|
||||
}
|
||||
new File(outputFile).text = """\
|
||||
|===
|
||||
|Name | Default | Description
|
||||
|
||||
${names.collect { it -> return descriptions[it] }.join("\n")}
|
||||
|
||||
|===
|
||||
"""
|
||||
println "Successfully stored the output file"
|
||||
}
|
||||
|
||||
protected boolean resourceNameContainsPattern(Resource resource) {
|
||||
try {
|
||||
return resource.getURL().toString().contains("cloud")
|
||||
}
|
||||
catch (Exception e) {
|
||||
println("Exception [${e}] for resource [${resource}] occurred while trying to retrieve its URL")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
protected Resource[] getResources() {
|
||||
return new PathMatchingResourcePatternResolver()
|
||||
.getResources("classpath*:/META-INF/spring-configuration-metadata.json")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@CompileStatic
|
||||
static class ConfigValue {
|
||||
String name
|
||||
String description
|
||||
Object defaultValue
|
||||
|
||||
ConfigValue() {}
|
||||
|
||||
ConfigValue(String name, String description, Object defaultValue) {
|
||||
this.name = name
|
||||
this.description = escapedValue(description)
|
||||
this.defaultValue = escapedValue(defaultValue)
|
||||
}
|
||||
|
||||
private String escapedValue(Object value) {
|
||||
return value != null ?
|
||||
value.toString().replaceAll('\\|', '\\\\|') : ''
|
||||
}
|
||||
|
||||
String toString() {
|
||||
"|${name} | ${defaultValue} | ${description}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,10 @@ end
|
||||
file = ARGV[0] if ARGV.length>0
|
||||
|
||||
# Copied from https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb
|
||||
doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: options[:attributes]
|
||||
attributes = {}
|
||||
attributes['project-root'] = File.expand_path("#{base_dir}/../")
|
||||
|
||||
doc = Asciidoctor.load_file file, safe: :unsafe, header_only: true, attributes: attributes
|
||||
header_attr_names = (doc.instance_variable_get :@attributes_modified).to_a
|
||||
header_attr_names.each {|k| doc.attributes[%(#{k}!)] = '' unless doc.attr? k }
|
||||
attrs = doc.attributes
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.4.RELEASE</version>
|
||||
<version>2.2.0.RC1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.4.RELEASE</version>
|
||||
<version>2.2.0.RC1</version>
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Finchley.SR2</spring-cloud.version>
|
||||
<spring-cloud-contract.version>2.0.2.RELEASE</spring-cloud-contract.version>
|
||||
<spring-cloud.version>Hoxton.BUILD-SNAPSHOT</spring-cloud.version>
|
||||
<spring-cloud-contract.version>2.2.0.BUILD-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.4.RELEASE</version>
|
||||
<version>2.2.0.RC1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.4.RELEASE</version>
|
||||
<version>2.2.0.RC1</version>
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Finchley.SR2</spring-cloud.version>
|
||||
<spring-cloud-contract.version>2.0.2.RELEASE</spring-cloud-contract.version>
|
||||
<spring-cloud.version>Hoxton.BUILD-SNAPSHOT</spring-cloud.version>
|
||||
<spring-cloud-contract.version>2.2.0.BUILD-SNAPSHOT</spring-cloud-contract.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<name>spring-cloud-stream-core-docs</name>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.1.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<scm>
|
||||
@@ -28,8 +28,7 @@
|
||||
<reactor.version>Californium-SR5</reactor.version>
|
||||
<kryo-shaded.version>3.0.3</kryo-shaded.version>
|
||||
<objenesis.version>2.1</objenesis.version>
|
||||
<spring-cloud-function.version>2.1.0.M1
|
||||
</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>3.0.0.BUILD-SNAPSHOT</spring-cloud-function.version>
|
||||
|
||||
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
|
||||
<maven-checkstyle-plugin.failsOnViolation>true</maven-checkstyle-plugin.failsOnViolation>
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-stream-test-support-internal</artifactId>
|
||||
<description>Set of classes and utility code that may assist in testing both
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-stream-test-support</artifactId>
|
||||
<description>A set of classes to ease testing of Spring Cloud Stream modules.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.1.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<version>Horsham.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -15,6 +15,9 @@ setup() {
|
||||
mv "${TEMP_DIR}/spring-cloud-static/git" "${TEMP_DIR}/spring-cloud-static/.git"
|
||||
|
||||
export SOURCE_FUNCTIONS="true"
|
||||
export GITHUB_REPO_USERNAME_ENV="MY_REPO_USERNAME"
|
||||
export GITHUB_REPO_PASSWORD_ENV="MY_REPO_PASSWORD"
|
||||
export SPRING_CLOUD_STATIC_REPO_DESTINATION="${TEMP_DIR}"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@@ -34,7 +37,7 @@ function git_with_remotes {
|
||||
if [[ "$*" == *"set-url"* ]]; then
|
||||
echo "git $*"
|
||||
elif [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
else
|
||||
git $*
|
||||
fi
|
||||
@@ -54,7 +57,7 @@ function printing_git_failing_with_diff_index {
|
||||
|
||||
function printing_git_with_remotes {
|
||||
if [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
else
|
||||
printing_git $*
|
||||
fi
|
||||
@@ -62,7 +65,7 @@ function printing_git_with_remotes {
|
||||
|
||||
function stubbed_git {
|
||||
if [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
elif [[ "$*" == *"diff-index"* ]]; then
|
||||
return 1
|
||||
elif [[ "$*" == *"symbolic-ref"* ]]; then
|
||||
@@ -86,13 +89,13 @@ export -f stubbed_git
|
||||
export RELEASER_GIT_OAUTH_TOKEN="mytoken"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
touch docs/target/generated-docs/example1.html
|
||||
|
||||
run "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "Spring Cloud Static repo is [${TEMP_DIR}]"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git fetch -q"
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "git stash"
|
||||
@@ -101,7 +104,7 @@ export -f stubbed_git
|
||||
# Current branch is master - will copy the current docs only to the root folder
|
||||
assert_output --partial "git add -A ${TEMP_DIR}/spring-cloud-stream"
|
||||
assert_output --partial "git commit -a -m Sync docs from master to gh-pages"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git push origin gh-pages"
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "git stash pop"
|
||||
@@ -116,27 +119,26 @@ export -f stubbed_git
|
||||
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
touch docs/target/generated-docs/example1.html
|
||||
|
||||
run "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "Spring Cloud Static repo is [${TEMP_DIR}]"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git remote set-branches --add origin gh-pages"
|
||||
assert_output --partial "git fetch -q"
|
||||
# Previous branch was [master]
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "git checkout v1.0.0.RELEASE"
|
||||
assert_output --partial "Extracted 'main.adoc' from Maven build [home]"
|
||||
assert_output --partial "git stash"
|
||||
assert_output --partial "git checkout gh-pages"
|
||||
assert_output --partial "git pull origin gh-pages"
|
||||
# Current branch is master - will copy the current docs only to the root folder
|
||||
assert [ -f "${TEMP_DIR}/spring-cloud-static/spring-cloud-stream/${VERSION}/foo.html" ]
|
||||
assert [ -f "${TEMP_DIR}/spring-cloud-static/spring-cloud-stream/${VERSION}/example1.html" ]
|
||||
assert_output --partial "git add -A ${TEMP_DIR}/spring-cloud-static/spring-cloud-stream/${VERSION}"
|
||||
assert_output --partial "git commit -a -m Sync docs from v1.0.0.RELEASE to gh-pages"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git push origin gh-pages"
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "git stash pop"
|
||||
@@ -152,26 +154,22 @@ export -f stubbed_git
|
||||
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
touch docs/target/generated-docs/example1.html
|
||||
|
||||
run "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-branches --add origin gh-pages"
|
||||
assert_output --partial "git fetch -q"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
# Previous branch was [master]
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "Extracted 'main.adoc' from Maven build [home]"
|
||||
assert_output --partial "git stash"
|
||||
assert_output --partial "git checkout gh-pages"
|
||||
assert_output --partial "git pull origin gh-pages"
|
||||
# Current branch is master - will copy the current docs only to the root folder
|
||||
assert [ -f "${TEMP_DIR}/spring-cloud-static/${VERSION}/foo.html" ]
|
||||
assert [ -f "${TEMP_DIR}/spring-cloud-static/${VERSION}/example1.html" ]
|
||||
assert_output --partial "git add -A ${TEMP_DIR}/spring-cloud-static/${VERSION}"
|
||||
assert_output --partial "git commit -a -m Sync docs from vGreenwich.SR2 to gh-pages"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git push origin gh-pages"
|
||||
assert_output --partial "git checkout master"
|
||||
assert_output --partial "git stash pop"
|
||||
@@ -202,7 +200,7 @@ export -f stubbed_git
|
||||
run add_oauth_token_to_remote_url
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git remote set-url --push origin https://foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://example1.example2/example3.git"
|
||||
}
|
||||
|
||||
@test "should add auth token to URL if token is present" {
|
||||
@@ -215,7 +213,7 @@ export -f stubbed_git
|
||||
run add_oauth_token_to_remote_url
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
}
|
||||
|
||||
@test "should retrieve the name of the current branch" {
|
||||
@@ -298,21 +296,6 @@ export -f stubbed_git
|
||||
assert_output --partial "clean install"
|
||||
}
|
||||
|
||||
@test "should retrieve maven properties for docs" {
|
||||
export WHITELIST_PROPERTY="spring-doc-resources.version"
|
||||
export MAVEN_EXEC="./mvnw"
|
||||
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
retrieve_doc_properties
|
||||
|
||||
assert_success
|
||||
assert [ "${MAIN_ADOC_VALUE}" == "home" ]
|
||||
assert [ "${WHITELISTED_BRANCHES_VALUE}" == "0.1.1.RELEASE" ]
|
||||
}
|
||||
|
||||
@test "should stash changes if dirty" {
|
||||
export GIT_BIN="printing_git_failing_with_diff_index"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
@@ -342,8 +325,7 @@ export -f stubbed_git
|
||||
export CURRENT_BRANCH="master"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
touch docs/target/generated-docs/example1.html
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
@@ -357,11 +339,10 @@ export -f stubbed_git
|
||||
export GIT_BIN="printing_git"
|
||||
export CURRENT_BRANCH="present"
|
||||
export WHITELISTED_BRANCHES_VALUE="present"
|
||||
export MAIN_ADOC_VALUE="my_doc"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
touch docs/target/generated-docs/my_doc.html
|
||||
touch docs/target/generated-docs/example1.html
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
@@ -373,8 +354,8 @@ export -f stubbed_git
|
||||
run copy_docs_for_current_version
|
||||
|
||||
assert_success
|
||||
assert_output --partial "add -A ${ROOT_FOLDER}/present/index.html"
|
||||
assert_output --partial "add -A ${ROOT_FOLDER}/present/foo.html"
|
||||
assert_output --partial "add -A ${ROOT_FOLDER}/present/my_doc.html"
|
||||
assert_output --partial "add -A ${ROOT_FOLDER}/present/example1.html"
|
||||
}
|
||||
|
||||
@test "should do nothing if current branch is not whitelisted" {
|
||||
@@ -390,58 +371,6 @@ export -f stubbed_git
|
||||
assert [ "${COMMIT_CHANGES}" != "yes" ]
|
||||
}
|
||||
|
||||
@test "should reuse main adoc value as new index.html" {
|
||||
export GIT_BIN="printing_git"
|
||||
export DESTINATION_REPO_FOLDER="${TEMP_DIR}/spring-cloud-static"
|
||||
export VERSION="1.0.0.RELEASE"
|
||||
export MAIN_ADOC_VALUE="my_doc"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
copy_docs_for_provided_version
|
||||
|
||||
assert_success
|
||||
assert [ "${COMMIT_CHANGES}" == "yes" ]
|
||||
assert [ "${CURRENT_BRANCH}" == "v${VERSION}" ]
|
||||
|
||||
run copy_docs_for_provided_version
|
||||
|
||||
assert_success
|
||||
assert_output --partial "add -A ${DESTINATION_REPO_FOLDER}/${VERSION}"
|
||||
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/index.html" ]
|
||||
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/foo.html" ]
|
||||
}
|
||||
|
||||
@test "should reuse repo name as new index.html" {
|
||||
export GIT_BIN="printing_git"
|
||||
export DESTINATION_REPO_FOLDER="${TEMP_DIR}/spring-cloud-static"
|
||||
export VERSION="1.0.0.RELEASE"
|
||||
export REPO_NAME="spring-cloud-stream"
|
||||
cd "${TEMP_DIR}/spring-cloud-stream/"
|
||||
mkdir -p docs/target/generated-docs/
|
||||
touch docs/target/generated-docs/${REPO_NAME}.html
|
||||
touch docs/target/generated-docs/foo.html
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
copy_docs_for_provided_version
|
||||
|
||||
assert_success
|
||||
assert [ "${COMMIT_CHANGES}" == "yes" ]
|
||||
assert [ "${CURRENT_BRANCH}" == "v${VERSION}" ]
|
||||
|
||||
run copy_docs_for_provided_version
|
||||
|
||||
assert_success
|
||||
assert_output --partial "add -A ${DESTINATION_REPO_FOLDER}/${VERSION}"
|
||||
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/index.html" ]
|
||||
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/foo.html" ]
|
||||
}
|
||||
|
||||
@test "should not do anything if commit flag not set" {
|
||||
export GIT_BIN="printing_git_with_remotes"
|
||||
export COMMIT_CHANGES="no"
|
||||
@@ -465,7 +394,23 @@ export -f stubbed_git
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git commit -a -m Sync docs from to gh-pages"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
assert_output --partial "git push origin gh-pages"
|
||||
}
|
||||
|
||||
@test "should commit changes with username and password if commit flag set" {
|
||||
export GIT_BIN="printing_git_with_remotes"
|
||||
export COMMIT_CHANGES="yes"
|
||||
export MY_REPO_USERNAME="username"
|
||||
export MY_REPO_PASSWORD="password"
|
||||
|
||||
source "${SOURCE_DIR}"/ghpages.sh
|
||||
|
||||
run commit_changes_if_applicable
|
||||
|
||||
assert_success
|
||||
assert_output --partial "git commit -a -m Sync docs from to gh-pages"
|
||||
assert_output --partial "git remote set-url --push origin https://username:password@example1.example2/example3.git"
|
||||
assert_output --partial "git push origin gh-pages"
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ function git_with_remotes {
|
||||
if [[ "$*" == *"set-url"* ]]; then
|
||||
echo "git $*"
|
||||
elif [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
else
|
||||
git $*
|
||||
fi
|
||||
@@ -45,7 +45,7 @@ function printing_git {
|
||||
|
||||
function printing_git_with_remotes {
|
||||
if [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
else
|
||||
printing_git $*
|
||||
fi
|
||||
@@ -53,7 +53,7 @@ function printing_git_with_remotes {
|
||||
|
||||
function stubbed_git {
|
||||
if [[ "$*" == *"config remote.origin.url"* ]]; then
|
||||
echo "git://foo.bar/baz.git"
|
||||
echo "git://example1.example2/example3.git"
|
||||
elif [[ "$*" == *"commit"* ]]; then
|
||||
printing_git $*
|
||||
elif [[ "$*" == *"push"* ]]; then
|
||||
@@ -111,7 +111,7 @@ export -f stubbed_git
|
||||
|
||||
assert_success
|
||||
# change remote
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@foo.bar/baz.git"
|
||||
assert_output --partial "git remote set-url --push origin https://mytoken@example1.example2/example3.git"
|
||||
# commit and push
|
||||
assert_output --partial "git commit -m Updating guides"
|
||||
assert_output --partial "git push origin master"
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
class GeneratorTests {
|
||||
|
||||
URL root = GeneratorTests.class.getResource(".");
|
||||
|
||||
@Test
|
||||
void should_not_create_a_file_when_no_properties_were_found()
|
||||
throws URISyntaxException {
|
||||
Main.Generator generator = new Main.Generator() {
|
||||
@Override
|
||||
protected Resource[] getResources() {
|
||||
return new Resource[0];
|
||||
}
|
||||
};
|
||||
File file = new File(root.toURI().toString(), "output.adoc");
|
||||
String inclusionPattern = ".*";
|
||||
|
||||
generator.generate(file.getAbsolutePath(), inclusionPattern);
|
||||
|
||||
then(file).doesNotExist();
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_create_a_file_when_cloud_file_was_found() {
|
||||
Main.Generator generator = new Main.Generator() {
|
||||
@Override
|
||||
protected Resource[] getResources() {
|
||||
return new Resource[] { resource("/not-matching-name.json"),
|
||||
resource("/with-cloud-in-name.json") };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean resourceNameContainsPattern(Resource resource) {
|
||||
try {
|
||||
return resource.getURI().toString().contains("with-cloud");
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
File file = new File(root.getFile().toString(), "output.adoc");
|
||||
String inclusionPattern = ".*";
|
||||
|
||||
generator.generate(file.getAbsolutePath(), inclusionPattern);
|
||||
|
||||
then(file).exists();
|
||||
then(asString(file)).contains("spring.first-property")
|
||||
.contains("unmatched.second-property")
|
||||
.doesNotContain("example1.first-property");
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_create_a_file_when_spring_property_was_found() {
|
||||
Main.Generator generator = new Main.Generator() {
|
||||
@Override
|
||||
protected Resource[] getResources() {
|
||||
return new Resource[] { resource("/not-matching-name.json"),
|
||||
resource("/with-cloud-in-name.json") };
|
||||
}
|
||||
};
|
||||
File file = new File(root.getFile().toString(), "output.adoc");
|
||||
String inclusionPattern = "spring.*";
|
||||
|
||||
generator.generate(file.getAbsolutePath(), inclusionPattern);
|
||||
|
||||
then(file).exists();
|
||||
then(asString(file)).contains("spring.first-property")
|
||||
.doesNotContain("example1.first-property")
|
||||
.doesNotContain("unmatched.second-property");
|
||||
}
|
||||
|
||||
static String asString(File file) {
|
||||
try {
|
||||
return new String(Files.readAllBytes(file.toPath()));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
static Resource resource(String path) {
|
||||
return new FileSystemResource(GeneratorTests.class.getResource(path).getFile());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
class MainTests {
|
||||
|
||||
@Test
|
||||
void should_do_nothing_when_parent_dir_is_not_found() {
|
||||
File nonExistantFile = new File("/this/file/does/not/exist");
|
||||
|
||||
Main.main(nonExistantFile.getAbsolutePath());
|
||||
|
||||
then(nonExistantFile).doesNotExist();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"defaultValue": "false",
|
||||
"name": "example1.first-property",
|
||||
"description": "First Description",
|
||||
"type": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"defaultValue": "true",
|
||||
"name": "example2.second-property",
|
||||
"description": "Second Description",
|
||||
"type": "java.lang.Boolean"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"defaultValue": "false",
|
||||
"name": "spring.first-property",
|
||||
"description": "First Description",
|
||||
"type": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"defaultValue": "true",
|
||||
"name": "unmatched.second-property",
|
||||
"description": "Second Description",
|
||||
"type": "java.lang.Boolean"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.2.0.M2</version>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Spring Cloud Parent</name>
|
||||
<description>Spring Cloud parent pom, managing plugins and dependencies for Spring
|
||||
@@ -28,15 +28,20 @@
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<main.basedir>${basedir}</main.basedir>
|
||||
<docs.main>${project.artifactId}</docs.main>
|
||||
<spring-boot.version>2.2.0.M3</spring-boot.version>
|
||||
<spring-cloud-build.version>2.2.0.M2</spring-cloud-build.version>
|
||||
<spring-boot.version>2.2.1.RELEASE</spring-boot.version>
|
||||
<spring-cloud-build.version>2.2.0.RELEASE</spring-cloud-build.version>
|
||||
<docs.resources.dir>${project.build.directory}/build-docs</docs.resources.dir>
|
||||
<refdocs.build.directory>${project.build.directory}/refdocs/</refdocs.build.directory>
|
||||
<spring-doc-resources.version>0.1.0.RELEASE</spring-doc-resources.version>
|
||||
<spring-asciidoctor-extensions.version>0.1.0.RELEASE
|
||||
<spring-asciidoctor-extensions.version>0.1.3.RELEASE
|
||||
</spring-asciidoctor-extensions.version>
|
||||
<asciidoctorj-pdf.version>1.5.0-alpha.16</asciidoctorj-pdf.version>
|
||||
<asciidoctorj-pdf.version>1.5.0-alpha.18</asciidoctorj-pdf.version>
|
||||
<asciidoctorj-diagram.version>1.5.18</asciidoctorj-diagram.version>
|
||||
<guides-project.version>${project.version}</guides-project.version>
|
||||
<guides-update.phase>deploy</guides-update.phase>
|
||||
<revision>${project.version}</revision>
|
||||
<asciidoctorj.version>1.5.8</asciidoctorj.version>
|
||||
<jruby-complete.version>9.2.7.0</jruby-complete.version>
|
||||
|
||||
<!-- Sonar -->
|
||||
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
|
||||
@@ -61,12 +66,12 @@
|
||||
<maven-war-plugin.version>3.2.2</maven-war-plugin.version>
|
||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
|
||||
<git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
|
||||
<git-commit-id-plugin.version>3.0.0</git-commit-id-plugin.version>
|
||||
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
|
||||
<maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
|
||||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
|
||||
<asciidoctor-maven-plugin.version>1.5.7.1</asciidoctor-maven-plugin.version>
|
||||
<asciidoctor-maven-plugin.version>1.5.8</asciidoctor-maven-plugin.version>
|
||||
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
|
||||
<artifactory-maven-plugin.version>2.2.1</artifactory-maven-plugin.version>
|
||||
<license-maven-plugin.version>1.16</license-maven-plugin.version>
|
||||
@@ -89,8 +94,14 @@
|
||||
<checkstyle.additional.suppressions.file>
|
||||
${maven.multiModuleProjectDirectory}/src/checkstyle/checkstyle-suppressions.xml
|
||||
</checkstyle.additional.suppressions.file>
|
||||
<nohttp-checkstyle.version>0.0.1.BUILD-SNAPSHOT</nohttp-checkstyle.version>
|
||||
<nohttp-checkstyle.version>0.0.2.RELEASE</nohttp-checkstyle.version>
|
||||
<disable.nohttp.checks>true</disable.nohttp.checks>
|
||||
<antelopetasks.version>3.2.10</antelopetasks.version>
|
||||
<ant-nodeps.version>1.8.1</ant-nodeps.version>
|
||||
<configprops.path>${project.basedir}/src/main/asciidoc/_configprops.adoc</configprops.path>
|
||||
<configprops.inclusionPattern>.*</configprops.inclusionPattern>
|
||||
<maven-dependency-plugin-for-docs.phase>generate-resources</maven-dependency-plugin-for-docs.phase>
|
||||
<maven-dependency-plugin-for-guides.phase>generate-resources</maven-dependency-plugin-for-guides.phase>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -242,42 +253,33 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>oss</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<distributionManagement>remove</distributionManagement>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
<executions>
|
||||
<!– enable flattening –>
|
||||
<execution>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<!– ensure proper cleanup –>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Tidy up all POMs before they are published -->
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>oss</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<distributionManagement>remove</distributionManagement>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Apply more sensible defaults for user projects -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -481,6 +483,7 @@
|
||||
<generateGitPropertiesFilename>
|
||||
${project.build.outputDirectory}/git.properties
|
||||
</generateGitPropertiesFilename>
|
||||
<skipPoms>false</skipPoms>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Support our own plugin -->
|
||||
@@ -791,7 +794,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-docs</id>
|
||||
<phase>generate-resources</phase>
|
||||
<phase>${maven-dependency-plugin-for-guides.phase}</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
@@ -917,7 +920,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-docs</id>
|
||||
<phase>generate-resources</phase>
|
||||
<phase>${maven-dependency-plugin-for-docs.phase}</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
@@ -932,7 +935,7 @@
|
||||
</version>
|
||||
<classifier>sources</classifier>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${docs.resources.dir}
|
||||
</outputDirectory>
|
||||
</artifactItem>
|
||||
@@ -953,7 +956,7 @@
|
||||
<version>${spring-doc-resources.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.build.directory}/refdocs/</outputDirectory>
|
||||
<outputDirectory>${refdocs.build.directory}</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
@@ -984,6 +987,41 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>${exec-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-configprops</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud
|
||||
</groupId>
|
||||
<artifactId>spring-cloud-build-docs
|
||||
</artifactId>
|
||||
<version>${spring-cloud-build.version}
|
||||
</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<includePluginDependencies>
|
||||
true
|
||||
</includePluginDependencies>
|
||||
<mainClass>org.springframework.cloud.internal.Main</mainClass>
|
||||
<arguments>
|
||||
<argument>${configprops.path}</argument>
|
||||
<argument>${configprops.inclusionPattern}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
@@ -999,10 +1037,65 @@
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>${asciidoctorj-pdf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-diagram</artifactId>
|
||||
<version>${asciidoctorj-diagram.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<sourceDirectory>${project.build.directory}/refdocs/</sourceDirectory>
|
||||
<sourceDocumentName>${docs.main}.adoc</sourceDocumentName>
|
||||
<sourceDirectory>${refdocs.build.directory}</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${refdocs.build.directory}</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.*adoc</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<!-- tag::attributes[] -->
|
||||
<attributes>
|
||||
<docinfo>shared</docinfo>
|
||||
<allow-uri-read>true</allow-uri-read>
|
||||
<nofooter/>
|
||||
<toc>left</toc>
|
||||
<toc-levels>4</toc-levels>
|
||||
<sectlinks>true</sectlinks>
|
||||
<sources-root>${project.basedir}/src</sources-root>
|
||||
<asciidoc-sources-root>${project.basedir}/src/main/asciidoc</asciidoc-sources-root>
|
||||
<generated-resources-root>${project.basedir}/target/generated-resources
|
||||
</generated-resources-root>
|
||||
<!-- Use this attribute the reference code from another module -->
|
||||
<!-- Note the @ at the end, lowering the precedence of the attribute -->
|
||||
<project-root>${maven.multiModuleProjectDirectory}@</project-root>
|
||||
<!-- It's mandatory for you to pass the docs.main property -->
|
||||
<github-repo>${docs.main}</github-repo>
|
||||
<github-raw>
|
||||
https://raw.githubusercontent.com/spring-cloud/${docs.main}/${github-tag}@
|
||||
</github-raw>
|
||||
<github-code>https://github.com/spring-cloud/${docs.main}/tree/${github-tag}@
|
||||
</github-code>
|
||||
<github-issues>https://github.com/spring-cloud/${docs.main}/issues/@</github-issues>
|
||||
<github-wiki>https://github.com/spring-cloud/${docs.main}/wiki@</github-wiki>
|
||||
<github-master-code>https://github.com/spring-cloud/${docs.main}/tree/master
|
||||
</github-master-code>
|
||||
<index-link>${index-link}@</index-link>
|
||||
|
||||
<!-- Spring Cloud specific -->
|
||||
<!-- for backward compatibility -->
|
||||
<spring-cloud-version>${project.version}@</spring-cloud-version>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<github-tag>${github-tag}@</github-tag>
|
||||
<version-type>${version-type}@</version-type>
|
||||
<docs-url>${docs-url}@</docs-url>
|
||||
<raw-docs-url>${raw-docs-url}@</raw-docs-url>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<project-name>${docs.main}@</project-name>
|
||||
</attributes>
|
||||
<!-- end::attributes[] -->
|
||||
<requires>
|
||||
<require>asciidoctor-diagram</require>
|
||||
</requires>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -1013,35 +1106,84 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>html5</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.adoc</sourceDocumentExtension>
|
||||
<sourceDocumentExtension>.htmladoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>${project.build.directory}/generated-docs/reference/html
|
||||
</outputDirectory>
|
||||
<sourceHighlighter>highlight.js</sourceHighlighter>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
// these attributes are required to use the doc resources
|
||||
<docinfo>shared</docinfo>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>spring.css</stylesheet>
|
||||
<linkcss>true</linkcss>
|
||||
<icons>font</icons>
|
||||
<highlightjsdir>js/highlight</highlightjsdir>
|
||||
<highlightjs-theme>atom-one-dark-reasonable</highlightjs-theme>
|
||||
<allow-uri-read>true</allow-uri-read>
|
||||
<nofooter/>
|
||||
<toc>left</toc>
|
||||
<toc-levels>4</toc-levels>
|
||||
<spring-cloud-version>${project.version}</spring-cloud-version>
|
||||
<sectlinks>true</sectlinks>
|
||||
<linkcss>true</linkcss>
|
||||
<imagesdir>./images</imagesdir>
|
||||
<icons>font</icons>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>spring.css</stylesheet>
|
||||
<attribute-missing>warn</attribute-missing>
|
||||
</attributes>
|
||||
<outputFile>${docs.main}.html</outputFile>
|
||||
<logHandler>
|
||||
<outputToConsole>true</outputToConsole>
|
||||
<failIf>
|
||||
<!-- <severity>DEBUG</severity>-->
|
||||
</failIf>
|
||||
</logHandler>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-htmlsingle-documentation</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>html5</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.htmlsingleadoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/generated-docs/reference/htmlsingle
|
||||
</outputDirectory>
|
||||
<sourceHighlighter>highlight.js</sourceHighlighter>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
<highlightjsdir>js/highlight</highlightjsdir>
|
||||
<highlightjs-theme>atom-one-dark-reasonable</highlightjs-theme>
|
||||
<linkcss>true</linkcss>
|
||||
<imagesdir>./images</imagesdir>
|
||||
<icons>font</icons>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>spring.css</stylesheet>
|
||||
</attributes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-pdf-documentation</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>pdf</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.pdfadoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>${project.build.directory}/generated-docs/reference/pdf
|
||||
</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${refdocs.build.directory}</directory>
|
||||
<excludes>
|
||||
<exclude>**/*</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>${build-helper-maven-plugin.version}</version>
|
||||
<inherited>false</inherited>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
@@ -1061,22 +1203,22 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-nodeps</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>${ant-nodeps.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tigris.antelope</groupId>
|
||||
<artifactId>antelopetasks</artifactId>
|
||||
<version>3.2.10</version>
|
||||
<version>${antelopetasks.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jruby</groupId>
|
||||
<artifactId>jruby-complete</artifactId>
|
||||
<version>1.7.17</version>
|
||||
<version>${jruby-complete.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj</artifactId>
|
||||
<version>1.5.8</version>
|
||||
<version>${asciidoctorj.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
@@ -1119,57 +1261,116 @@
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>package-and-attach-docs-zip</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<zip
|
||||
destfile="${project.build.directory}/${project.artifactId}-${revision}.zip">
|
||||
<!--<zipfileset
|
||||
src="${project.build.directory}/${project.artifactId}-${revision}-javadoc.jar"
|
||||
prefix="api" />-->
|
||||
<!-- <fileset dir="${project.build.directory}/contents"/>-->
|
||||
<fileset dir="${project.build.directory}/generated-docs"/>
|
||||
</zip>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>setup-maven-properties</id>
|
||||
<phase>validate</phase>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<exportAntProperties>true</exportAntProperties>
|
||||
<target>
|
||||
<taskdef
|
||||
resource="net/sf/antcontrib/antcontrib.properties"/>
|
||||
<taskdef name="stringutil"
|
||||
classname="ise.antelope.tasks.StringUtilTask"/>
|
||||
<var name="version-type"
|
||||
value="${project.version}"/>
|
||||
<propertyregex property="version-type"
|
||||
override="true"
|
||||
input="${version-type}"
|
||||
regexp=".*\.(.*)"
|
||||
replace="\1"/>
|
||||
<propertyregex property="version-type"
|
||||
override="true"
|
||||
input="${version-type}"
|
||||
regexp="(M)\d+"
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
|
||||
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask"/>
|
||||
<var name="version-type" value="${revision}"/>
|
||||
<propertyregex property="version-type" override="true"
|
||||
input="${version-type}" regexp=".*\.(.*)" replace="\1"/>
|
||||
<propertyregex property="version-type" override="true"
|
||||
input="${version-type}" regexp="(M)\d+" replace="MILESTONE"/>
|
||||
<propertyregex property="version-type" override="true"
|
||||
input="${version-type}" regexp="(RC)\d+"
|
||||
replace="MILESTONE"/>
|
||||
<propertyregex property="version-type"
|
||||
override="true"
|
||||
input="${version-type}"
|
||||
regexp="(RC)\d+"
|
||||
replace="MILESTONE"/>
|
||||
<propertyregex property="version-type"
|
||||
override="true"
|
||||
input="${version-type}"
|
||||
regexp="BUILD-(.*)"
|
||||
<propertyregex property="version-type" override="true"
|
||||
input="${version-type}" regexp="BUILD-(.*)"
|
||||
replace="SNAPSHOT"/>
|
||||
<stringutil string="${version-type}"
|
||||
property="spring-cloud-repo">
|
||||
<stringutil string="${version-type}" property="spring-cloud-repo">
|
||||
<lowercase/>
|
||||
</stringutil>
|
||||
<var name="github-tag"
|
||||
value="v${project.version}"/>
|
||||
<propertyregex property="github-tag"
|
||||
override="true"
|
||||
input="${github-tag}"
|
||||
regexp=".*SNAPSHOT"
|
||||
replace="master"/>
|
||||
<propertyregex property="git.branch" override="true"
|
||||
input="${git.branch}" regexp="origin/(.*)"
|
||||
replace="\1"/>
|
||||
<var name="github-tag" value="${git.branch}"/>
|
||||
<condition property="docs-url"
|
||||
value="https://cloud.spring.io/${docs.main}">
|
||||
<and>
|
||||
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
|
||||
<or>
|
||||
<equals arg1="${git.branch}" arg2="master"/>
|
||||
<equals arg1="${git.branch}" arg2="origin/master"/>
|
||||
</or>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="docs-url"
|
||||
value="https://cloud.spring.io/${docs.main}/${git.branch}">
|
||||
<and>
|
||||
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
|
||||
<not>
|
||||
<or>
|
||||
<equals arg1="${git.branch}" arg2="master"/>
|
||||
<equals arg1="${git.branch}" arg2="origin/master"/>
|
||||
</or>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="docs-url"
|
||||
value="https://cloud.spring.io/spring-cloud-static/${docs.main}/${project.version}">
|
||||
<and>
|
||||
<not>
|
||||
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<propertyregex property="raw-docs-url" override="true"
|
||||
input="${docs-url}" regexp="https://cloud.spring.io/(.*)"
|
||||
replace="https://raw.githubusercontent.com/\1"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>${build-helper-maven-plugin.version}</version>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-zip</id>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>
|
||||
${project.build.directory}/${project.artifactId}-${project.version}.zip
|
||||
</file>
|
||||
<type>zip</type>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jfrog.buildinfo</groupId>
|
||||
<artifactId>artifactory-maven-plugin</artifactId>
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
./mvnw clean install -B -Pdocs ${@}
|
||||
#./mvnw clean install -B -DskipTests ${@}
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build-dependencies</artifactId>
|
||||
<version>2.2.0.M2</version>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
<name>spring-cloud-build-dependencies</name>
|
||||
<packaging>pom</packaging>
|
||||
<description>Spring Cloud Build Dependencies: an internal BOM for use with Spring
|
||||
@@ -14,28 +14,49 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.2.0.M3</version>
|
||||
<version>2.2.1.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-boot.version>2.2.0.M3</spring-boot.version>
|
||||
<spring-boot.version>2.2.1.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Flatten and simplify our own POM for install/deploy -->
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>bom</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<pluginManagement>keep</pluginManagement>
|
||||
<properties>keep</properties>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten-clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<downloadUrl>https://github.com/spring-cloud</downloadUrl>
|
||||
<site>
|
||||
@@ -98,6 +119,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.2.0.M2</version>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
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>
|
||||
<version>2.2.0.M2</version>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>spring-cloud-dependencies-parent</name>
|
||||
@@ -130,9 +130,42 @@
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Flatten and simplify our own POM for install/deploy -->
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>bom</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<pluginManagement>keep</pluginManagement>
|
||||
<properties>keep</properties>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten-clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@@ -195,41 +228,6 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<plugins>
|
||||
<!--<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>oss</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<distributionManagement>remove</distributionManagement>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
<executions>
|
||||
<!– enable flattening –>
|
||||
<execution>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<!– ensure proper cleanup –>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
Reference in New Issue
Block a user