Skip to content

Commit 9d78dbf

Browse files
committed
update the documentation for gradle
this makes building JavaCAN much simpler
1 parent 1c98649 commit 9d78dbf

1 file changed

Lines changed: 14 additions & 34 deletions

File tree

README.md

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,24 @@ In case you have issues, have a look at the [troubleshooting document](TROUBLESH
123123

124124
For local compilation:
125125

126-
* Maven 3.3.1 or newer
127126
* GCC (or compatible)
128-
* Java 8 (Maven will enforce this)
127+
* Some version of Java (Gradle will download the correct one if necessary)
129128
* a libc
130129
* Bash
131130

132131
For cross compilation:
133132

134-
* Maven 3.3.1 or newer
135-
* Podman or docker and permissions to run containers (alternatively provide the `RUN_CONTAINER_COMMAND` env with a command that takes an image name)
136-
* Java 8 (Maven will enforce this)
133+
* Podman or docker and permissions to run containers
134+
* Some version of Java (Gradle will download the correct one if necessary)
137135
* Bash
138136

139137
For tests:
140138

141-
* Maven 3.3.1 or newer
142139
* A fairly recent Linux kernel with CAN support
143140
* The can-isotp kernel module loaded (Kernel 5.10 with `CONFIG_CAN_ISOTP` enabled or the [out-of-tree module](https://github.com/hartkopp/can-isotp))
144141
* [can-utils](https://github.com/linux-can/can-utils) installed in the `PATH`
145142
* A CAN interface named "vcan0"
146-
* Java 8 or newer installed
143+
* Some version of Java (Gradle will download the correct one if necessary)
147144
* a libc (unless compiled statically)
148145

149146
For usage:
@@ -157,36 +154,19 @@ For usage:
157154

158155
### Building
159156

160-
By default, the project only builds the native components (`single-architecture` maven profile) for the host system architecture:
157+
All architectures can be built in parallel with using the `compileNativeAll` task:
161158

162159
```bash
163-
mvn clean package
160+
./gradlew compileNativeAll
164161
```
165162

166-
This default build configuration will also execute the test suite.
167-
168-
Specifying the `javacan.architecture` option enables cross-compilation of the native components to the given architecture. If an architecture is specified that is not currently supported by the build,
169-
then the property `dockcross.image` must also be provided to provide the necessary dockcross image for the architecture.
170-
This can be used to build architectures that are not currently included in JavaCAN releases. The test suite will not be executed by default when cross-compiling, since the host system might not
171-
be able to execute the resulting binaries. If test execution on the host system is possible, enabling the `test` profile will include all tests into the build.
172-
By default, the libraries are linked dynamically, by setting the `dockcross.link-mode` property to `static` it can be switched to static linking, however not every dockcross image
173-
supports static linking (musl libc based images usually do).
174-
175-
In order to build all architectures that are currently part of releases, the `all-architectures` maven profile must be activated:
176-
177-
```bash
178-
mvn clean package -Pall-architectures
179-
```
163+
Alternatively there exist `packageNativeFor*` tasks for all the bundled architectures. A special task is packageNativeForHost, which will use
164+
the compiler toolchain on your machine instead of dockcross. This is primarily intended for unit tests, but can also be used to build on systems
165+
that are not supported by dockcross.
180166

181-
The `all-architectures` profile will execute the test suite using the `x86_64` libraries, however tests are not included by default. To override this the property `javacan.test.architecture` can be
182-
set to any other architecture that is part of the build.
183-
184-
To build android-specific architectures add the `android` profile.
185-
186-
If the architecture you are building *on* is not part of the build, then tests will always fail. To prevent this you have to disable the `test` maven profile:
187-
188-
```bash
189-
mvn clean package -P!test
190-
```
167+
All architectures allow their dockcross image to be overridden by properties like `dockcross.image.<architecture>`. The linking
168+
mode (`dynamic` or `static`) can also be overridden by properties like `dockcross.link.<architecture>`.
191169

192-
Each architecture in the `all-architectures` profile can have its dockcross image and linking mode overridden by setting the `dockcross.image.<arch>` and/or `dockcross.link-mode.<arch>` properties.
170+
Using the property `javacan.extra-archs` additional architectures can be defined as a comma-separated list. The values will be used as the
171+
jar classifier. These additional architectures will also require manually setting configuring the dockcross image and linking mode using the
172+
previously mentioned properties.

0 commit comments

Comments
 (0)