From 462ecdc43ab6ea262d1e69772802c340d3518318 Mon Sep 17 00:00:00 2001 From: John Hughes Date: Tue, 12 Sep 2023 11:58:29 +0200 Subject: [PATCH 01/12] Support Bazel Modules --- MODULE.bazel | 26 ++++++++++++++++++++++++++ WORKSPACE.bzlmod | 0 appimage/private/tool/mkappimage.py | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bzlmod diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..264b76e --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,26 @@ +module(name = "rules_appimage", version = "") + +bazel_dep(name = "bazel_skylib", version = "1.4.2") +bazel_dep(name = "rules_python", version = "0.25.0", dev_dependency = True) +bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "platforms", version = "0.0.7") + +python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True) +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) +pip.parse( + hub_name = "rules_appimage_py_deps", + python_version = "3.11", + requirements_lock = "//:requirements.txt", +) +use_repo(pip, "rules_appimage_py_deps") + +non_module_deps = use_extension("//:deps.bzl", "non_module_deps") +use_repo(non_module_deps, "squashfs-tools") +use_repo(non_module_deps, "zstd") +use_repo(non_module_deps, "appimagetool.png") +use_repo(non_module_deps, "appimage_runtime_aarch64") +use_repo(non_module_deps, "appimage_runtime_armhf") +use_repo(non_module_deps, "appimage_runtime_i686") +use_repo(non_module_deps, "appimage_runtime_x86_64") + +# -- bazel_dep definitions -- # diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000..e69de29 diff --git a/appimage/private/tool/mkappimage.py b/appimage/private/tool/mkappimage.py index 0c49f19..ac96207 100644 --- a/appimage/private/tool/mkappimage.py +++ b/appimage/private/tool/mkappimage.py @@ -17,7 +17,7 @@ def _get_path_or_raise(path: str) -> Path: runfiles = bazel_runfiles.Create() if not runfiles: raise FileNotFoundError("Could not find runfiles") - runfile = runfiles.Rlocation(path) + runfile = files.Rlocation(path) if not runfile: raise FileNotFoundError(f"Could not find {path} in runfiles") return Path(runfile) From ab93a2b73957e53df86775d8e74c624c65c3fdc3 Mon Sep 17 00:00:00 2001 From: John Hughes Date: Tue, 12 Sep 2023 12:15:57 +0200 Subject: [PATCH 02/12] Added version --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 264b76e..681c17f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,4 +1,4 @@ -module(name = "rules_appimage", version = "") +module(name = "rules_appimage", version = "1.2.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") bazel_dep(name = "rules_python", version = "0.25.0", dev_dependency = True) From bc736239404b3dda7e06a42c7ed41be0d69ecd3b Mon Sep 17 00:00:00 2001 From: John Hughes Date: Fri, 15 Sep 2023 14:22:18 +0200 Subject: [PATCH 03/12] Added test step with bzlmod enabled --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c8e56c2..78069a5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,9 @@ jobs: - name: Run tests run: bazel test --test_env=NO_CLEANUP=1 //... + - name: Run tests (bzlmod enabled) + run: bazel test --test_env=NO_CLEANUP=1 --enable_bzlmod //... + lint: runs-on: ubuntu-latest permissions: From 0af1aa3efbad2f99114caa35860b3ada91774cbb Mon Sep 17 00:00:00 2001 From: John Hughes Date: Fri, 15 Sep 2023 14:44:52 +0200 Subject: [PATCH 04/12] fixes --- MODULE.bazel | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 681c17f..c6db76e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,11 +1,13 @@ module(name = "rules_appimage", version = "1.2.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") -bazel_dep(name = "rules_python", version = "0.25.0", dev_dependency = True) +bazel_dep(name = "rules_python", version = "0.25.0") bazel_dep(name = "rules_cc", version = "0.0.8") bazel_dep(name = "platforms", version = "0.0.7") -python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True) +python = use_extension("@rules_python//python/extensions:python.bzl", "python") + +# These pip deps are only used for the tests, hence the dev_dependency = True pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) pip.parse( hub_name = "rules_appimage_py_deps", From 1dd69d790f51efd0e854cf496014543fd97da5b7 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 25 Oct 2023 20:35:01 +0200 Subject: [PATCH 05/12] Don't test w/ bzlmod for Bazel 5 --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 78069a5..d4970ac 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,7 @@ jobs: run: bazel test --test_env=NO_CLEANUP=1 //... - name: Run tests (bzlmod enabled) + if: ${{ matrix.bazel-version != '5.x' }} run: bazel test --test_env=NO_CLEANUP=1 --enable_bzlmod //... lint: From 222c33d681c44fa979fb382f74b337bd0024d32f Mon Sep 17 00:00:00 2001 From: Ziad Date: Mon, 20 Nov 2023 16:50:05 +0100 Subject: [PATCH 06/12] multiple use_repos are not necessary --- MODULE.bazel | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index c6db76e..4e00143 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,13 +16,7 @@ pip.parse( ) use_repo(pip, "rules_appimage_py_deps") -non_module_deps = use_extension("//:deps.bzl", "non_module_deps") -use_repo(non_module_deps, "squashfs-tools") -use_repo(non_module_deps, "zstd") -use_repo(non_module_deps, "appimagetool.png") -use_repo(non_module_deps, "appimage_runtime_aarch64") -use_repo(non_module_deps, "appimage_runtime_armhf") -use_repo(non_module_deps, "appimage_runtime_i686") -use_repo(non_module_deps, "appimage_runtime_x86_64") +non_module_deps = use_extension("@rules_appimage//:deps.bzl", "non_module_deps") +use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64") # -- bazel_dep definitions -- # From ccd701967f056e847335d39025eb1fb82ed89781 Mon Sep 17 00:00:00 2001 From: Ziad Date: Mon, 20 Nov 2023 17:07:28 +0100 Subject: [PATCH 07/12] Try to upgrade appimage to bzlmod in a backward compatible manner --- MODULE.bazel | 6 +++--- appimage/private/tool/mkappimage.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 4e00143..1dab797 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,7 +2,7 @@ module(name = "rules_appimage", version = "1.2.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") bazel_dep(name = "rules_python", version = "0.25.0") -bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "platforms", version = "0.0.7") python = use_extension("@rules_python//python/extensions:python.bzl", "python") @@ -17,6 +17,6 @@ pip.parse( use_repo(pip, "rules_appimage_py_deps") non_module_deps = use_extension("@rules_appimage//:deps.bzl", "non_module_deps") -use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64") +use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64", "appimage_runtime_i386", "appimage_runtime_armv7e-m") -# -- bazel_dep definitions -- # +register_toolchains("@rules_appimage//appimage:all") diff --git a/appimage/private/tool/mkappimage.py b/appimage/private/tool/mkappimage.py index ac96207..0c49f19 100644 --- a/appimage/private/tool/mkappimage.py +++ b/appimage/private/tool/mkappimage.py @@ -17,7 +17,7 @@ def _get_path_or_raise(path: str) -> Path: runfiles = bazel_runfiles.Create() if not runfiles: raise FileNotFoundError("Could not find runfiles") - runfile = files.Rlocation(path) + runfile = runfiles.Rlocation(path) if not runfile: raise FileNotFoundError(f"Could not find {path} in runfiles") return Path(runfile) From 65e3aeb9b0183839b7e9c3ac5aff6f710163af9a Mon Sep 17 00:00:00 2001 From: ziad-fernride Date: Sun, 3 Dec 2023 15:52:06 +0100 Subject: [PATCH 08/12] register tool chain in module as well --- MODULE.bazel | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index 1dab797..48db9a8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,3 +20,7 @@ non_module_deps = use_extension("@rules_appimage//:deps.bzl", "non_module_deps") use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64", "appimage_runtime_i386", "appimage_runtime_armv7e-m") register_toolchains("@rules_appimage//appimage:all") + +python.toolchain( + python_version = "3.11", +) From 86854352c6cf8a4bee821e545a5662f4d5bcd8a2 Mon Sep 17 00:00:00 2001 From: ziad-fernride Date: Sun, 3 Dec 2023 16:16:43 +0100 Subject: [PATCH 09/12] WORKSPACE.bzlmod making it act weird --- MODULE.bazel | 19 +------------------ WORKSPACE.bzlmod | 0 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 WORKSPACE.bzlmod diff --git a/MODULE.bazel b/MODULE.bazel index 48db9a8..36af429 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,26 +1,9 @@ module(name = "rules_appimage", version = "1.2.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") -bazel_dep(name = "rules_python", version = "0.25.0") +bazel_dep(name = "rules_python", version = "0.26.0") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "platforms", version = "0.0.7") -python = use_extension("@rules_python//python/extensions:python.bzl", "python") - -# These pip deps are only used for the tests, hence the dev_dependency = True -pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) -pip.parse( - hub_name = "rules_appimage_py_deps", - python_version = "3.11", - requirements_lock = "//:requirements.txt", -) -use_repo(pip, "rules_appimage_py_deps") - non_module_deps = use_extension("@rules_appimage//:deps.bzl", "non_module_deps") use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64", "appimage_runtime_i386", "appimage_runtime_armv7e-m") - -register_toolchains("@rules_appimage//appimage:all") - -python.toolchain( - python_version = "3.11", -) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod deleted file mode 100644 index e69de29..0000000 From 43f29c4c876916eb7c85824160621861f1172171 Mon Sep 17 00:00:00 2001 From: ziad-fernride Date: Sun, 3 Dec 2023 16:21:11 +0100 Subject: [PATCH 10/12] calling deps in MODULE.bazel no longer necessary --- MODULE.bazel | 3 --- 1 file changed, 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 36af429..2cc0495 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,6 +4,3 @@ bazel_dep(name = "bazel_skylib", version = "1.4.2") bazel_dep(name = "rules_python", version = "0.26.0") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "platforms", version = "0.0.7") - -non_module_deps = use_extension("@rules_appimage//:deps.bzl", "non_module_deps") -use_repo(non_module_deps, "squashfs-tools", "zstd", "appimagetool.png", "appimage_runtime_aarch64", "appimage_runtime_armhf", "appimage_runtime_i686", "appimage_runtime_x86_64", "appimage_runtime_i386", "appimage_runtime_armv7e-m") From 7dca9fa642ec7164c8a85b9ed96fb8dd7ec1abe3 Mon Sep 17 00:00:00 2001 From: ziad-fernride Date: Sun, 3 Dec 2023 16:44:18 +0100 Subject: [PATCH 11/12] try to use the bazel version that seems to have solved the issue we are having --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index 19b860c..798e389 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.4.0 +6.3.0 From 35107b66312c89653f5b3a763cf24cf32c88ccb4 Mon Sep 17 00:00:00 2001 From: ziad-fernride Date: Sun, 3 Dec 2023 16:59:53 +0100 Subject: [PATCH 12/12] remove rules_python from MODULE.bazel --- .bazelversion | 2 +- MODULE.bazel | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelversion b/.bazelversion index 798e389..19b860c 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.3.0 +6.4.0 diff --git a/MODULE.bazel b/MODULE.bazel index 2cc0495..a023387 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,5 @@ module(name = "rules_appimage", version = "1.2.0") bazel_dep(name = "bazel_skylib", version = "1.4.2") -bazel_dep(name = "rules_python", version = "0.26.0") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "platforms", version = "0.0.7")