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
[docs] improve setup of dev env on Windows (#8180)
* add PowerShell scripts for Windows
* fix typo and remove trailing whitespace in BUILDING.md
* add more Windows instructions, misc tweaks in BUILDING.md
* more changes in BUILDING.md
* use explicit value for JAVA_HOME instead of "%JAVA_8_HOME%"
* Update install-jdks-windows.ps1
* move JDK install powershell script
* update BUILDING.md
* add comments about GraalVM license
* add script descriptions
* add comment to explain "omit from toc"
* move "Quick check" up
* remove Windows install script for now
* rewrite Windows sections to focus on manual installation
* remove toc comments
* more updates to Windows instructions
* fix formatting
* simplify collapsible sections
* tweak the "click here" text
* add GraalVM version
Co-authored-by: Bruce Bujon <[email protected]>
* add GraalVM version
Co-authored-by: Bruce Bujon <[email protected]>
---------
Co-authored-by: Bruce Bujon <[email protected]>
*[Clone the repository and set up git](#clone-the-repository-and-set-up-git)
12
+
*[Building the project](#building-the-project)
13
+
14
+
## Development environment
15
+
16
+
### Quick check
17
+
18
+
To check that your development environment is properly set up to build the project, from the project root run on macOS or Linux:
19
+
```shell
20
+
./setup.sh
21
+
```
10
22
11
-
## Development environment quick check
23
+
or on Windows:
24
+
```pwsh
25
+
.\setup.ps1
26
+
```
12
27
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.
28
+
Your output should look something like the following:
14
29
15
-
```bash
16
-
$ ./setup.sh
30
+
```
17
31
ℹ️ Checking required JVM:
18
32
✅ JAVA_HOME is set to /Users/datadog/.sdkman/candidates/java/8.0.402-zulu.
19
33
✅ JAVA_8_HOME is set to /Users/datadog/.sdkman/candidates/java/8.0.402-zulu.
@@ -31,116 +45,174 @@ $ ./setup.sh
31
45
✅ The Docker server is running.
32
46
```
33
47
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.
48
+
If there is any issue with your output, check the requirements above and use the following guide to install and configure the required tools.
35
49
36
-
##Environment requirements quick check
50
+
### Requirements
37
51
38
52
Requirements to build the full project:
39
53
40
54
* 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.
42
-
* The JDK-8 `bin` directory must be the only JDK on the PATH (e.g. `$JAVA_8_HOME/bin`).
55
+
* The `JAVA_8_HOME`, `JAVA_11_HOME`, `JAVA_17_HOME`, `JAVA_21_HOME`, and `JAVA_GRAALVM17_HOME` must point to their respective JDK location.
56
+
* The JDK8 `bin` directory must be the only JDK on the PATH (e.g. `$JAVA_8_HOME/bin`).
43
57
* The `JAVA_HOME` environment variable may be unset. If set, it must point to the JDK 8 location (same as `JAVA_8_HOME`).
44
58
* The `git` command line must be installed.
45
59
* A container runtime environment must be available to run all tests (e.g. Docker Desktop).
46
60
47
-
## Development environment set up
48
-
49
61
### Install the required JDKs
50
62
51
-
**On MacOS:**
63
+
Download and install Eclipse Temurin JDK versions 8, 11, 17 and 21, and GraalVM 17.
* Fix the GraalVM installation by [removing the quarantine flag](https://www.graalvm.org/latest/docs/getting-started/macos/):
72
+
```
73
+
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-<current version of graalvm>
74
+
```
57
75
* 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.
export JAVA_GRAALVM17_HOME=/Library/Java/JavaVirtualMachines/graalvm-<current version of graalvm>/Contents/Home
82
+
export JAVA_HOME=$JAVA_8_HOME
83
+
```
66
84
* Restart your shell after applying the changes if you appended the commands to your shell configuration file.
67
85
68
-
> [!NOTE]
69
-
> ARM users: there is no Oracle JDK v8 for ARM.
86
+
> [!NOTE]
87
+
> ARM users: there is no Oracle JDK v8 for ARM.
70
88
> 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.
71
89
> [Amazon Corretto](https://aws.amazon.com/corretto/) builds have also been proven to work.
72
90
73
91
> [!NOTE]
74
-
> MacOS users: remember that `/usr/libexec/java_home` may control which JDK is in your path.
92
+
> macOS users: remember that `/usr/libexec/java_home` may control which JDK is in your path.
75
93
76
-
**On Linux:**
94
+
####Linux
77
95
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/).
96
+
* Download and extract JDK 8, 11, 17, and 21 from [Eclipse Temurin releases](https://adoptium.net/temurin/releases/) and GraalVM 17 from [Oracle downloads](https://www.graalvm.org/downloads/).
79
97
* 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
-
* 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
-
```shell
82
-
export JAVA_8_HOME=/<path to extracted archive>/jdk8u<current version of JDK 8>
83
-
export JAVA_11_HOME=/<path to extracted archive>/jdk-11.<current version of JDK 11>
84
-
export JAVA_17_HOME=/<path to extracted archive>/jdk-17.<current version of JDK 17>
85
-
export JAVA_21_HOME=/<path to extracted archive>/jdk-21.<current version of JDK 21>
86
-
export JAVA_GRAALVM17_HOME=/<path to extracted archive>/graalvm-jdk-17.<current version of graalvm>/Contents/Home
87
-
export JAVA_HOME=$JAVA_8_HOME
88
-
```
98
+
* 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.
99
+
```shell
100
+
export JAVA_8_HOME=/<path to extracted archive>/jdk8u<current version of JDK 8>
101
+
export JAVA_11_HOME=/<path to extracted archive>/jdk-11.<current version of JDK 11>
102
+
export JAVA_17_HOME=/<path to extracted archive>/jdk-17.<current version of JDK 17>
103
+
export JAVA_21_HOME=/<path to extracted archive>/jdk-21.<current version of JDK 21>
104
+
export JAVA_GRAALVM17_HOME=/<path to extracted archive>/graalvm-jdk-17.<current version of graalvm>/Contents/Home
105
+
export JAVA_HOME=$JAVA_8_HOME
106
+
```
89
107
* Restart your shell after applying the changes if you appended the commands to your shell configuration file.
90
108
91
-
**On Windows:**
109
+
#### Windows
110
+
111
+
* Download and install JDK 8, 11, 17, and 21 [Eclipse Temurin releases](https://adoptium.net/temurin/releases/).
112
+
113
+
<details>
114
+
<summary>Alternatively, install JDKs using winget or scoop. (click here to expand)</summary>
* 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/).
94
-
* 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`
123
+
```pwsh
124
+
scoop bucket add java
125
+
scoop install temurin8-jdk
126
+
scoop install temurin11-jdk
127
+
scoop install temurin17-jdk
128
+
scoop install temurin21-jdk
129
+
```
130
+
131
+
</details>
132
+
133
+
* To add the required environment variables, run the following PowerShell commands for each SDK version, replacing the paths with the correct version installed:
You can trigger the installation by running any `git` command from the terminal, e.g. `git --version`.
107
149
If not installed, the terminal will prompt you to install it.
108
150
109
-
**On Linux:**
151
+
####Linux
110
152
111
-
Run `apt-get install git`.
153
+
```shell
154
+
apt-get install git
155
+
```
112
156
113
-
**On Windows:**
157
+
####Windows
114
158
115
-
Download and install [the installer](https://git-scm.com/download/win) from the official website.
159
+
Download and install the installer from [the official website](https://git-scm.com/download/win).
116
160
117
-
### Install Docker Desktop
161
+
<details>
162
+
<summary>Alternatively, install git using winget or scoop. (click here to expand)</summary>
118
163
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/).
164
+
```pwsh
165
+
winget install --id git.git
166
+
```
167
+
168
+
```pwsh
169
+
scoop install git
170
+
```
171
+
172
+
</details>
173
+
174
+
### Install Docker Desktop
120
175
121
176
> [!NOTE]
122
177
> Docker Desktop is the recommended container runtime environment, but you can use any other environment to run testcontainers tests.
123
178
> Check [the testcontainers container runtime requirements](https://java.testcontainers.org/supported_docker_environment/) for more details.
124
179
125
-
###Clone the repository and set up git
180
+
#### macOS
126
181
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:
211
+
```shell
212
+
cd dd-trace-java
213
+
cp .githooks/pre-commit .git/hooks/
214
+
```
215
+
144
216
> [!TIP]
145
217
> 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.
> Both git configurations (hooks and submodule) will only be applied to this project and won't apply globally in your setup.
166
238
167
-
### Check your development environment
168
-
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.
173
-
174
-
### Build the project
239
+
## Building the project
175
240
176
241
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).
177
242
178
-
## Project build
179
-
180
243
To build the project without running tests, run:
181
-
```bash
244
+
```shell
182
245
./gradlew clean assemble
183
246
```
184
247
185
248
To build the entire project with tests (this can take a very long time), run:
186
-
```bash
249
+
```shell
187
250
./gradlew clean build
188
251
```
189
252
@@ -193,7 +256,7 @@ To build the entire project with tests (this can take a very long time), run:
193
256
> 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.
0 commit comments