You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BUILDING.md
+83-53Lines changed: 83 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,3 @@
1
-
2
1
# Building
3
2
4
3
This documentation provides information for developers to set up their environment and build their project from sources.
@@ -10,10 +9,9 @@ This documentation provides information for developers to set up their environme
10
9
11
10
## Development environment quick check
12
11
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.
12
+
To check that your development environment is properly set up to build the project, run `./setup.sh`on macOS or Linux (or `.\setup.ps1` on Windows) from the project root. Your output should look something like the following:
14
13
15
-
```bash
16
-
$ ./setup.sh
14
+
```
17
15
ℹ️ Checking required JVM:
18
16
✅ JAVA_HOME is set to /Users/datadog/.sdkman/candidates/java/8.0.402-zulu.
19
17
✅ JAVA_8_HOME is set to /Users/datadog/.sdkman/candidates/java/8.0.402-zulu.
@@ -48,7 +46,10 @@ Requirements to build the full project:
48
46
49
47
### Install the required JDKs
50
48
51
-
**On MacOS:**
49
+
Download and install Eclipse Temurin JDK versions 8, 11, 17 and 21, and GraalVM.
> MacOS users: remember that `/usr/libexec/java_home` may control which JDK is in your path.
75
76
76
-
**On Linux:**
77
+
</details>
78
+
79
+
<details>
80
+
<summary>Linux<summary>
77
81
78
-
* 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
+
* 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/).
79
83
* 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).
80
84
* Add the required environment variables to your shell using the `export` command. You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` or `~/.bashrc` or other.
81
85
```shell
@@ -88,18 +92,41 @@ export JAVA_HOME=$JAVA_8_HOME
88
92
```
89
93
* Restart your shell after applying the changes if you appended the commands to your shell configuration file.
90
94
91
-
**On Windows:**
95
+
</details>
96
+
97
+
<details>
98
+
<summary>Windows<summary>
99
+
100
+
Use the `install-jdks-windows.ps1` script to download and install Eclipse Temurin JDK versions 8, 11, 17, and 21, and set the required environment variables.
92
101
93
-
* 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/).
102
+
To install the JDKs manually using `winget`, use the following commands. After the JDKs are installed, you can still use `install-jdks-windows.ps1` to add the environment variables.
* Download SDKs manually from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM from [Oracle downloads](https://www.graalvm.org/downloads/).
94
113
* 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).
95
-
* Add the required environment variables.
96
-
* Open the *Start Menu*, type `environment variable`, and use the *Edit environment variable for your account* entry to open the *System Properties*.
97
-
* Add new entries to the table.
98
-
*`JAVA_8_HOME` to the JDK 8 installation folder, usually `C:\Program Files\Eclipse Adoptium\jdk-<current version of Java 8>-hotspot\bin`
99
-
*`JAVA_11_HOME`, `JAVA_21_HOME`, and `JAVA_21_HOME` similarly to their respective installation `bin` folders
100
-
*`JAVA_GRAALVM17_HOME` to the GraalVM installation folder, usually `C:\Program Files\Java\<current version of graalvm>\bin`
101
114
102
-
### Install git
115
+
To add the required environment variables manually from PowerShell, run this command for each SDK version:
To add the required environment variables manually using the UI:
121
+
* Open the *Start Menu*, type `environment variable`, and use the *Edit environment variable for your account* entry to open the *System Properties*.
122
+
* Add new entries to the table:
123
+
*`JAVA_8_HOME` to the JDK 8 installation folder, usually `C:\Program Files\Eclipse Adoptium\jdk-<current version of Java 8>-hotspot\bin`
124
+
*`JAVA_11_HOME`, `JAVA_17_HOME`, and `JAVA_21_HOME` similarly to their respective installation `bin` folders
125
+
*`JAVA_GRAALVM17_HOME` to the GraalVM installation folder, usually `C:\Program Files\Java\<current version of graalvm>\bin`
126
+
127
+
</details>
128
+
129
+
### Install `git`
103
130
104
131
**On MacOS:**
105
132
@@ -112,64 +139,67 @@ Run `apt-get install git`.
112
139
113
140
**On Windows:**
114
141
115
-
Download and install [the installer](https://git-scm.com/download/win) from the official website.
142
+
Run `winget install --id git.git`. Alternatively, download and install the installer from [the official website](https://git-scm.com/download/win).
116
143
117
144
### Install Docker Desktop
118
145
119
-
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/).
120
-
121
146
> [!NOTE]
122
147
> Docker Desktop is the recommended container runtime environment, but you can use any other environment to run testcontainers tests.
123
148
> Check [the testcontainers container runtime requirements](https://java.testcontainers.org/supported_docker_environment/) for more details.
124
149
125
-
### Clone the repository and set up git
150
+
**On macOS:**
126
151
127
-
* Get a copy of the project.
128
-
* In your workspace, clone the repository using git.
* There is a pre-commit hook setup to verify formatting before committing. It can be activated with the following command.
134
-
```bash
135
-
# On MacOS and Linux
136
-
cd dd-trace-java
137
-
cp .githooks/pre-commit .git/hooks/
152
+
Download and install Docker Desktop from the offical website: https://docs.docker.com/desktop/setup/install/mac-install/
138
153
139
-
# On Windows
140
-
cd dd-trace-java
141
-
copy .githooks/pre-commit .git/hooks/
142
-
```
154
+
**On Linux:**
143
155
144
-
> [!TIP]
145
-
> 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.
156
+
Download and install Docker Desktop from the offical website: https://docs.docker.com/desktop/setup/install/linux/
146
157
147
-
> [!NOTE]
148
-
> The git hooks will check that your code is properly formatted before commiting.
149
-
> This is done both to avoid future merge conflict and ensure uniformity inside the code base.
158
+
**On Windows:**
159
+
160
+
Run `winget install --id Docker.DockerDesktop`.
161
+
162
+
Alternatively, download and install Docker Desktop from the offical website: https://docs.docker.com/desktop/setup/install/windows-install/
163
+
164
+
### Clone the repository and set up git
165
+
166
+
* Get a copy of the project by cloning the repository using git in your workspace:
* There is a pre-commit hook setup to verify formatting before committing. It can be activated with the following command:
171
+
```bash
172
+
# On bash-like shells shells or PowerShell
173
+
cd dd-trace-java
174
+
cp .githooks/pre-commit .git/hooks/
175
+
```
176
+
177
+
> [!TIP]
178
+
> 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.
179
+
180
+
> [!NOTE]
181
+
> The git hooks will check that your code is properly formatted before commiting.
182
+
> This is done both to avoid future merge conflict and ensure uniformity inside the code base.
150
183
151
184
* Configure git to automatically update submodules.
152
-
```bash
153
-
git config --local submodule.recurse true
154
-
```
185
+
```bash
186
+
git config --local submodule.recurse true
187
+
```
155
188
156
-
> [!NOTE]
157
-
> Git does not automatically update submodules when switching branches.
158
-
> Without this configuration, you will need to remember to add `--recurse-submodules` to `git checkout` when switching to old branches.
189
+
> [!NOTE]
190
+
> Git does not automatically update submodules when switching branches.
191
+
> Without this configuration, you will need to remember to add `--recurse-submodules` to `git checkout` when switching to old branches.
159
192
160
-
> [!TIP]
161
-
> This will keep the submodule in `dd-java-agent/agent-jmxfetch/integrations-core` up-to-date.
162
-
> 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).
193
+
> [!TIP]
194
+
> This will keep the submodule in `dd-java-agent/agent-jmxfetch/integrations-core` up-to-date.
195
+
> 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).
163
196
164
197
> [!NOTE]
165
198
> Both git configurations (hooks and submodule) will only be applied to this project and won't apply globally in your setup.
166
199
167
200
### Check your development environment
168
201
169
-
You can confirm that your development environment is properly set up using the [quick check](#development-environment-quick-check)`setup.sh` script.
170
-
171
-
> [!NOTE]
172
-
> The `setup.sh` script is only available for MacOS and Linux.
202
+
You can confirm that your development environment is properly set up using the [quick check](#development-environment-quick-check) `setup.sh` script on macOS or Linux or `setup.ps1` on Windows.
0 commit comments