|
| 1 | += Spring Framework Docs Build |
| 2 | + |
| 3 | +You're currently viewing the Antora playbook branch. |
| 4 | +The playbook branch hosts the docs build that is used to build and publish the production docs site. |
| 5 | + |
| 6 | +The Spring Framework reference docs are built using https://antora.org[Antora]. |
| 7 | +This README covers how to build the docs in a software branch as well as how to build the production docs site locally. |
| 8 | + |
| 9 | +== Overview |
| 10 | + |
| 11 | +To prepare your system for building the documentation, <<prerequisites,install the prerequisites>> and then <<build-main,create your workspace and build the main branch documentation>>. |
| 12 | +Once you've completed those steps, follow the instructions in <<build-branch,Build the 6.0.x branch documentation>> to learn how to build the documentation for a version branch you haven't previously checked out. |
| 13 | + |
| 14 | +To build the production site documentation on your computer, follow the instructions in <<prerequisites,Prerequisites>>, <<build-main,Build the main branch documentation>>, and then <<build-production,Build the production documentation site>>. |
| 15 | + |
| 16 | +.Branch checkout instead of worktrees |
| 17 | +[NOTE] |
| 18 | +==== |
| 19 | +If you prefer to set up your workspace without worktrees, complete the steps in <<prerequisites,Prerequisites>> and clone the project repository onto your computer. |
| 20 | +Then follow the instructions in each section starting from the `sdk env || sdk env install` step once you've checked out the desired branch. |
| 21 | +==== |
| 22 | + |
| 23 | +[#prerequisites] |
| 24 | +== Prerequisites (everyone) |
| 25 | + |
| 26 | +These instructions assume you already have basic tools on your system, including bash, zip, unzip, git, and curl. |
| 27 | +In addition to these basic tools, you need https://sdkman.io/install[SDKMAN!] installed so that the correct JDK is set for each branch. |
| 28 | + |
| 29 | +. Open your terminal and enter the following command: |
| 30 | ++ |
| 31 | +-- |
| 32 | + $ curl -s "https://get.sdkman.io" | bash |
| 33 | + |
| 34 | +This command downloads and installs SDKMAN! |
| 35 | +Once installation is complete, you should see a command displayed in your terminal that will initiate SDKMAN. |
| 36 | +-- |
| 37 | + |
| 38 | +. Copy the command displayed in your terminal and run it. |
| 39 | +`$HOME` is the path unique to your computer (e.g., _home/my-jam/.sdkman/bin/sdkman-init.sh_). |
| 40 | + |
| 41 | + $ source "$HOME/.sdkman/bin/sdkman-init.sh" |
| 42 | + |
| 43 | +You'll use SDKMAN in the next sections to install and switch to the JDK required for each branch. |
| 44 | +Now you're ready to <<build-main,create your workspace>>. |
| 45 | + |
| 46 | +[#build-main] |
| 47 | +== Build the main branch documentation (writers) |
| 48 | + |
| 49 | +Your workspace will be the folder that contains the git worktrees of the project. |
| 50 | + |
| 51 | +. In your terminal, create a directory for the project and then change into that directory. |
| 52 | + |
| 53 | + $ mkdir spring-framework |
| 54 | + $ cd spring-framework |
| 55 | + |
| 56 | +. Clone the project repository and create the primary worktree for the main branch. |
| 57 | +Then change into the new _main_ folder. |
| 58 | + |
| 59 | + $ git clone https://github.com/spring-projects/spring-framework main |
| 60 | + $ cd main |
| 61 | + |
| 62 | +. Switch to the required JDK using SDKMAN by running the following command: |
| 63 | ++ |
| 64 | +-- |
| 65 | + $ sdk env || sdk env install |
| 66 | + |
| 67 | +SDKMAN will switch to the required JDK or install it if it isn't present. |
| 68 | +-- |
| 69 | + |
| 70 | +. Generate the documentation with Antora using the following command: |
| 71 | ++ |
| 72 | +-- |
| 73 | + $ ./gradlew -PbuildSrc.skipTests=true :framework-docs:antora |
| 74 | + |
| 75 | +This command will build the documentation, including any generated attributes, for the main branch. |
| 76 | +-- |
| 77 | + |
| 78 | +. Navigate to _$HOME/spring-framework/main/framework-docs/build/site/index.html_ to view the generated documentation. |
| 79 | + |
| 80 | +[#build-branch] |
| 81 | +== Build the 6.0.x branch documentation (writers) |
| 82 | + |
| 83 | +NOTE: The instructions in this section assume you've completed the steps in the <<build-main,previous section>>. |
| 84 | + |
| 85 | +After creating the worktree for the main branch, you can set up a worktree for any other branches you'll work on in the future. |
| 86 | +In this section, you'll create a worktree for the 6.0.x branch in your project workspace. |
| 87 | + |
| 88 | +. To add a worktree, you have to be in a worktree. |
| 89 | +In your terminal, change to the _main_ folder if you aren't already in it, e.g., _$HOME/spring-framework/main_. |
| 90 | +Set up a worktree for the 6.0.x branch and then change into the new directory by running the following commands: |
| 91 | + |
| 92 | + $ git worktree add ../6.0.x 6.0.x --track |
| 93 | + $ cd ../6.0.x |
| 94 | + |
| 95 | +. Switch to the required JDK or install it. |
| 96 | + |
| 97 | + $ sdk env || sdk env install |
| 98 | + |
| 99 | +. Generate the documentation with the following command: |
| 100 | ++ |
| 101 | +-- |
| 102 | + $ ./gradlew -PbuildSrc.skipTests=true :framework-docs:antora |
| 103 | + |
| 104 | +This command will build the documentation, including any generated attributes, for the 6.0.x branch. |
| 105 | +-- |
| 106 | + |
| 107 | +. Navigate to _$HOME/spring-framework/6.0.x/docs/build/site/index.html_ to view the generated documentation. |
| 108 | + |
| 109 | +[#build-production] |
| 110 | +== Build the production documentation site (docs manager) |
| 111 | + |
| 112 | +NOTE: The instructions in this section assume you've <<build-main,prepared your workspace and created the worktree for the main branch>>. |
| 113 | + |
| 114 | +To build the project's production site, you'll set up a worktree for the docs-build branch of the repository. |
| 115 | + |
| 116 | +. To add a worktree, you have to be in a worktree. |
| 117 | +In your terminal, change to the _main_ folder if you aren't already in it, e.g., _$HOME/spring-framework/main_. |
| 118 | +Run the following command to set up the worktree for the _docs-build_ branch. |
| 119 | +Then change into the new _docs-build_ directory. |
| 120 | + |
| 121 | + $ git worktree add ../docs-build docs-build --track |
| 122 | + $ cd ../docs-build |
| 123 | + |
| 124 | +. Switch to the required JDK or install it. |
| 125 | + |
| 126 | + $ sdk env || sdk env install |
| 127 | + |
| 128 | +. Generate the documentation for the project's production site using the following command: |
| 129 | ++ |
| 130 | +-- |
| 131 | + $ ./gradlew antora |
| 132 | + |
| 133 | +This command will build all of the documentation included in the project's production site from the repository on GitHub. |
| 134 | + |
| 135 | +To build the documentation from the current clone, using any worktrees that are available, use the following command instead: |
| 136 | + |
| 137 | + $ ./gradlew antora --playbook local-antora-playbook.yml |
| 138 | +-- |
| 139 | + |
| 140 | +. Navigate to _$HOME/spring-framework/docs-site/build/site/index.html_ to view the generated documentation. |
0 commit comments