Skip to content

Commit

Permalink
Update cloud action to allow platform specific builds
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Sep 2, 2024
1 parent 9ef3d77 commit b8a9578
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -869,17 +869,16 @@ See [Modular resources](/registry/) for a conceptual overview of modules and the
##### Using the `build` subcommand
You can use the `module build start` or `module build local` commands to build your custom module according to the build steps you specify in your <file>meta.json</file> file:
You can use the `module build start` or `module build local` commands to build your custom module according to the build steps in your <file>meta.json</file> file:
- Use `build start` to build or compile your module on a cloud build host that might offer additional platform support than you have access to locally.
- Use `build start` to build or compile your module on a cloud build host that might offer more platform support than you have access to locally.
- Use `build local` to quickly test that your module builds or compiles as expected on your local hardware.
To configure your module's build steps, add a `build` object to your [`meta.json` file](#the-metajson-file) like the following:
To configure your module's build steps, add a `build` object to your [`meta.json` file](#the-metajson-file) like the following.
You can either have a single build file for all platforms, or platform specific files.
<!-- Developers can either have a single build file for all platforms, or platform specific files: -->
<!-- { {< tabs >}}
{ {% tab name="Single Build File" %}} -->
{{< tabs >}}
{{% tab name="Single Build File" %}}
```json {class="line-numbers linkable-line-numbers"}
"build": {
Expand All @@ -891,6 +890,27 @@ To configure your module's build steps, add a `build` object to your [`meta.json
}
```
{{% /tab %}}
{{% tab name="Platform Specific" %}}
```json {class="line-numbers linkable-line-numbers"}
"build": {
"path" : "dist/archive.tar.gz", // optional - path to your built module
// (passed to the 'viam module upload' command)
"arch": {
"linux/arm64": {
"build": "./build-linux-arm64.sh" // command that will build your module
},
"darwin/arm64": {
"build": "./build-darwin-arm64.sh" // command that will build your module
}
} // architecture(s) to build for
}
```
{{% /tab %}}
{{< /tabs >}}
{{%expand "Click to view example setup.sh" %}}
```sh { class="command-line"}
Expand Down Expand Up @@ -954,27 +974,9 @@ tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
{{% /expand%}}
<!-- { {% /tab %}} -->
<!-- { {% tab name="Platform Specific" %}}
{{%expand "Click to view example build-linux-arm64.sh" %}}
```json {class="line-numbers linkable-line-numbers"}
"build": {
"path" : "dist/archive.tar.gz", // optional - path to your built module
// (passed to the 'viam module upload' command)
"arch": {
"linux/arm64": {
"build": "./build-linux-arm64.sh" // command that will build your module
},
"darwin/arm64": {
"build": "./build-darwin-arm64.sh" // command that will build your module
}
} // architecture(s) to build for
}
```
{ {%expand "Click to view example build-linux-arm64.sh" %}}
```sh { class="command-line"}
```sh {class="line-numbers linkable-line-numbers"}
#!/bin/bash
set -e
Expand Down Expand Up @@ -1002,10 +1004,7 @@ python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
```
{ {% /expand%}}
{{ % /tab %}}
{ {< /tabs >}} -->
{{% /expand%}}
For example, the following extends the `my-module` <file>meta.json</file> file from the previous section using the single build file approach, adding a new `build` object to control its build parameters when used with `module build start` or `module build local`:
Expand Down

0 comments on commit b8a9578

Please sign in to comment.