-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Convenience symlinks are blindly traversed by Bazel... | ||
# https://github.com/bazelbuild/bazel/issues/10653#issuecomment-694230015 | ||
bazel-rules_appimage | ||
|
||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
common --enable_bzlmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
load("@py_deps//:requirements.bzl", "requirement") | ||
load("@rules_appimage//appimage:appimage.bzl", "appimage") | ||
load("@rules_python//python:defs.bzl", "py_binary") | ||
|
||
py_binary( | ||
name = "hello", | ||
srcs = ["hello.py"], | ||
data = ["//resources"], | ||
deps = [requirement("click")], | ||
) | ||
|
||
appimage( | ||
name = "hello.appimage", | ||
binary = ":hello", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Example workspace using rules_appimage.""" | ||
|
||
module(name = "rules_appimage_example", version = "0.0.0") | ||
|
||
bazel_dep(name = "rules_appimage", version = "1.5.0") | ||
|
||
bazel_dep(name = "rules_python", version = "0.27.1") | ||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain(python_version = "3.11") | ||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.parse( | ||
hub_name = "py_deps", | ||
python_version = "3.11", | ||
requirements_lock = "requirements.txt", | ||
) | ||
use_repo(pip, "py_deps") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Example Workspace using rules_appimage | ||
|
||
This is a simple example workspace that uses rules_appimage to build an AppImage from a py_binary. | ||
|
||
`BUILD` contains the definition of a `py_binary` target that is wrapped into an AppImage using the `appimage` rule. | ||
|
||
`integration_test.sh` shows how the appimage is built and invoked. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Example Python application.""" | ||
|
||
from pathlib import Path | ||
|
||
import click | ||
|
||
DATA_FILE = Path("resources/data.txt") | ||
|
||
|
||
@click.command() # type: ignore [misc] | ||
def main() -> None: | ||
"""Print "Hello, world!" to the console.""" | ||
data = DATA_FILE.read_text().strip() | ||
click.echo(data) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
bazel build //:hello.appimage | ||
|
||
trap "rm -f hello.appimage" EXIT | ||
cp -f bazel-bin/hello.appimage . | ||
|
||
ls -lah hello.appimage | ||
file hello.appimage | ||
|
||
if ! output="$(./hello.appimage 2>&1)"; then | ||
echo "Unexpected failure: $output" | ||
exit 1 | ||
elif [[ $output != "Hello, World!" ]]; then | ||
echo "Unexpected output: $output" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
click==8.1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
filegroup( | ||
name = "resources", | ||
srcs = ["data.txt"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello, World! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters