diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 000000000..9d272779a --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -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) diff --git a/.gitignore b/.gitignore index 0f4b5b90e..d2b093046 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,12 @@ _site/ .factorypath .vscode/ .flattened-pom.xml -.DS_Store \ No newline at end of file +.DS_Store +node_modules +node +_configprops.adoc +_spans.adoc +_metrics.adoc +_conventions.adoc +package.json +package-lock.json \ No newline at end of file diff --git a/README.adoc b/README.adoc index c0a28ffae..3c71c355a 100644 --- a/README.adoc +++ b/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 ---- -== 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] ---- - - deploy <8> - docs @@ -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] ---- - - shared - true - - left - 4 - true - ${project.basedir}/src@ - ${project.basedir}/src/main/asciidoc@ - ${project.basedir}/target/generated-resources@ - - - - ${maven.multiModuleProjectDirectory}@ - - ${docs.main}@ - https://github.com/spring-cloud/${docs.main}@ - - https://raw.githubusercontent.com/spring-cloud/${docs.main}/${github-tag}@ - - https://github.com/spring-cloud/${docs.main}/tree/${github-tag}@ - - https://github.com/spring-cloud/${docs.main}/issues/@ - https://github.com/spring-cloud/${docs.main}/wiki@ - https://github.com/spring-cloud/${docs.main}/tree/master@ - - ${index-link}@ - - - - ${project.version}@ - ${project.version}@ - ${github-tag}@ - ${version-type}@ - https://docs.spring.io/${docs.main}/docs/${project.version}@ - ${github-raw}@ - ${project.version}@ - ${docs.main}@ - highlight.js - +Unresolved directive in - 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. diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml new file mode 100644 index 000000000..52d7c5530 --- /dev/null +++ b/docs/antora-playbook.yml @@ -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 \ No newline at end of file diff --git a/docs/antora.yml b/docs/antora.yml new file mode 100644 index 000000000..52c86e0d1 --- /dev/null +++ b/docs/antora.yml @@ -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/ diff --git a/docs/src/main/asciidoc/images/intellij-checkstyle.png b/docs/modules/ROOT/assets/images/intellij-checkstyle.png similarity index 100% rename from docs/src/main/asciidoc/images/intellij-checkstyle.png rename to docs/modules/ROOT/assets/images/intellij-checkstyle.png diff --git a/docs/src/main/asciidoc/images/intellij-code-style.png b/docs/modules/ROOT/assets/images/intellij-code-style.png similarity index 100% rename from docs/src/main/asciidoc/images/intellij-code-style.png rename to docs/modules/ROOT/assets/images/intellij-code-style.png diff --git a/docs/src/main/asciidoc/images/intellij-inspections.png b/docs/modules/ROOT/assets/images/intellij-inspections.png similarity index 100% rename from docs/src/main/asciidoc/images/intellij-inspections.png rename to docs/modules/ROOT/assets/images/intellij-inspections.png diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc new file mode 100644 index 000000000..05ef7fb0e --- /dev/null +++ b/docs/modules/ROOT/nav.adoc @@ -0,0 +1,3 @@ +* xref:index.adoc[] +* xref:building.adoc[] +* xref:contributing.adoc[] diff --git a/docs/modules/ROOT/pages/building.adoc b/docs/modules/ROOT/pages/building.adoc new file mode 100644 index 000000000..5e900719c --- /dev/null +++ b/docs/modules/ROOT/pages/building.adoc @@ -0,0 +1,4 @@ +[[building]] += Building + +include::partial$building.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/contributing.adoc b/docs/modules/ROOT/pages/contributing.adoc new file mode 100644 index 000000000..f2baafe96 --- /dev/null +++ b/docs/modules/ROOT/pages/contributing.adoc @@ -0,0 +1,4 @@ +[[contributing]] += Contributing + +include::partial$contributing.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc new file mode 100755 index 000000000..7cce19fde --- /dev/null +++ b/docs/modules/ROOT/pages/index.adoc @@ -0,0 +1,4 @@ +[[overview]] += Overview + +Spring Cloud Build is a common utility project for Spring Cloud to use for plugin and dependency management. \ No newline at end of file diff --git a/docs/src/main/asciidoc/building.adoc b/docs/modules/ROOT/partials/building.adoc similarity index 80% rename from docs/src/main/asciidoc/building.adoc rename to docs/modules/ROOT/partials/building.adoc index 965e3858b..7fe1576ef 100644 --- a/docs/src/main/asciidoc/building.adoc +++ b/docs/modules/ROOT/partials/building.adoc @@ -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: diff --git a/docs/src/main/asciidoc/code-of-conduct.adoc b/docs/modules/ROOT/partials/code-of-conduct.adoc similarity index 96% rename from docs/src/main/asciidoc/code-of-conduct.adoc rename to docs/modules/ROOT/partials/code-of-conduct.adoc index a83c3dc0b..03492ab84 100644 --- a/docs/src/main/asciidoc/code-of-conduct.adoc +++ b/docs/modules/ROOT/partials/code-of-conduct.adoc @@ -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/] \ No newline at end of file +https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/] diff --git a/docs/src/main/asciidoc/contributing-docs.adoc b/docs/modules/ROOT/partials/contributing-docs.adoc similarity index 97% rename from docs/src/main/asciidoc/contributing-docs.adoc rename to docs/modules/ROOT/partials/contributing-docs.adoc index 0e219ced6..395ad89b0 100644 --- a/docs/src/main/asciidoc/contributing-docs.adoc +++ b/docs/modules/ROOT/partials/contributing-docs.adoc @@ -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]. \ No newline at end of file +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]. diff --git a/docs/src/main/asciidoc/contributing.adoc b/docs/modules/ROOT/partials/contributing.adoc similarity index 86% rename from docs/src/main/asciidoc/contributing.adoc rename to docs/modules/ROOT/partials/contributing.adoc index 71f8aab55..e4371260b 100644 --- a/docs/src/main/asciidoc/contributing.adoc +++ b/docs/modules/ROOT/partials/contributing.adoc @@ -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`. diff --git a/docs/pom.xml b/docs/pom.xml index a05e9bc17..32f9f69bf 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -19,7 +19,6 @@ none none ${project.basedir}/src/main/ - deploy deploy @@ -59,14 +58,6 @@ - - - src/main - - java/**/*.* - - - org.apache.maven.plugins @@ -97,6 +88,12 @@ docs + + + src/main/antora/resources/antora-resources + true + + pl.project13.maven @@ -106,17 +103,25 @@ org.apache.maven.plugins maven-dependency-plugin - - org.apache.maven.plugins - maven-resources-plugin - org.codehaus.mojo exec-maven-plugin - org.asciidoctor - asciidoctor-maven-plugin + io.spring.maven.antora + antora-component-version-maven-plugin + + + io.spring.maven.antora + antora-maven-plugin + + + prepare-package + + antora + + + org.apache.maven.plugins @@ -124,10 +129,6 @@ maven-deploy-plugin - - deploy - deploy-file - diff --git a/docs/src/main/antora/resources/antora-resources/antora.yml b/docs/src/main/antora/resources/antora-resources/antora.yml new file mode 100644 index 000000000..9148923fa --- /dev/null +++ b/docs/src/main/antora/resources/antora-resources/antora.yml @@ -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@ diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 2e23770d6..8d3f7b7b5 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -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 ---- -== 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] ---- - - deploy <8> - docs @@ -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. diff --git a/docs/src/main/asciidoc/building-jdk8.adoc b/docs/src/main/asciidoc/building-jdk8.adoc deleted file mode 100644 index 056b67e54..000000000 --- a/docs/src/main/asciidoc/building-jdk8.adoc +++ /dev/null @@ -1,3 +0,0 @@ - -include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/asciidoc/building.adoc[] - diff --git a/docs/src/main/asciidoc/ghpages.sh b/docs/src/main/asciidoc/ghpages.sh deleted file mode 100755 index 8a01a0311..000000000 --- a/docs/src/main/asciidoc/ghpages.sh +++ /dev/null @@ -1,423 +0,0 @@ -#!/bin/bash - -# Usage: (cd ; ghpages.sh -v -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 </] -- 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//] -- 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/] - -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 diff --git a/docs/src/main/asciidoc/index.adoc b/docs/src/main/asciidoc/index.adoc deleted file mode 100755 index 3ec32a747..000000000 --- a/docs/src/main/asciidoc/index.adoc +++ /dev/null @@ -1 +0,0 @@ -include::spring-cloud-build.adoc[] diff --git a/docs/src/main/asciidoc/spring-cloud-build.adoc b/docs/src/main/asciidoc/spring-cloud-build.adoc deleted file mode 100755 index ba98d967a..000000000 --- a/docs/src/main/asciidoc/spring-cloud-build.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= Spring Cloud Build - -include::README.adoc[] diff --git a/docs/src/main/asciidoc/update-guides.sh b/docs/src/main/asciidoc/update-guides.sh deleted file mode 100755 index 6dbefd6ae..000000000 --- a/docs/src/main/asciidoc/update-guides.sh +++ /dev/null @@ -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 < - deploy <8> - docs @@ -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! diff --git a/pom.xml b/pom.xml index 1f496f8e4..97760db0d 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ true 3.2.10 1.8.1 - ${project.basedir}/src/main/asciidoc/_configprops.adoc + ${project.basedir}/modules/ROOT/partials/_configprops.adoc .* generate-resources generate-resources @@ -113,9 +113,6 @@ false deploy 2.8.2 - repo.spring.io - https://repo.spring.io/libs-snapshot-local - none ${docs.classes.dir} readme.class.path 5.14.0.18788 @@ -141,6 +138,7 @@ prepare-package package package + 0.0.4 @@ -297,6 +295,7 @@ org.codehaus.mojo flatten-maven-plugin + 1.5.0 true @@ -827,9 +826,6 @@ https://repo.spring.io/libs-milestone-local - - https://repo.spring.io/libs-milestone-local - central @@ -851,9 +847,6 @@ - - https://repo.spring.io/libs-release-local - guides @@ -1058,29 +1051,23 @@ - org.apache.maven.plugins - maven-resources-plugin + io.spring.maven.antora + antora-component-version-maven-plugin + ${antora-maven-plugin.version} - copy-asciidoc-resources - generate-resources - copy-resources + antora-component-version - - ${project.build.directory}/refdocs/ - - - src/main/asciidoc - - ghpages.sh - - - - + + io.spring.maven.antora + antora-maven-plugin + ${antora-maven-plugin.version} + true + org.codehaus.mojo exec-maven-plugin @@ -1088,7 +1075,7 @@ generate-configprops - prepare-package + generate-resources java @@ -1117,172 +1104,6 @@ - - org.asciidoctor - asciidoctor-maven-plugin - ${asciidoctor-maven-plugin.version} - - - io.spring.asciidoctor.backends - spring-asciidoctor-backends - ${spring-asciidoctor-backends.version} - - - org.asciidoctor - asciidoctorj-pdf - ${asciidoctorj-pdf.version} - - - org.asciidoctor - asciidoctorj-diagram - ${asciidoctorj-diagram.version} - - - - ${refdocs.build.directory} - - - ${refdocs.build.directory} - - **/*.*adoc - - - - - - shared - true - - left - 4 - true - ${project.basedir}/src@ - ${project.basedir}/src/main/asciidoc@ - ${project.basedir}/target/generated-resources@ - - - - ${maven.multiModuleProjectDirectory}@ - - ${docs.main}@ - https://github.com/spring-cloud/${docs.main}@ - - https://raw.githubusercontent.com/spring-cloud/${docs.main}/${github-tag}@ - - https://github.com/spring-cloud/${docs.main}/tree/${github-tag}@ - - https://github.com/spring-cloud/${docs.main}/issues/@ - https://github.com/spring-cloud/${docs.main}/wiki@ - https://github.com/spring-cloud/${docs.main}/tree/master@ - - ${index-link}@ - - - - ${project.version}@ - ${project.version}@ - ${github-tag}@ - ${version-type}@ - https://docs.spring.io/${docs.main}/docs/${project.version}@ - ${github-raw}@ - ${project.version}@ - ${docs.main}@ - highlight.js - - - - asciidoctor-diagram - - - - - generate-html-documentation - ${generate-docs.phase} - - process-asciidoc - - - spring-html - - .adoc - .htmladoc - - ${generated-docs-multipage-output.dir} - - book - - shared - css/ - site.css - true - font - js/highlight - github - ./images - warn - highlight.js - - - true - - - - - - - - generate-htmlsingle-documentation - ${generate-docs.phase} - - process-asciidoc - - - spring-html - - .htmlsingleadoc - - - ${generated-docs-singlepage-output.dir} - - book - - highlight.js - shared - css/ - site.css - true - font - js/highlight - github - ./images - - - - - generate-pdf-documentation - ${generate-docs.phase} - - process-asciidoc - - - pdf - - .pdfadoc - - ${generated-docs-pdf-output.dir} - - - - ${refdocs.build.directory} - - **/* - - - - - - - org.apache.maven.plugins maven-antrun-plugin @@ -1350,7 +1171,7 @@ - @@ -1364,40 +1185,6 @@ - - copy-missing-html-files - ${copy-missing-html-files.phase} - - run - - - false - - - - - - - - - package-and-attach-docs-zip - ${package-and-attach-docs-zip.phase} - - run - - - - - - - - - - - setup-maven-properties initialize @@ -1411,7 +1198,7 @@ + input="${version-type}" regexp=".*\-(.*)" replace="\1"/> - - org.jfrog.buildinfo - artifactory-maven-plugin - ${artifactory-maven-plugin.version} - - - build-info - - publish - - - - true - docs - - - https://repo.spring.io - - libs-release-local - libs-snapshots-local - - - - - - maven-deploy-plugin ${maven-deploy-plugin.version} @@ -1469,23 +1230,6 @@ deploy - - upload-docs-zip - ${upload-docs-zip.phase} - - deploy-file - - - false - ${project.groupId} - ${project.artifactId} - ${project.version} - ${maven-deploy-plugin.deployZipRepositoryId} - ${maven-deploy-plugin.deployZipUrl} - ${project.build.directory}/${project.artifactId}-${project.version}.zip - zip;zip.type=docs;zip.deployed=false; - - @@ -1647,7 +1391,6 @@ none none none - none