diff options
Diffstat (limited to 'subprojects/docs/src/develop/contributing/commands.md')
-rw-r--r-- | subprojects/docs/src/develop/contributing/commands.md | 172 |
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 | --- | ||
2 | SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | SPDX-License-Identifier: EPL-2.0 | ||
4 | sidebar_position: 1 | ||
5 | title: Build commands | ||
6 | --- | ||
7 | |||
8 | # Building from the command line | ||
9 | |||
10 | ## Gradle commands | ||
11 | |||
12 | We use [Gradle](https://gradle.org/) to manage the compilation and tests of Refinery. | ||
13 | |||
14 | Java code is built directly by Gradle. | ||
15 | We 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). | ||
16 | Typically, 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 | |||
24 | Compile all code, run all tests, and produce all build artifacts. | ||
25 | |||
26 | You 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. | ||
27 | This 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 | |||
36 | Publishes the Refinery Java artifacts to the [Maven local repository](https://www.baeldung.com/maven-local-repository). | ||
37 | |||
38 | Build 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 | |||
40 | For example, in Gradle, you may set | ||
41 | |||
42 | ```kotlin title="build.gradle.kts" | ||
43 | repositories { | ||
44 | mavenLocal() | ||
45 | } | ||
46 | |||
47 | dependencies { | ||
48 | implementation("tools.refinery:refinery-generator:0.0.0-SNAPSHOT") | ||
49 | } | ||
50 | ``` | ||
51 | |||
52 | to add a dependency on Refinery to your Java project. | ||
53 | |||
54 | ### `serve` | ||
55 | |||
56 | ```bash posix2windows | ||
57 | ./gradlew serve | ||
58 | ``` | ||
59 | |||
60 | Starts the Refinery backend and web interface on port 1312. | ||
61 | |||
62 | This task is ideal for running the Refinery backend if you don't intend to work on the frontend. | ||
63 | The Refinery frontend TypeScript projects is automatically built before the server starts. | ||
64 | The server will use the latest build output of the frontend as static assets. | ||
65 | |||
66 | The behavior of this task is influenced by the same [environmental variables](/learn/docker#environmental-variables) as the Refinery [Docker container](/learn/docker). | ||
67 | However, the default value of `REFINERY_LISTEN_PORT` is `1312`. | ||
68 | |||
69 | ### `serveBackend` | ||
70 | |||
71 | ```bash posix2windows | ||
72 | ./gradlew serveBackend | ||
73 | ``` | ||
74 | |||
75 | Starts the Refinery backend on port 1312. | ||
76 | |||
77 | This task is ideal for running the Refinery backend if you're working on the frontend. | ||
78 | No static assets will be build. | ||
79 | You'll need to use [`yarnw frontend dev`](#frontend-dev) | ||
80 | |||
81 | Like [`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). | ||
82 | However, the default value of `REFINERY_LISTEN_PORT` is `1312`. | ||
83 | |||
84 | ## Yarn commands | ||
85 | |||
86 | We provide a `yarnw` wrapper script to invoke the Yarn distribution installed by frontend-gradle-plugin directly. | ||
87 | The 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 | |||
95 | Builds and serves this documentation in development mode on port 3000. | ||
96 | Saved changes to most documentation sources are immediately reflected in the browse without reloading. | ||
97 | |||
98 | You 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 | |||
106 | Running this command for the first time may generate error messages like | ||
107 | ``` | ||
108 | ERROR failed to read input source map: failed to parse inline source map url | ||
109 | ``` | ||
110 | which can be safely ignored. | ||
111 | |||
112 | ::: | ||
113 | |||
114 | ### `frontend dev` | ||
115 | |||
116 | ```bash posix2windows | ||
117 | ./yarn frontend dev | ||
118 | ``` | ||
119 | |||
120 | Builds and serves the refinery frontend on port 1313. | ||
121 | Saved changes to most source files are immediately reflected in the browser without reload. | ||
122 | |||
123 | Before running this command, you need to start [`gradlew serveBackend`](#servebackend) to provide a backend for the frontend to connect to. | ||
124 | The development server of the frontend will proxy all WebSocket connections to the backend. | ||
125 | |||
126 | The following environmental variables influence the behavior of this command: | ||
127 | |||
128 | #### `REFINERY_LISTEN_HOST` | ||
129 | |||
130 | Hostname to listen at for incoming HTTP connections. | ||
131 | |||
132 | **Default value:** `localhost` | ||
133 | |||
134 | #### `REFINERY_LISTEN_PORT` | ||
135 | |||
136 | TCP port to listen at for incoming HTTP connections. | ||
137 | |||
138 | **Default value:** `1313` | ||
139 | |||
140 | #### `REFINERY_BACKEND_HOST` | ||
141 | |||
142 | Hostname of the Refinery backend. | ||
143 | |||
144 | This 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 | |||
150 | TCP port of the Refinery backend. | ||
151 | |||
152 | This should match the `REFINERY_LISTEN_PORT` passed to [`gradlew serveBackend`](#servebackend). | ||
153 | |||
154 | **Default value:** `1312` | ||
155 | |||
156 | #### `REFINERY_PUBLIC_HOST` | ||
157 | |||
158 | Publicly visible hostname of the Refinery instance. | ||
159 | |||
160 | If you use a reverse proxy in front of the development server, you must set this variable. | ||
161 | Otherwise, 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 | |||
167 | Publicly visible port of the Refinery instance. | ||
168 | |||
169 | If you use a reverse proxy in front of the development server, you must set this variable. | ||
170 | Otherwise, connections to the development server will fail due to cross-origin protection. | ||
171 | |||
172 | **Default value:** equal to `REFINERY_LISTEN_PORT` | ||