Skip to content

Commit dfc0bb3

Browse files
authored
Update BUILDING.md
Update BUILDING.md for clarity.
1 parent a80d13e commit dfc0bb3

File tree

1 file changed

+68
-66
lines changed

1 file changed

+68
-66
lines changed

BUILDING.md

Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

22
# Building
33

4-
This documentation is dedicated to developers to setup their environment, and build the project from sources:
4+
This documentation provides information for developers to set up their environment and build their project from sources.
55

6-
* Check your development environment is ready to build,
7-
* Check the development environment requirements,
8-
* Guide - How to setup your development environment,
9-
* Guide - How to build the project.
6+
* [Development environment quick check](#development-environment-quick-check)
7+
* [Environment requirements quick check](#environment-requirements-quick-check)
8+
* [Development environment set up](#development-environment-set-up)
9+
* [Project build](#project-build)
1010

1111
## Development environment quick check
1212

13-
To check that your development environment is properly set up to build the project, you will eventually run `./setup.sh` from the project root and should have its output look something like this:
13+
To check that your development environment is properly set up to build the project, run `./setup.sh` from the project root. Your output should look something like the following.
1414

1515
```bash
1616
$ ./setup.sh
@@ -31,110 +31,112 @@ $ ./setup.sh
3131
✅ The Docker server is running.
3232
```
3333

34-
If the script finds any issue, you can check the requirements and follow the guide below to install and configure the required tools.
34+
If there is any issue with your output, you can check the requirements and/or follow the guide below to install and configure the required tools.
3535

36-
## Building requirements
36+
## Environment requirements quick check
3737

38-
To build the full project:
38+
Requirements to build the full project:
3939

40-
* The JDK versions 8, 11, 17 and 21 must be installed
41-
* The `JAVA_8_HOME`, `JAVA_11_HOME`, `JAVA_17_HOME`, `JAVA_21_HOME` and `JAVA_GRAALVM17_HOME` must point to their respective JDK location,
40+
* The JDK versions 8, 11, 17 and 21 must be installed.
41+
* The `JAVA_8_HOME`, `JAVA_11_HOME`, `JAVA_17_HOME`, `JAVA_21_HOME` and `JAVA_GRAALVM17_HOME` must point to their respective JDK location.
4242
* The JDK-8 `bin` directory must be the only JDK on the PATH (e.g. `$JAVA_8_HOME/bin`).
43-
* The `JAVA_HOME` environment variable may be unset. If set, it must point to the JDK 8 location (same as `JAVA_8_HOME`),
44-
* The `git` command line must be installed,
45-
* A container runtime environment must be available to run all tests (usually Docker Desktop).
43+
* The `JAVA_HOME` environment variable may be unset. If set, it must point to the JDK 8 location (same as `JAVA_8_HOME`).
44+
* The `git` command line must be installed.
45+
* A container runtime environment must be available to run all tests (e.g. Docker Desktop).
4646

47-
48-
## Setting up development environment
47+
## Development environment set up
4948

5049
### Install the required JDKs
5150

5251
**On MacOS:**
5352

54-
* Install the required JDKs using `brew`:
53+
* Install the required JDKs using `brew`.
5554
`brew install --cask zulu@8 zulu@11 zulu@17 zulu@21 graalvm/tap/graalvm-ce-java17`
56-
* Fix the GraalVM installation by [removing the quarantine flag](https://www.graalvm.org/latest/docs/getting-started/macos/):
55+
* Fix the GraalVM installation by [removing the quarantine flag](https://www.graalvm.org/latest/docs/getting-started/macos/).
5756
`sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-<current version of graalvm>`
58-
* Add the required environment variables to your shell using the `export` command:
57+
* Add the required environment variables to your shell using the `export` command.
5958
```shell
6059
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
6160
export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
6261
export JAVA_17_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
6362
export JAVA_21_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
64-
export JAVA_GRAALVM17_HOME=/Library/Java/JavaVirtualMachines/graalvm-<current version of grallvm>/Contents/Home
63+
export JAVA_GRAALVM17_HOME=/Library/Java/JavaVirtualMachines/graalvm-<current version of graalvm>/Contents/Home
6564
export JAVA_HOME=$JAVA_8_HOME
6665
```
6766

6867
> [!NOTE]
69-
> ARM users, there is no Oracle JDK v8 for ARM.
68+
> ARM users: there is no Oracle JDK v8 for ARM.
7069
> It's recommended to use [Azul's Zulu](https://www.azul.com/downloads/?version=java-8-lts&architecture=arm-64-bit&package=jdk#zulu) builds of Java 8.
7170
> [Amazon Corretto](https://aws.amazon.com/corretto/) builds have also been proven to work.
7271
7372
> [!NOTE]
74-
> MacOS users, remember that `/usr/libexec/java_home` may control which JDK is in your path.
73+
> MacOS users: remember that `/usr/libexec/java_home` may control which JDK is in your path.
7574
7675
> [!NOTE]
77-
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` (or `.bashrc` dependening of your shell).
78-
> You will need to restart your shell first to apply the changes.
76+
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` or `.bashrc` or other.
77+
> You will need to restart your shell after applying the changes.
7978
8079
**On Linux:**
8180

82-
* Download and extract JDK 8, 11, 17 and 21 from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM from [Oracle downloads](https://www.graalvm.org/downloads/),
83-
* Install the GraalVM native image requirements for native builds following [the GraalVM official documentation](https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites),
84-
* Add the required environment variables to your shell using the `export` command:
81+
* Download and extract JDK 8, 11, 17 and 21 from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM from [Oracle downloads](https://www.graalvm.org/downloads/).
82+
* Install the GraalVM native image requirements for native builds by following [the GraalVM official documentation](https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites).
83+
* Add the required environment variables to your shell using the `export` command.
8584
```shell
8685
export JAVA_8_HOME=/<path to extracted archive>/jdk8u<current version of JDK 8>
8786
export JAVA_11_HOME=/<path to extracted archive>/jdk-11.<current version of JDK 11>
8887
export JAVA_17_HOME=/<path to extracted archive>/jdk-17.<current version of JDK 17>
8988
export JAVA_21_HOME=/<path to extracted archive>/jdk-21.<current version of JDK 21>
90-
export JAVA_GRAALVM17_HOME=/<path to extracted archive>/graalvm-jdk-17.<current version of grallvm>/Contents/Home
89+
export JAVA_GRAALVM17_HOME=/<path to extracted archive>/graalvm-jdk-17.<current version of graalvm>/Contents/Home
9190
export JAVA_HOME=$JAVA_8_HOME
9291
```
9392

9493
> [!NOTE]
95-
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` (or `.bashrc` dependening of your shell).
96-
> You will need to restart your shell first to apply the changes.
94+
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` or `.bashrc` or other.
95+
> You will need to restart your shell after applying the changes.
9796
9897
**On Windows:**
9998

100-
* Download and install JDK 8, 11, 17 and 21 from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM from [Oracle downloads](https://www.graalvm.org/downloads/),
101-
* Install the GraalVM native image requirements for native builds following [the GraalVM official documentation](https://www.graalvm.org/latest/docs/getting-started/windows/#prerequisites-for-native-image-on-windows),
102-
* Add the required environment variables:
103-
* Open the *Start Menu*, type `environment variable` and open the *System Properties* using the *Edit environment variable for your account* entry,
104-
* Add new entries to the table:
105-
* `JAVA_8_HOME` to the JDK 8 installation folder, usually `C:\Program Files\Eclipse Adoptium\jdk-<current version of Java 8>-hotspot\bin`,
106-
* `JAVA_11_HOME`, `JAVA_21_HOME`, and `JAVA_21_HOME` similarly to their respective installation `bin` folders,
107-
* `JAVA_GRAALVM17_HOME` to the GraalVM installation folder, usually `C:\Program Files\Java\<current version of graalvm>\bin`.
99+
* Download and install JDK 8, 11, 17 and 21 from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM from [Oracle downloads](https://www.graalvm.org/downloads/).
100+
* Install the GraalVM native image requirements for native builds by following [the GraalVM official documentation](https://www.graalvm.org/latest/docs/getting-started/windows/#prerequisites-for-native-image-on-windows).
101+
* Add the required environment variables.
102+
* Open the *Start Menu*, type `environment variable`, and use the *Edit environment variable for your account* entry to open the *System Properties*.
103+
* Add new entries to the table.
104+
* `JAVA_8_HOME` to the JDK 8 installation folder, usually `C:\Program Files\Eclipse Adoptium\jdk-<current version of Java 8>-hotspot\bin`
105+
* `JAVA_11_HOME`, `JAVA_21_HOME`, and `JAVA_21_HOME` similarly to their respective installation `bin` folders
106+
* `JAVA_GRAALVM17_HOME` to the GraalVM installation folder, usually `C:\Program Files\Java\<current version of graalvm>\bin`
108107

109108
### Install git
110109

111-
**On MacOS**, you can trigger the installation running any `git` command from the terminal, like `git --version`.
112-
If not installed, it will prompt you to install it.
110+
**On MacOS:**
111+
112+
You can trigger the installation by running any `git` command from the terminal, e.g. `git --version`.
113+
If not installed, the terminal will prompt you to install it.
114+
115+
**On Linux:**
116+
117+
Run `apt-get install git`.
113118

114-
**On Linux**, use `# apt-get install git` command.
119+
**On Windows:**
115120

116-
**On Windows**, [download and install the installer from the offical website](https://git-scm.com/download/win).
121+
Download and install [the installer](https://git-scm.com/download/win) from the official website.
117122

118123
### Install Docker Desktop
119124

120125
Download and install Docker Desktop from the offical website for [MacOS](https://docs.docker.com/desktop/install/mac-install/), [Linux](https://docs.docker.com/desktop/install/linux-install/) or [Windows](https://docs.docker.com/desktop/install/windows-install/).
121126

122127
> [!NOTE]
123-
> Docker Desktop is the recommended container runtime environment but you can use any other environment to run testcontainers tests.
128+
> Docker Desktop is the recommended container runtime environment, but you can use any other environment to run testcontainers tests.
124129
> Check [the testcontainers container runtime requirements](https://java.testcontainers.org/supported_docker_environment/) for more details.
125130
126-
### Clone the repository and setup git
131+
### Clone the repository and set up git
127132

128-
First get a copy of the project.
129-
Start a terminal into your workspace and clone the repository using git:
133+
* Get a copy of the project.
134+
* In your workspace, clone the repository using git.
130135
```bash
131136
git clone --recurse-submodules [email protected]:DataDog/dd-trace-java.git
132137
```
133-
134-
Then, install the project git hooks:
135-
136-
There is a pre-commit hook setup to verify formatting before committing. It can be activated with this command:
137-
138+
* Install the project git hooks.
139+
* There is a pre-commit hook setup to verify formatting before committing. It can be activated with the following command.
138140
```bash
139141
# On MacOS and Linux
140142
cd dd-trace-java
@@ -146,13 +148,13 @@ copy .githooks/pre-comit .git/hooks/
146148
```
147149

148150
> [!TIP]
149-
> You can alternative use the `core.hooksPath` configuration to point to the `.githooks` folder using `git config --local core.hooksPath .githooks` if you don't already have a hooks path already defined system-wide.
151+
> You can alternatively use the `core.hooksPath` configuration to point to the `.githooks` folder using `git config --local core.hooksPath .githooks` if you don't already have a hooks path defined system-wide.
150152
151153
> [!NOTE]
152-
> The git hooks will check your code is properly formatted before commiting it.
153-
> This is done both to avoid future merge conflict and ensure an uniformity inside the code base.
154+
> The git hooks will check that your code is properly formatted before commiting.
155+
> This is done both to avoid future merge conflict and ensure uniformity inside the code base.
154156
155-
Finally, configure git to automatically update submodules:
157+
* Configure git to automatically update submodules.
156158
```bash
157159
git config --local submodule.recurse true
158160
```
@@ -163,42 +165,42 @@ git config --local submodule.recurse true
163165
164166
> [!TIP]
165167
> This will keep the submodule in `dd-java-agent/agent-jmxfetch/integrations-core` up-to-date.
166-
> There is also an automated check when opening a pull request if you are trying to submit an module version change (usually an outdated version).
168+
> There is also an automated check when opening a pull request if you are trying to submit a module version change (usually an outdated version).
167169
168170
> [!NOTE]
169-
> Both git configurations (hooks and submodule) will only be applied to the project and won't apply globally to your setup.
171+
> Both git configurations (hooks and submodule) will only be applied to this project and won't apply globally in your setup.
170172
171173
### Check your development environment
172174

173-
If you properly followed this guide, the `setup.sh` script at the project root should run without issue, confirming everything is properly setup.
175+
You can confirm that your development environment is properly set up using the [quick check](#development-environment-quick-check) `setup.sh` script.
174176

175177
> [!NOTE]
176178
> The `setup.sh` script is only available for MacOS and Linux.
177179
178180
### Build the project
179181

180-
Now everything is setup, you can then move the next section to start a build, or check [the contribution guidelines](CONTRIBUTING.md).
182+
After everything is properly set up, you can move on to the next section to start a build or check [the contribution guidelines](CONTRIBUTING.md).
181183

182-
## Building commands
184+
## Project build
183185

184-
To build the project without running tests run:
186+
To build the project without running tests, run:
185187
```bash
186188
./gradlew clean assemble
187189
```
188190

189-
To build the entire project with tests (this can take a very long time) run:
191+
To build the entire project with tests (this can take a very long time), run:
190192
```bash
191193
./gradlew clean build
192194
```
193195

194196
>[!NOTE]
195197
> Running the complete test suite on a local development environment can be challenging.
196-
> It might take a very long time, and you might encounter few flaky tests along the way.
197-
> It is recommended to only run the tests related to your changes locally, and leave the whole test suite to the continuous integration platform.
198+
> It may take a very long time, and you might encounter a few flaky tests along the way.
199+
> It is recommended to only run the tests related to your changes locally and leave running the whole test suite to the continuous integration platform.
198200
199-
To build the JVM agent artifact only run:
201+
To build the JVM agent artifact only, run:
200202
```bash
201203
./gradlew :dd-java-agent:shadowJar
202204
```
203205

204-
After building the project, you can find the built JVM agent artifact into the `dd-java-agent/build/libs` folder.
206+
After building the project, you can find the built JVM agent artifact in the `dd-java-agent/build/libs` folder.

0 commit comments

Comments
 (0)