aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/docs/src/develop/contributing/commands.md
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/docs/src/develop/contributing/commands.md')
-rw-r--r--subprojects/docs/src/develop/contributing/commands.md172
1 files changed, 172 insertions, 0 deletions
diff --git a/subprojects/docs/src/develop/contributing/commands.md b/subprojects/docs/src/develop/contributing/commands.md
new file mode 100644
index 00000000..abfea704
--- /dev/null
+++ b/subprojects/docs/src/develop/contributing/commands.md
@@ -0,0 +1,172 @@
1---
2SPDX-FileCopyrightText: 2024 The Refinery Authors
3SPDX-License-Identifier: EPL-2.0
4sidebar_position: 1
5title: Build commands
6---
7
8# Building from the command line
9
10## Gradle commands
11
12We use [Gradle](https://gradle.org/) to manage the compilation and tests of Refinery.
13
14Java code is built directly by Gradle.
15We use the [frontend-gradle-plugin](https://siouan.github.io/frontend-gradle-plugin/) to manage a [Node.js](https://nodejs.org/en) and [Yarn](https://yarnpkg.com/) installation, which in turn is used to build TypeScript code (including this documentation website).
16Typically, Yarn commands are issued by Gradle and you don't need to work with the TypeScript build system directly if you're only working on the Java parts of Refinery.
17
18### `build`
19
20```bash posix2windows
21./gradlew build
22```
23
24Compile all code, run all tests, and produce all build artifacts.
25
26You should run this command before submitting a [Pull request](https://github.com/graphs4value/refinery/pulls) to make sure that all code builds and tests pass on your local machine.
27This will also be run by GitHub Actions for each commit or pull requests.
28
29### `publishToMavenLocal`
30
31
32```bash posix2windows
33./gradlew publishToMavenLocal
34```
35
36Publishes the Refinery Java artifacts to the [Maven local repository](https://www.baeldung.com/maven-local-repository).
37
38Build tools, such as Gradle, will be able to consume such artifacts, which enables you to use the latest version of Refinery -- possibly including your own modification -- in other Java projects.
39
40For example, in Gradle, you may set
41
42```kotlin title="build.gradle.kts"
43repositories {
44 mavenLocal()
45}
46
47dependencies {
48 implementation("tools.refinery:refinery-generator:0.0.0-SNAPSHOT")
49}
50```
51
52to add a dependency on Refinery to your Java project.
53
54### `serve`
55
56```bash posix2windows
57./gradlew serve
58```
59
60Starts the Refinery backend and web interface on port 1312.
61
62This task is ideal for running the Refinery backend if you don't intend to work on the frontend.
63The Refinery frontend TypeScript projects is automatically built before the server starts.
64The server will use the latest build output of the frontend as static assets.
65
66The behavior of this task is influenced by the same [environmental variables](/learn/docker#environmental-variables) as the Refinery [Docker container](/learn/docker).
67However, the default value of `REFINERY_LISTEN_PORT` is `1312`.
68
69### `serveBackend`
70
71```bash posix2windows
72./gradlew serveBackend
73```
74
75Starts the Refinery backend on port 1312.
76
77This task is ideal for running the Refinery backend if you're working on the frontend.
78No static assets will be build.
79You'll need to use [`yarnw frontend dev`](#frontend-dev)
80
81Like [`gradlew serve`](#serve), the behavior of this task is influenced by the same [environmental variables](/learn/docker#environmental-variables) as the Refinery [Docker container](/learn/docker).
82However, the default value of `REFINERY_LISTEN_PORT` is `1312`.
83
84## Yarn commands
85
86We provide a `yarnw` wrapper script to invoke the Yarn distribution installed by frontend-gradle-plugin directly.
87The following commands can only be run once [`gradlew build`](#build) has installed the necessary Node.js and Yarn packages.
88
89### `docs dev`
90
91```bash posix2windows
92./yarn docs dev
93```
94
95Builds and serves this documentation in development mode on port 3000.
96Saved changes to most documentation sources are immediately reflected in the browse without reloading.
97
98You can set the port with the `-p` option, e.g. to use port 1313, use
99
100```bash posix2windows
101./yarn docs dev -p 1313
102```
103
104:::note
105
106Running this command for the first time may generate error messages like
107```
108ERROR failed to read input source map: failed to parse inline source map url
109```
110which can be safely ignored.
111
112:::
113
114### `frontend dev`
115
116```bash posix2windows
117./yarn frontend dev
118```
119
120Builds and serves the refinery frontend on port 1313.
121Saved changes to most source files are immediately reflected in the browser without reload.
122
123Before running this command, you need to start [`gradlew serveBackend`](#servebackend) to provide a backend for the frontend to connect to.
124The development server of the frontend will proxy all WebSocket connections to the backend.
125
126The following environmental variables influence the behavior of this command:
127
128#### `REFINERY_LISTEN_HOST`
129
130Hostname to listen at for incoming HTTP connections.
131
132**Default value:** `localhost`
133
134#### `REFINERY_LISTEN_PORT`
135
136TCP port to listen at for incoming HTTP connections.
137
138**Default value:** `1313`
139
140#### `REFINERY_BACKEND_HOST`
141
142Hostname of the Refinery backend.
143
144This should match the `REFINERY_LISTEN_HOST` passed to [`gradlew serveBackend`](#servebackend).
145
146**Default value:** `127.0.0.1` (connect to `localhost` over IPv4 only)
147
148#### `REFINERY_LISTEN_PORT`
149
150TCP port of the Refinery backend.
151
152This should match the `REFINERY_LISTEN_PORT` passed to [`gradlew serveBackend`](#servebackend).
153
154**Default value:** `1312`
155
156#### `REFINERY_PUBLIC_HOST`
157
158Publicly visible hostname of the Refinery instance.
159
160If you use a reverse proxy in front of the development server, you must set this variable.
161Otherwise, connections to the development server will fail due to cross-origin protection.
162
163**Default value:** equal to `REFINERY_LISTEN_HOST`
164
165#### `REFINERY_PUBLIC_PORT`
166
167Publicly visible port of the Refinery instance.
168
169If you use a reverse proxy in front of the development server, you must set this variable.
170Otherwise, connections to the development server will fail due to cross-origin protection.
171
172**Default value:** equal to `REFINERY_LISTEN_PORT`