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
This documentation is dedicated to developers to setup their environment, and build the project from sources:
5
+
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.
10
+
4
11
## Development environment quick check
5
12
6
-
You can quickly check that your development environment is properly set up to build the project running `./setup.sh` from the project root:
13
+
As a preliminary step, you can quickly check that your development environment is properly set up to build the project running `./setup.sh` from the project root:
7
14
8
15
```bash
9
16
$ ./setup.sh
@@ -18,50 +25,169 @@ $ ./setup.sh
18
25
✅ The git command line is installed.
19
26
✅ pre-commit hook is installed in repository.
20
27
✅ git config submodule.recurse is set to true.
21
-
ℹ️ Checking shell configuration:
22
-
✅ File descriptor limit is set to 12800.
28
+
ℹ️ Checking Docker environment:
23
29
✅ The docker command line is installed.
24
30
✅ The Docker server is running.
25
31
```
26
32
27
-
If the script finds any issue, you can follow the requirements below to install and configure the required tools and [the code contribution guidelines](CONTRIBUTING.md#code-contributions).
33
+
If the script finds any issue, you can check the requirements and follow the guide below to install and configure the required tools.
28
34
29
35
## Building requirements
30
36
31
37
To build the full project:
32
38
33
-
* JDK version 8 must be installed.
34
-
* JDK version 11 must be installed.
35
-
* JDK version 17 must be installed.
36
-
* JDK version 21 must be installed.
37
-
*`JAVA_8_HOME` must point to the JDK-8 location.
38
-
*`JAVA_11_HOME` must point to the JDK-11 location.
39
-
*`JAVA_17_HOME` must point to the JDK-17 location.
40
-
*`JAVA_21_HOME` must point to the JDK-21 location.
39
+
* The JDK versions 8, 11, 17 and 21 must be installed
40
+
* The `JAVA_8_HOME`, `JAVA_11_HOME`, `JAVA_17_HOME`, `JAVA_21_HOME` and `JAVA_GRAALVM17_HOME` must point to their respective JDK location,
41
41
* The JDK-8 `bin` directory must be the only JDK on the PATH (e.g. `$JAVA_8_HOME/bin`).
42
-
*`JAVA_HOME` may be unset. If set, it must point to JDK-8 (same as `JAVA_8_HOME`).
43
-
* git command line must be installed.
42
+
*The `JAVA_HOME`environment variable may be unset. If set, it must point to the JDK 8 location (same as `JAVA_8_HOME`),
43
+
*The `git` command line must be installed,
44
44
* A container runtime environment must be available to run all tests (usually Docker Desktop).
45
45
46
-
> [!NOTE]
47
-
> MacOS users, remember that `/usr/libexec/java_home` may control which JDK is in your path.
export JAVA_GRAALVM17_HOME=/Library/Java/JavaVirtualMachines/graalvm-<current version of grallvm>/Contents/Home
64
+
export JAVA_HOME=$JAVA_8_HOME
65
+
```
48
66
49
67
> [!NOTE]
50
68
> ARM users, there is no Oracle JDK v8 for ARM.
51
-
> You might want 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.
52
-
> On macOS, they can be installed using `brew tap homebrew/cask-versions && brew install --cask zulu8`.
69
+
> 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.
53
70
> [Amazon Corretto](https://aws.amazon.com/corretto/) builds have also been proven to work.
54
71
72
+
> [!NOTE]
73
+
> MacOS users, remember that `/usr/libexec/java_home` may control which JDK is in your path.
74
+
75
+
> [!NOTE]
76
+
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` (or `.bashrc` dependening of your shell).
77
+
> You will need to restart your shell first to apply the changes.
78
+
79
+
**On Linux:**
80
+
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 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:
84
+
```shell
85
+
export JAVA_8_HOME=/<path to extracted archive>/jdk8u<current version of JDK 8>
86
+
export JAVA_11_HOME=/<path to extracted archive>/jdk-11.<current version of JDK 11>
87
+
export JAVA_17_HOME=/<path to extracted archive>/jdk-17.<current version of JDK 17>
88
+
export JAVA_21_HOME=/<path to extracted archive>/jdk-21.<current version of JDK 21>
89
+
export JAVA_GRAALVM17_HOME=/<path to extracted archive>/graalvm-jdk-17.<current version of grallvm>/Contents/Home
90
+
export JAVA_HOME=$JAVA_8_HOME
91
+
```
92
+
93
+
> [!NOTE]
94
+
> You can permanently install the environment variables by appending the `export` commands into your shell configuration file `~/.zshrc` (or `.bashrc` dependening of your shell).
95
+
> You will need to restart your shell first to apply the changes.
96
+
97
+
**On Windows:**
98
+
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 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 open the *System Properties* using the *Edit environment variable for your account* entry,
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`.
107
+
108
+
### Install git
109
+
110
+
**On MacOS**, you can trigger the installation running any `git` command from the terminal, like `git --version`.
111
+
If not installed, it will prompt you to install it.
112
+
113
+
**On Linux**, use `# apt-get install git` command.
114
+
115
+
**On Windows**, [download and install the installer from the offical website](https://git-scm.com/download/win).
116
+
117
+
### Install Docker Desktop
118
+
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
+
> [!NOTE]
122
+
> Docker Desktop is the recommended container runtime environment but you can use any other environment to run testcontainers tests.
123
+
> Check [the testcontainers container runtime requirements](https://java.testcontainers.org/supported_docker_environment/) for more details.
124
+
125
+
### Clone the repository and setup git
126
+
127
+
First get a copy of the project.
128
+
Start a terminal into your workspace and clone the repository using git:
There is a pre-commit hook setup to verify formatting before committing. It can be activated with this command:
136
+
137
+
```bash
138
+
# On MacOS and Linux
139
+
cd dd-trace-java
140
+
cp .githooks/pre-commit .git/hooks/
141
+
142
+
# On Windows
143
+
cd dd-trace-java
144
+
copy .githooks/pre-comit .git/hooks/
145
+
```
146
+
147
+
> [!TIP]
148
+
> 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.
149
+
150
+
> [!NOTE]
151
+
> The git hooks will check your code is properly formatted before commiting it.
152
+
> This is done both to avoid future merge conflict and ensure an uniformity inside the code base.
153
+
154
+
Finally, configure git to automatically update submodules:
155
+
```bash
156
+
git config --local submodule.recurse true
157
+
```
158
+
159
+
> [!NOTE]
160
+
> Git does not automatically update submodules when switching branches.
161
+
> Without this configuration, you will need to remember to add `--recurse-submodules` to `git checkout` when switching to old branches.
162
+
163
+
> [!TIP]
164
+
> This will keep the submodule in `dd-java-agent/agent-jmxfetch/integrations-core` up-to-date.
165
+
> 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).
166
+
167
+
> [!NOTE]
168
+
> Both git configurations (hooks and submodule) will only be applied to the project and won't apply globally to your setup.
169
+
170
+
### Check your development environment
171
+
172
+
If you properly followed this guide, the `setup.sh` script at the project root should run without issue, confirming everything is properly setup.
173
+
174
+
> [!NOTE]
175
+
> The `setup.sh` script is only available for MacOS and Linux.
176
+
177
+
### Build the project
178
+
179
+
Now everything is setup, you can then move the next section to start a build, or check [the contribution guidelines](CONTRIBUTING.md).
180
+
55
181
## Building commands
56
182
57
183
To build the project without running tests run:
58
-
59
184
```bash
60
185
./gradlew clean assemble
61
186
```
62
187
63
188
To build the entire project with tests (this can take a very long time) run:
64
-
65
189
```bash
66
190
./gradlew clean build
67
191
```
192
+
193
+
After building the project, you can find the jar build artifact into the `dd-java-agent/build/libs` folder.
0 commit comments