diff --git a/BUILD.bazel b/BUILD.bazel index d8aaa6f..55229f8 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -21,6 +21,7 @@ exports_files([ "biome.json", ]) +#ifndef _BZLPARTY_RELEASE_ formatter( name = "format", config = ":formatter.json", @@ -51,3 +52,4 @@ formatter_test( "@buildifier_prebuilt//:buildifier": "buildifier", }, ) +#endif diff --git a/scripts/release/BUILD.bazel b/scripts/release/BUILD.bazel index 452d7e0..c9e5d35 100644 --- a/scripts/release/BUILD.bazel +++ b/scripts/release/BUILD.bazel @@ -8,7 +8,6 @@ load( "url_flag", "versioned_module_bazel", ) -load(":defs.bzl", "root_build_file", "toolchains_build_file") sh_binary( name = "copy_assets", @@ -39,30 +38,22 @@ release_tag( build_setting_default = "main", ) -cmd_assets( - name = "sha_assets", - binary = "sha", +[cmd_assets( + name = "%s_assets" % cmd, + binary = cmd, integrity_map = { - "//cmd/sha:sha_%s_sha384" % p: p + "//cmd/%s:%s_%s_sha384" % (cmd, cmd, p): p for p in PLATFORMS.keys() }, url_flag = "//scripts/release:asset_url", -) - -cmd_assets( - name = "templ_assets", - binary = "templ", - integrity_map = { - "//cmd/templ:templ_%s_sha384" % p: p - for p in PLATFORMS.keys() - }, - url_flag = "//scripts/release:asset_url", -) +) for cmd in [ + "sha", + "templ", +]] versioned_module_bazel( name = "versioned_module_bazel", out = "versioned_MODULE.bazel", - tags = ["manual"], version = ":release_tag", ) @@ -71,7 +62,6 @@ dcomment( src = ":versioned_module_bazel", out = "root_MODULE.bazel", defines = "_BZLPARTY_RELEASE_", - tags = ["manual"], ) dcomment( @@ -79,12 +69,21 @@ dcomment( src = "//docs:BUILD.bazel", out = "docs_BUILD.bazel", defines = "_BZLPARTY_RELEASE_", - tags = ["manual"], ) -root_build_file(name = "root_build_bazel") +dcomment( + name = "root_build_bazel", + src = "//:BUILD.bazel", + out = "root_BUILD.bazel", + defines = "_BZLPARTY_RELEASE_", +) -toolchains_build_file(name = "toolchains_build_bazel") +dcomment( + name = "toolchains_build_bazel", + src = "//toolchains:BUILD.bazel", + out = "toolchains_BUILD.bazel", + defines = "_BZLPARTY_RELEASE_", +) git_archive( name = "git_archive", diff --git a/scripts/release/defs.bzl b/scripts/release/defs.bzl deleted file mode 100644 index 1b79606..0000000 --- a/scripts/release/defs.bzl +++ /dev/null @@ -1,69 +0,0 @@ -"Release helpers" - -load("@bazel_skylib//rules:write_file.bzl", "write_file") - -_ROOT_BUILD_FILE = """\ -load("@rules_license//rules:license.bzl", "license") - -package( - default_applicable_licenses = [":license"], - default_visibility = ["//visibility:public"], -) - -license( - name = "license", - license_kinds = [ - "@rules_license//licenses/spdx:LGPL-3.0-or-later", - ], - license_text = "LICENSE", -) - -exports_files([ - "LICENSE", - "MODULE.bazel", - "extensions.bzl", -]) -""" - -_TOOLCHAINS_BUILD_FILE = """\ -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load(":toolchains.bzl", "bzlparty_toolchains") - -package(default_visibility = ["//visibility:public"]) - -bzlparty_toolchains() - -bzl_library( - name = "external", - srcs = ["external.bzl"], -) - -bzl_library( - name = "toolchains", - srcs = ["toolchains.bzl"], - deps = [ - "//lib:resolved_toolchains", - ], -) -""" - -def _write_build_file(name, prefix, content): - write_file( - name = name, - out = "%s_BUILD.bazel" % prefix, - content = content, - ) - -def root_build_file(name): - _write_build_file( - name = name, - prefix = "root", - content = [_ROOT_BUILD_FILE], - ) - -def toolchains_build_file(name): - _write_build_file( - name = name, - prefix = "toolchains", - content = [_TOOLCHAINS_BUILD_FILE], - ) diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel index e6fe458..8773549 100644 --- a/toolchains/BUILD.bazel +++ b/toolchains/BUILD.bazel @@ -4,6 +4,9 @@ load(":toolchains.bzl", "bzlparty_toolchains") package(default_visibility = ["//visibility:public"]) +bzlparty_toolchains() + +#ifndef _BZLPARTY_RELEASE_ TOOLS = [ "biome", "fd", @@ -29,6 +32,7 @@ create_bzl_file( template = "toolchains", tools = TOOLS, ) +#endif bzl_library( name = "external", @@ -42,5 +46,3 @@ bzl_library( "//lib:resolved_toolchains", ], ) - -bzlparty_toolchains()