Migrates documentation to Antora (#241)
* Migrate Structure * Insert explicit ids for headers * Copy default antora files * Fix indentation for all pages * Generate a default navigation * Remove includes * Enable Section Summary TOC for small pages * WIP * Updated the docs * Removed unnecessary file deployment step * Left deploy goal only * Fixed configprops location * Fixed gitignores and path of configprops generation * Upgraded ui bundle * Removed node files * Removed unnecessary docs zip uploading
This commit is contained in:
committed by
GitHub
parent
573ef75c97
commit
2282c2400a
33
.github/workflows/deploy-docs.yml
vendored
Normal file
33
.github/workflows/deploy-docs.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
# FIXME: enable when pushed to spring-projects
|
||||
# if: github.repository_owner == 'spring-projects'
|
||||
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)
|
||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -18,4 +18,12 @@ _site/
|
||||
.factorypath
|
||||
.vscode/
|
||||
.flattened-pom.xml
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
node_modules
|
||||
node
|
||||
_configprops.adoc
|
||||
_spans.adoc
|
||||
_metrics.adoc
|
||||
_conventions.adoc
|
||||
package.json
|
||||
package-lock.json
|
||||
63
README.adoc
63
README.adoc
@@ -10,7 +10,8 @@ image::https://github.com/spring-cloud/spring-cloud-build/workflows/Build/badge.
|
||||
Spring Cloud Build is a common utility project for Spring Cloud
|
||||
to use for plugin and dependency management.
|
||||
|
||||
== Building and Deploying
|
||||
[[building-and-deploying]]
|
||||
= Building and Deploying
|
||||
|
||||
To install locally:
|
||||
|
||||
@@ -45,7 +46,8 @@ $ mvn deploy -P central -DaltReleaseDeploymentRepository=sonatype-nexus-staging:
|
||||
|
||||
(the "central" profile is available for all projects in Spring Cloud and it sets up the gpg jar signing, and the repository has to be specified separately for this project because it is a parent of the starter parent which users in turn have as their own parent).
|
||||
|
||||
== Contributing
|
||||
[[contributing]]
|
||||
= Contributing
|
||||
|
||||
:spring-cloud-build-branch: master
|
||||
|
||||
@@ -278,7 +280,8 @@ If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your s
|
||||
----
|
||||
|
||||
|
||||
== Flattening the POMs
|
||||
[[flattening-the-poms]]
|
||||
= 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.
|
||||
|
||||
@@ -296,7 +299,8 @@ In order to add it, add the `org.codehaus.mojo:flatten-maven-plugin` to your `po
|
||||
</build>
|
||||
----
|
||||
|
||||
== Reusing the documentation
|
||||
[[reusing-the-documentation]]
|
||||
= Reusing the documentation
|
||||
|
||||
Spring Cloud Build publishes its `spring-cloud-build-docs` module that contains
|
||||
helpful scripts (e.g. README generation ruby script) and css, xslt and images
|
||||
@@ -305,9 +309,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<properties>
|
||||
<upload-docs-zip.phase>deploy</upload-docs-zip.phase> <8>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>docs</id>
|
||||
@@ -351,8 +352,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
<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
|
||||
<7> This plugin ensures that the generated zip docs will get published
|
||||
<8> This property turns on the "deploy" phase for <7>
|
||||
|
||||
IMPORTANT: The order of plugin declaration is important!
|
||||
|
||||
@@ -362,51 +361,13 @@ If you want to modify which of the configuration properties are put in the table
|
||||
|
||||
Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.
|
||||
|
||||
[source,xml]
|
||||
[source,yml]
|
||||
----
|
||||
<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-project>https://github.com/spring-cloud/${docs.main}@</github-project>
|
||||
<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>https://docs.spring.io/${docs.main}/docs/${project.version}@</docs-url>
|
||||
<raw-docs-url>${github-raw}@</raw-docs-url>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<project-name>${docs.main}@</project-name>
|
||||
<source-highlighter>highlight.js</source-highlighter>
|
||||
</attributes>
|
||||
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/antora/resources/antora-resources/antora.yml[indent=0]
|
||||
----
|
||||
|
||||
== Updating the guides
|
||||
[[updating-the-guides]]
|
||||
= Updating the guides
|
||||
|
||||
We assume that your project contains guides under the `guides` folder.
|
||||
|
||||
|
||||
38
docs/antora-playbook.yml
Normal file
38
docs/antora-playbook.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
antora:
|
||||
extensions:
|
||||
- '@springio/antora-extensions/partial-build-extension'
|
||||
- require: '@springio/antora-extensions/latest-version-extension'
|
||||
- require: '@springio/antora-extensions/inject-collector-cache-config-extension'
|
||||
- '@antora/collector-extension'
|
||||
- '@antora/atlas-extension'
|
||||
- require: '@springio/antora-extensions/root-component-extension'
|
||||
root_component_name: 'cloud-build'
|
||||
site:
|
||||
title: Spring Cloud Build
|
||||
url: https://docs.spring.io/spring-cloud-build/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.3.5/ui-bundle.zip
|
||||
12
docs/antora.yml
Normal file
12
docs/antora.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
name: cloud-build
|
||||
version: true
|
||||
title: Spring Cloud Build
|
||||
nav:
|
||||
- modules/ROOT/nav.adoc
|
||||
ext:
|
||||
collector:
|
||||
run:
|
||||
command: ./mvnw validate process-resources -Pdocs -pl docs
|
||||
local: true
|
||||
scan:
|
||||
dir: ./target/classes/antora-resources/
|
||||
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
3
docs/modules/ROOT/nav.adoc
Normal file
3
docs/modules/ROOT/nav.adoc
Normal file
@@ -0,0 +1,3 @@
|
||||
* xref:index.adoc[]
|
||||
* xref:building.adoc[]
|
||||
* xref:contributing.adoc[]
|
||||
4
docs/modules/ROOT/pages/building.adoc
Normal file
4
docs/modules/ROOT/pages/building.adoc
Normal file
@@ -0,0 +1,4 @@
|
||||
[[building]]
|
||||
= Building
|
||||
|
||||
include::partial$building.adoc[]
|
||||
4
docs/modules/ROOT/pages/contributing.adoc
Normal file
4
docs/modules/ROOT/pages/contributing.adoc
Normal file
@@ -0,0 +1,4 @@
|
||||
[[contributing]]
|
||||
= Contributing
|
||||
|
||||
include::partial$contributing.adoc[]
|
||||
4
docs/modules/ROOT/pages/index.adoc
Executable file
4
docs/modules/ROOT/pages/index.adoc
Executable file
@@ -0,0 +1,4 @@
|
||||
[[overview]]
|
||||
= Overview
|
||||
|
||||
Spring Cloud Build is a common utility project for Spring Cloud to use for plugin and dependency management.
|
||||
@@ -1,6 +1,7 @@
|
||||
:jdkversion: 17
|
||||
|
||||
=== Basic Compile and Test
|
||||
[[basic-compile-and-test]]
|
||||
== Basic Compile and Test
|
||||
|
||||
To build the source you will need to install JDK {jdkversion}.
|
||||
|
||||
@@ -27,31 +28,36 @@ 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]]
|
||||
== Documentation
|
||||
|
||||
The spring-cloud-build module has a "docs" profile, and if you switch
|
||||
that on it will try to build asciidoc sources from
|
||||
`src/main/asciidoc`. As part of that process it will look for a
|
||||
`README.adoc` and process it by loading all the includes, but not
|
||||
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
|
||||
(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]]
|
||||
== 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]]
|
||||
=== 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]]
|
||||
=== 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".
|
||||
@@ -65,7 +71,8 @@ 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]]
|
||||
=== Importing into eclipse without m2eclipse
|
||||
If you prefer not to use m2eclipse you can generate eclipse project metadata using the
|
||||
following command:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
= Contributor Code of Conduct
|
||||
[[contributor-code-of-conduct]]
|
||||
== Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of fostering an open
|
||||
and welcoming community, we pledge to respect all people who contribute through reporting
|
||||
@@ -42,4 +42,4 @@ with regard to the reporter of an incident.
|
||||
|
||||
This Code of Conduct is adapted from the
|
||||
https://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
|
||||
https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
|
||||
https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
|
||||
@@ -1 +1 @@
|
||||
NOTE: Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at {github-project}[github].
|
||||
NOTE: Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at {github-project}[github].
|
||||
@@ -1,12 +1,14 @@
|
||||
:spring-cloud-build-branch: master
|
||||
: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 master. If you want
|
||||
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]]
|
||||
== 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
|
||||
@@ -14,19 +16,21 @@ repository, but it does mean that we can accept your contributions, and you will
|
||||
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 https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of
|
||||
[[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]]
|
||||
== 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/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
|
||||
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.
|
||||
@@ -39,13 +43,14 @@ added after the original pull request but before a merge.
|
||||
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
|
||||
* 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]]
|
||||
== 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:
|
||||
|
||||
@@ -63,7 +68,8 @@ Spring Cloud Build comes with a set of checkstyle rules. You can find them in th
|
||||
<2> File header setup
|
||||
<3> Default suppression rules
|
||||
|
||||
==== Checkstyle configuration
|
||||
[[checkstyle-configuration]]
|
||||
=== Checkstyle configuration
|
||||
|
||||
Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins.
|
||||
|
||||
@@ -122,16 +128,18 @@ If you need to suppress some rules (e.g. line length needs to be longer), then i
|
||||
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/master/.editorconfig -o .editorconfig
|
||||
$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
|
||||
$ touch .springformat
|
||||
```
|
||||
|
||||
=== IDE setup
|
||||
[[ide-setup]]
|
||||
== IDE setup
|
||||
|
||||
==== Intellij IDEA
|
||||
[[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/master/spring-cloud-build-tools[Spring Cloud Build] project.
|
||||
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/
|
||||
----
|
||||
@@ -154,13 +162,13 @@ The following files can be found in the https://github.com/spring-cloud/spring-c
|
||||
|
||||
.Code style
|
||||
|
||||
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-code-style.png[Code style]
|
||||
image::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/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-inspections.png[Code style]
|
||||
image::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.
|
||||
|
||||
@@ -168,21 +176,23 @@ Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon
|
||||
|
||||
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/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-checkstyle.png[Checkstyle]
|
||||
image::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/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables:
|
||||
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/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.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]]
|
||||
== 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 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`.
|
||||
|
||||
39
docs/pom.xml
39
docs/pom.xml
@@ -19,7 +19,6 @@
|
||||
<maven-dependency-plugin-for-docs.phase>none</maven-dependency-plugin-for-docs.phase>
|
||||
<maven-dependency-plugin-for-docs-classes.phase>none</maven-dependency-plugin-for-docs-classes.phase>
|
||||
<docs.resources.dir>${project.basedir}/src/main/</docs.resources.dir>
|
||||
<upload-docs-zip.phase>deploy</upload-docs-zip.phase>
|
||||
<!-- Don't upload docs jar to central / repo.spring.io -->
|
||||
<!-- TODO: temporary, don't want it to central? -->
|
||||
<maven-deploy-plugin-default.phase>deploy</maven-deploy-plugin-default.phase>
|
||||
@@ -59,14 +58,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main</directory>
|
||||
<excludes>
|
||||
<exclude>java/**/*.*</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -97,6 +88,12 @@
|
||||
<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>
|
||||
@@ -106,17 +103,25 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<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>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-component-version-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>antora</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -124,10 +129,6 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<goals>
|
||||
<goal>deploy</goal>
|
||||
<goal>deploy-file</goal>
|
||||
</goals>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
20
docs/src/main/antora/resources/antora-resources/antora.yml
Normal file
20
docs/src/main/antora/resources/antora-resources/antora.yml
Normal 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@
|
||||
@@ -3,7 +3,8 @@ image::https://github.com/spring-cloud/spring-cloud-build/workflows/Build/badge.
|
||||
Spring Cloud Build is a common utility project for Spring Cloud
|
||||
to use for plugin and dependency management.
|
||||
|
||||
== Building and Deploying
|
||||
[[building-and-deploying]]
|
||||
= Building and Deploying
|
||||
|
||||
To install locally:
|
||||
|
||||
@@ -38,11 +39,13 @@ $ mvn deploy -P central -DaltReleaseDeploymentRepository=sonatype-nexus-staging:
|
||||
|
||||
(the "central" profile is available for all projects in Spring Cloud and it sets up the gpg jar signing, and the repository has to be specified separately for this project because it is a parent of the starter parent which users in turn have as their own parent).
|
||||
|
||||
== Contributing
|
||||
[[contributing]]
|
||||
= Contributing
|
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/contributing.adoc[]
|
||||
|
||||
== Flattening the POMs
|
||||
[[flattening-the-poms]]
|
||||
= 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.
|
||||
|
||||
@@ -60,7 +63,8 @@ In order to add it, add the `org.codehaus.mojo:flatten-maven-plugin` to your `po
|
||||
</build>
|
||||
----
|
||||
|
||||
== Reusing the documentation
|
||||
[[reusing-the-documentation]]
|
||||
= Reusing the documentation
|
||||
|
||||
Spring Cloud Build publishes its `spring-cloud-build-docs` module that contains
|
||||
helpful scripts (e.g. README generation ruby script) and css, xslt and images
|
||||
@@ -69,9 +73,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<properties>
|
||||
<upload-docs-zip.phase>deploy</upload-docs-zip.phase> <8>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>docs</id>
|
||||
@@ -116,7 +117,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
<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
|
||||
<7> This plugin ensures that the generated zip docs will get published
|
||||
<8> This property turns on the "deploy" phase for <7>
|
||||
|
||||
IMPORTANT: The order of plugin declaration is important!
|
||||
|
||||
@@ -126,12 +126,13 @@ If you want to modify which of the configuration properties are put in the table
|
||||
|
||||
Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.
|
||||
|
||||
[source,xml]
|
||||
[source,yml]
|
||||
----
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/pom.xml[tags=attributes,indent=0]
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/antora/resources/antora-resources/antora.yml[indent=0]
|
||||
----
|
||||
|
||||
== Updating the guides
|
||||
[[updating-the-guides]]
|
||||
= Updating the guides
|
||||
|
||||
We assume that your project contains guides under the `guides` folder.
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building.adoc[]
|
||||
|
||||
@@ -1,423 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: (cd <project root>; ghpages.sh -v <version> -b -c)
|
||||
|
||||
set -e
|
||||
|
||||
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}"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
|
||||
|
||||
|
||||
!!! WARNING !!!
|
||||
|
||||
THIS SCRIPT IS DEPRECATED!!
|
||||
We're migrating away from using gh-pages at all. We're moving to using docs.spring.io and the zipped documentation.
|
||||
Please migrate to the new approach as soon as possible since this script will be removed soon.
|
||||
|
||||
!!! WARNING !!!
|
||||
|
||||
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
# The script should be run from the root folder
|
||||
ROOT_FOLDER="$( pwd )"
|
||||
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() {
|
||||
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:-}
|
||||
if [ -e "${ROOT_FOLDER}/mvnw" ]; then
|
||||
MAVEN_EXEC="$ROOT_FOLDER/mvnw"
|
||||
else
|
||||
MAVEN_EXEC="${MAVEN_PATH}mvn"
|
||||
fi
|
||||
echo "Path to Maven is [${MAVEN_EXEC}]"
|
||||
if [ -z "${REPO_NAME}" ]; then
|
||||
REPO_NAME="$("${GIT_BIN}" remote -v | grep origin | head -1 | sed -e 's!.*/!!' -e 's/ .*//' -e 's/\.git.*//')"
|
||||
fi
|
||||
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}"
|
||||
}
|
||||
|
||||
# Adds the oauth token if present to the remote url
|
||||
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 [[ ${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. 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 [[ "${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
|
||||
|
||||
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_BIN}" symbolic-ref -q HEAD)
|
||||
CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/}
|
||||
CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD}
|
||||
fi
|
||||
echo "Current branch is [${CURRENT_BRANCH}]"
|
||||
"${GIT_BIN}" checkout "${CURRENT_BRANCH}" || echo "Failed to check the branch... continuing with the script"
|
||||
PREVIOUS_BRANCH="${CURRENT_BRANCH}"
|
||||
echo "Previous branch was [${PREVIOUS_BRANCH}]"
|
||||
}
|
||||
|
||||
# Switches to the provided value of the release version. We always prefix it with `v`
|
||||
function switch_to_tag() {
|
||||
if [[ "${RELEASE_TRAIN}" != "yes" ]] ; then
|
||||
"${GIT_BIN}" checkout v"${VERSION}"
|
||||
else
|
||||
echo "Not switching to tag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Build the docs if switch is on
|
||||
function build_docs_if_applicable() {
|
||||
if [[ "${BUILD}" == "yes" ]] ; then
|
||||
./mvnw clean install -P docs -pl docs -DskipTests
|
||||
else
|
||||
echo "Not building docs"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get the name of the `docs.main` property
|
||||
# Get allowed branches - assumes that a `docs` module is available under `docs` profile
|
||||
# shellcheck disable=SC2016
|
||||
function retrieve_doc_properties() {
|
||||
if [[ "${RELEASE_TRAIN}" == "yes" ]]; then
|
||||
echo "Will not extract any properties for release train"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
ALLOW_PROPERTY=${ALLOW_PROPERTY:-"docs.allowed.branches"}
|
||||
ALLOWED_BRANCHES_VALUE=$("${MAVEN_EXEC}" -q \
|
||||
-Dexec.executable="echo" \
|
||||
-Dexec.args="\${${ALLOW_PROPERTY}}" \
|
||||
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
|
||||
-P docs \
|
||||
-pl docs | tail -1 )
|
||||
echo "Extracted '${ALLOW_PROPERTY}' from Maven build [${ALLOWED_BRANCHES_VALUE}]"
|
||||
}
|
||||
|
||||
# Stash any outstanding changes
|
||||
function stash_changes() {
|
||||
local success="false"
|
||||
"${GIT_BIN}" diff-index --quiet HEAD && dirty=$? && success="true"
|
||||
if [[ "${success}" == "false" ]]; then
|
||||
echo "Failed to check if the current repo is dirty. Assuming that it is." && dirty="1"
|
||||
fi
|
||||
echo "The repo is dirty [${dirty}]"
|
||||
if [ "$dirty" != "0" ]; then "${GIT_BIN}" 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="${SPRING_CLOUD_STATIC_REPO_DESTINATION}"/spring-cloud-static
|
||||
if [[ ! -e "${clonedStatic}/.git" ]]; then
|
||||
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 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}"
|
||||
else
|
||||
DESTINATION_REPO_FOLDER="${clonedStatic}"
|
||||
fi
|
||||
mkdir -p "${DESTINATION_REPO_FOLDER}"
|
||||
else
|
||||
if [[ ! -e "${DESTINATION}/.git" ]]; then
|
||||
echo "[${DESTINATION}] is not a git repository"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${RELEASE_TRAIN}" ]] ; then
|
||||
DESTINATION_REPO_FOLDER="${DESTINATION}/${REPO_NAME}"
|
||||
else
|
||||
DESTINATION_REPO_FOLDER="${DESTINATION}"
|
||||
fi
|
||||
mkdir -p "${DESTINATION_REPO_FOLDER}"
|
||||
echo "Destination was provided [${DESTINATION}]"
|
||||
fi
|
||||
cd "${DESTINATION_REPO_FOLDER}"
|
||||
"${GIT_BIN}" checkout gh-pages
|
||||
"${GIT_BIN}" pull origin gh-pages
|
||||
|
||||
# Add git branches
|
||||
###################################################################
|
||||
if [[ -z "${VERSION}" && -z "${RELEASE_TRAIN}" ]] ; 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_BIN}" ls-files -i -o --exclude-standard --directory | grep -q ^"${file}"$; then
|
||||
# Not ignored...
|
||||
cp -rf "${f}" "${ROOT_FOLDER}"/
|
||||
fi
|
||||
done
|
||||
"${GIT_BIN}" add -A "${ROOT_FOLDER}"
|
||||
COMMIT_CHANGES="yes"
|
||||
else
|
||||
echo -e "Current branch is [${CURRENT_BRANCH}]"
|
||||
# https://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
|
||||
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_BIN}" ls-files -i -o --exclude-standard --directory | grep -q ^"${file}"$; then
|
||||
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
|
||||
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
|
||||
"${GIT_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/${file}" || echo "Failed to add the file [${file}]"
|
||||
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"
|
||||
echo "Copying file [${file}] to destination [${destination}]"
|
||||
if ! "${GIT_BIN}" ls-files -i -o --exclude-standard --directory | grep -q ^"${file}"$; then
|
||||
# Not ignored...
|
||||
cp -rf "${f}" "${destination}"
|
||||
"${GIT_BIN}" add -A "${destination}"
|
||||
fi
|
||||
}
|
||||
|
||||
function commit_changes_if_applicable() {
|
||||
if [[ "${COMMIT_CHANGES}" == "yes" ]] ; then
|
||||
COMMIT_SUCCESSFUL="no"
|
||||
"${GIT_BIN}" 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
|
||||
add_oauth_token_to_remote_url
|
||||
"${GIT_BIN}" 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_BIN}" checkout "${PREVIOUS_BRANCH}" || echo "Failed to check the branch... continuing with the script"
|
||||
if [ "$dirty" != "0" ]; then "${GIT_BIN}" stash pop; fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Assert if properties have been properly passed
|
||||
function assert_properties() {
|
||||
echo "VERSION [${VERSION}], RELEASE_TRAIN [${RELEASE_TRAIN}], 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
|
||||
if [[ "${RELEASE_TRAIN}" != "" && -z "${VERSION}" ]] ; then echo "Release train was set but no version was passed!"; 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>]
|
||||
- if the release train switch is passed (-r) 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/<version>]
|
||||
|
||||
USAGE:
|
||||
|
||||
You can use the following options:
|
||||
|
||||
-v|--version - the script will apply the whole procedure for a particular library version
|
||||
-r|--releasetrain - instead of nesting the docs under the project_name/version folder the docs will end up in 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
|
||||
}
|
||||
|
||||
|
||||
# ==========================================
|
||||
# ____ ____ _____ _____ _____ _______
|
||||
# / ____|/ ____| __ \|_ _| __ \__ __|
|
||||
# | (___ | | | |__) | | | | |__) | | |
|
||||
# \___ \| | | _ / | | | ___/ | |
|
||||
# ____) | |____| | \ \ _| |_| | | |
|
||||
# |_____/ \_____|_| \_\_____|_| |_|
|
||||
#
|
||||
# ==========================================
|
||||
|
||||
|
||||
if [[ "${SOURCE_FUNCTIONS}" == "true" ]]; then
|
||||
echo "Will just source functions. Will not run any commands"
|
||||
else
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case "${key}" in
|
||||
-v|--version)
|
||||
VERSION="$2"
|
||||
shift # past argument
|
||||
;;
|
||||
-r|--releasetrain)
|
||||
RELEASE_TRAIN="yes"
|
||||
;;
|
||||
-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
|
||||
retrieve_current_branch
|
||||
if echo "${VERSION}" | grep -q -E 'SNAPSHOT' || [[ -z "${VERSION}" ]]; then
|
||||
CLONE=""
|
||||
VERSION=""
|
||||
echo "You've provided a version variable but it's a snapshot one. Due to this will not clone spring-cloud-static and publish docs over there"
|
||||
else
|
||||
switch_to_tag
|
||||
fi
|
||||
build_docs_if_applicable
|
||||
retrieve_doc_properties
|
||||
stash_changes
|
||||
add_docs_from_target
|
||||
checkout_previous_branch
|
||||
fi
|
||||
@@ -1 +0,0 @@
|
||||
include::spring-cloud-build.adoc[]
|
||||
@@ -1,3 +0,0 @@
|
||||
= Spring Cloud Build
|
||||
|
||||
include::README.adoc[]
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
GIT_BIN="${GIT_BIN:-git}"
|
||||
|
||||
echo "Project version is [${PROJECT_VERSION}]"
|
||||
if [[ "${PROJECT_VERSION}" != *"RELEASE"* ]];then
|
||||
echo "Will not update guides, since the version is not a RELEASE one"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The script should be run from the root folder
|
||||
[[ -z "${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
|
||||
|
||||
GUIDES_FOLDER="${ROOT_FOLDER}/guides"
|
||||
SPRING_GUIDES_REPO_ROOT="${SPRING_GUIDES_REPO_ROOT:-git@github.com:spring-guides}"
|
||||
echo "The Spring Guides repo root is [${SPRING_GUIDES_REPO_ROOT}]"
|
||||
|
||||
if [[ ! -d "${GUIDES_FOLDER}" ]]; then
|
||||
echo "No [guides] folder is present. Won't do anything"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
function iterate_over_guides() {
|
||||
for dir in "${GUIDES_FOLDER}"/*/ # list directories in the form "/tmp/dirname/"
|
||||
do
|
||||
local dir="${dir%*/}" # remove the trailing "/"
|
||||
local folderName="${dir##*/}" # print everything after the final "/"
|
||||
if [[ "${folderName}" == "target" ]]; then
|
||||
echo "Skipping [${folderName}]"
|
||||
continue
|
||||
fi
|
||||
local guideRepo="${SPRING_GUIDES_REPO_ROOT}/${folderName}"
|
||||
local clonedGuideFolderParent="${ROOT_FOLDER}/target"
|
||||
local clonedGuideFolder="${clonedGuideFolderParent}/${folderName}"
|
||||
echo "Will clone [${guideRepo}] project [${folderName}] to target"
|
||||
mkdir -p "${clonedGuideFolder}"
|
||||
rm -rf "${clonedGuideFolder}"
|
||||
"${GIT_BIN}" clone "${guideRepo}" "${clonedGuideFolder}"
|
||||
pushd "${clonedGuideFolder}"
|
||||
echo "Will start the commit process for [${folderName}]"
|
||||
add_oauth_token_to_remote_url
|
||||
remove_all_files
|
||||
copy_new_guide "${GUIDES_FOLDER}/${folderName}" "${clonedGuideFolderParent}"
|
||||
commit_and_push_new_guide_contents
|
||||
echo "Successfully copied and pushed new guides for [${guideRepo}]"
|
||||
popd
|
||||
done
|
||||
}
|
||||
|
||||
function commit_and_push_new_guide_contents() {
|
||||
"${GIT_BIN}" add .
|
||||
"${GIT_BIN}" commit -m "Updating guides" || echo "Nothing to commit"
|
||||
"${GIT_BIN}" push origin master || echo "Nothing to push"
|
||||
}
|
||||
|
||||
function copy_new_guide() {
|
||||
local guideFolder="${1}"
|
||||
local clonedGuideFolder="${2}"
|
||||
echo "Will copy new guide files from [${guideFolder}/] to [${clonedGuideFolder}]"
|
||||
cp -r "${guideFolder}/" "${clonedGuideFolder}/"
|
||||
echo "Copied new guide files"
|
||||
}
|
||||
|
||||
function remove_all_files() {
|
||||
echo "Removing all non git files in [$( pwd )]"
|
||||
"${GIT_BIN}" rm -rf "$( pwd )/"
|
||||
"${GIT_BIN}" clean -fxd
|
||||
echo "All files removed"
|
||||
}
|
||||
|
||||
# Adds the oauth token if present to the remote url
|
||||
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"
|
||||
withToken=${remote/https:\/\//https://${RELEASER_GIT_OAUTH_TOKEN}@}
|
||||
"${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:/' )"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prints the usage
|
||||
function print_usage() {
|
||||
cat <<EOF
|
||||
The idea of this script is to keep the Spring guides up to date by taking the
|
||||
contents of guides from the project's repository and pushing them to Spring guides
|
||||
repository.
|
||||
|
||||
This script iterates over the contents of the [guides] folder. Each its subfolder
|
||||
corresponds to a repository under the Spring Guides repository (i.e. the https://github.com/spring-guides organization).
|
||||
|
||||
Upon the iteration a corresponding guide repository gets cloned and updated with the latest content from the project repository. A commit and push then takes place.
|
||||
|
||||
USAGE:
|
||||
|
||||
You can use the following options:
|
||||
|
||||
-h|--help - display this message
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
# ==========================================
|
||||
# ____ ____ _____ _____ _____ _______
|
||||
# / ____|/ ____| __ \|_ _| __ \__ __|
|
||||
# | (___ | | | |__) | | | | |__) | | |
|
||||
# \___ \| | | _ / | | | ___/ | |
|
||||
# ____) | |____| | \ \ _| |_| | | |
|
||||
# |_____/ \_____|_| \_\_____|_| |_|
|
||||
#
|
||||
# ==========================================
|
||||
|
||||
|
||||
if [[ "${SOURCE_FUNCTIONS}" == "true" ]]; then
|
||||
echo "Will just source functions. Will not run any commands"
|
||||
else
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case "${key}" in
|
||||
-h|--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: [$1]"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift # past argument or value
|
||||
done
|
||||
|
||||
iterate_over_guides
|
||||
fi
|
||||
@@ -69,9 +69,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<properties>
|
||||
<upload-docs-zip.phase>deploy</upload-docs-zip.phase> <8>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>docs</id>
|
||||
@@ -116,7 +113,6 @@ approach of generating documentation just add these plugins to your `docs` modul
|
||||
<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
|
||||
<7> This plugin ensures that the generated zip docs will get published
|
||||
<8> This property turns on the "deploy" phase for <7>
|
||||
|
||||
IMPORTANT: The order of plugin declaration is important!
|
||||
|
||||
|
||||
289
pom.xml
289
pom.xml
@@ -101,7 +101,7 @@
|
||||
<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.path>${project.basedir}/modules/ROOT/partials/_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-docs-classes.phase>generate-resources</maven-dependency-plugin-for-docs-classes.phase>
|
||||
@@ -113,9 +113,6 @@
|
||||
<javadoc.failOnWarnings>false</javadoc.failOnWarnings>
|
||||
<maven-deploy-plugin-default.phase>deploy</maven-deploy-plugin-default.phase>
|
||||
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
|
||||
<maven-deploy-plugin.deployZipRepositoryId>repo.spring.io</maven-deploy-plugin.deployZipRepositoryId>
|
||||
<maven-deploy-plugin.deployZipUrl>https://repo.spring.io/libs-snapshot-local</maven-deploy-plugin.deployZipUrl>
|
||||
<upload-docs-zip.phase>none</upload-docs-zip.phase>
|
||||
<readme.main.classpath>${docs.classes.dir}</readme.main.classpath>
|
||||
<readme.class.path>readme.class.path</readme.class.path>
|
||||
<sonar-jacoco-listeners.version>5.14.0.18788</sonar-jacoco-listeners.version>
|
||||
@@ -141,6 +138,7 @@
|
||||
<generate-docs.phase>prepare-package</generate-docs.phase>
|
||||
<copy-missing-html-files.phase>package</copy-missing-html-files.phase>
|
||||
<package-and-attach-docs-zip.phase>package</package-and-attach-docs-zip.phase>
|
||||
<antora-maven-plugin.version>0.0.4</antora-maven-plugin.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -297,6 +295,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -827,9 +826,6 @@
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<maven-deploy-plugin.deployZipUrl>https://repo.spring.io/libs-milestone-local</maven-deploy-plugin.deployZipUrl>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>central</id>
|
||||
@@ -851,9 +847,6 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<maven-deploy-plugin.deployZipUrl>https://repo.spring.io/libs-release-local</maven-deploy-plugin.deployZipUrl>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>guides</id>
|
||||
@@ -1058,29 +1051,23 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-component-version-maven-plugin</artifactId>
|
||||
<version>${antora-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-asciidoc-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
<goal>antora-component-version</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/refdocs/</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/asciidoc</directory>
|
||||
<excludes>
|
||||
<exclude>ghpages.sh</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.spring.maven.antora</groupId>
|
||||
<artifactId>antora-maven-plugin</artifactId>
|
||||
<version>${antora-maven-plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
@@ -1088,7 +1075,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-configprops</id>
|
||||
<phase>prepare-package</phase>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
@@ -1117,172 +1104,6 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>${asciidoctor-maven-plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.spring.asciidoctor.backends</groupId>
|
||||
<artifactId>spring-asciidoctor-backends</artifactId>
|
||||
<version>${spring-asciidoctor-backends.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<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>${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-project>https://github.com/spring-cloud/${docs.main}@</github-project>
|
||||
<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>https://docs.spring.io/${docs.main}/docs/${project.version}@</docs-url>
|
||||
<raw-docs-url>${github-raw}@</raw-docs-url>
|
||||
<project-version>${project.version}@</project-version>
|
||||
<project-name>${docs.main}@</project-name>
|
||||
<source-highlighter>highlight.js</source-highlighter>
|
||||
</attributes>
|
||||
<!-- end::attributes[] -->
|
||||
<requires>
|
||||
<require>asciidoctor-diagram</require>
|
||||
</requires>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-html-documentation</id>
|
||||
<phase>${generate-docs.phase}</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>spring-html</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.adoc</sourceDocumentExtension>
|
||||
<sourceDocumentExtension>.htmladoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>${generated-docs-multipage-output.dir}
|
||||
</outputDirectory>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
<docinfo>shared</docinfo>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>site.css</stylesheet>
|
||||
<linkcss>true</linkcss>
|
||||
<icons>font</icons>
|
||||
<highlightjsdir>js/highlight</highlightjsdir>
|
||||
<highlightjs-theme>github</highlightjs-theme>
|
||||
<imagesdir>./images</imagesdir>
|
||||
<attribute-missing>warn</attribute-missing>
|
||||
<source-highlighter>highlight.js</source-highlighter>
|
||||
</attributes>
|
||||
<logHandler>
|
||||
<outputToConsole>true</outputToConsole>
|
||||
<failIf>
|
||||
<!-- <severity>DEBUG</severity>-->
|
||||
</failIf>
|
||||
</logHandler>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-htmlsingle-documentation</id>
|
||||
<phase>${generate-docs.phase}</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>spring-html</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.htmlsingleadoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>
|
||||
${generated-docs-singlepage-output.dir}
|
||||
</outputDirectory>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
<source-highlighter>highlight.js</source-highlighter>
|
||||
<docinfo>shared</docinfo>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>site.css</stylesheet>
|
||||
<linkcss>true</linkcss>
|
||||
<icons>font</icons>
|
||||
<highlightjsdir>js/highlight</highlightjsdir>
|
||||
<highlightjs-theme>github</highlightjs-theme>
|
||||
<imagesdir>./images</imagesdir>
|
||||
</attributes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-pdf-documentation</id>
|
||||
<phase>${generate-docs.phase}</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>pdf</backend>
|
||||
<sourceDocumentExtensions>
|
||||
<sourceDocumentExtension>.pdfadoc</sourceDocumentExtension>
|
||||
</sourceDocumentExtensions>
|
||||
<outputDirectory>${generated-docs-pdf-output.dir}
|
||||
</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${refdocs.build.directory}</directory>
|
||||
<excludes>
|
||||
<exclude>**/*</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
@@ -1350,7 +1171,7 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<fileset id="unresolved.file" dir="${basedir}/target/generated-docs/"
|
||||
<fileset id="unresolved.file" dir="${basedir}/target/antora/site/"
|
||||
includes="**/*.html">
|
||||
<contains text="Unresolved"/>
|
||||
</fileset>
|
||||
@@ -1364,40 +1185,6 @@
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-missing-html-files</id>
|
||||
<phase>${copy-missing-html-files.phase}</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnError>false</failOnError>
|
||||
<target>
|
||||
<copy tofile="${project.build.directory}/generated-docs/reference/htmlsingle/index.html">
|
||||
<fileset dir="${project.build.directory}/generated-docs/reference/htmlsingle" includes="${docs.main}.html" />
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>package-and-attach-docs-zip</id>
|
||||
<phase>${package-and-attach-docs-zip.phase}</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>initialize</phase>
|
||||
@@ -1411,7 +1198,7 @@
|
||||
<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"/>
|
||||
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"
|
||||
@@ -1432,32 +1219,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jfrog.buildinfo</groupId>
|
||||
<artifactId>artifactory-maven-plugin</artifactId>
|
||||
<version>${artifactory-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-info</id>
|
||||
<goals>
|
||||
<goal>publish</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<deployProperties>
|
||||
<zip.deployed>true</zip.deployed>
|
||||
<zip.type>docs</zip.type>
|
||||
</deployProperties>
|
||||
<publisher>
|
||||
<contextUrl>https://repo.spring.io
|
||||
</contextUrl>
|
||||
<repoKey>libs-release-local</repoKey>
|
||||
<snapshotRepoKey>libs-snapshots-local
|
||||
</snapshotRepoKey>
|
||||
</publisher>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>${maven-deploy-plugin.version}</version>
|
||||
@@ -1469,23 +1230,6 @@
|
||||
<goal>deploy</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>upload-docs-zip</id>
|
||||
<phase>${upload-docs-zip.phase}</phase>
|
||||
<goals>
|
||||
<goal>deploy-file</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<generatePom>false</generatePom>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<repositoryId>${maven-deploy-plugin.deployZipRepositoryId}</repositoryId>
|
||||
<url>${maven-deploy-plugin.deployZipUrl}</url>
|
||||
<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
|
||||
<packaging>zip;zip.type=docs;zip.deployed=false;</packaging>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@@ -1647,7 +1391,6 @@
|
||||
<generate-docs.phase>none</generate-docs.phase>
|
||||
<copy-missing-html-files.phase>none</copy-missing-html-files.phase>
|
||||
<package-and-attach-docs-zip.phase>none</package-and-attach-docs-zip.phase>
|
||||
<upload-docs-zip.phase>none</upload-docs-zip.phase>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
Reference in New Issue
Block a user