diff --git a/qt/aqt/data/web/css/BUILD.bazel b/qt/aqt/data/web/css/BUILD.bazel index 33d821773..ff0045e68 100644 --- a/qt/aqt/data/web/css/BUILD.bazel +++ b/qt/aqt/data/web/css/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_skylib//rules:copy_file.bzl", "copy_file") -load("//qt/aqt/data/web/pages:defs.bzl", "copy_page") +load("//ts:copy.bzl", "copy_files_into_group") load("compile_sass.bzl", "compile_sass") compile_sass( @@ -17,7 +17,7 @@ copy_file( out = "core.css", ) -copy_page( +copy_files_into_group( name = "editor", srcs = [ "editor.css", diff --git a/qt/aqt/data/web/js/BUILD.bazel b/qt/aqt/data/web/js/BUILD.bazel index 417c1a9bb..a5fec0c3d 100644 --- a/qt/aqt/data/web/js/BUILD.bazel +++ b/qt/aqt/data/web/js/BUILD.bazel @@ -1,6 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_library") load("@npm//@bazel/rollup:index.bzl", "rollup_bundle") -load("//qt/aqt/data/web/pages:defs.bzl", "copy_page") +load("//ts:copy.bzl", "copy_files_into_group") load("//ts:prettier.bzl", "prettier_test") load("//ts:eslint.bzl", "eslint_test") @@ -30,7 +30,7 @@ filegroup( output_group = "es5_sources", ) -copy_page( +copy_files_into_group( name = "editor", srcs = [ "editor.js", diff --git a/qt/aqt/data/web/pages/BUILD.bazel b/qt/aqt/data/web/pages/BUILD.bazel index 5e3ee0965..6c43e1e89 100644 --- a/qt/aqt/data/web/pages/BUILD.bazel +++ b/qt/aqt/data/web/pages/BUILD.bazel @@ -1,6 +1,6 @@ -load("defs.bzl", "copy_page") +load("//ts:copy.bzl", "copy_files_into_group") -copy_page( +copy_files_into_group( name = "graphs_page", srcs = [ "graphs.css", @@ -10,7 +10,7 @@ copy_page( package = "//ts/graphs", ) -copy_page( +copy_files_into_group( name = "congrats_page", srcs = [ "congrats.html", diff --git a/qt/aqt/data/web/pages/defs.bzl b/qt/aqt/data/web/pages/defs.bzl deleted file mode 100644 index 8f2668ba2..000000000 --- a/qt/aqt/data/web/pages/defs.bzl +++ /dev/null @@ -1,16 +0,0 @@ -load("@bazel_skylib//rules:copy_file.bzl", "copy_file") - -def copy_page(name, package, srcs): - outs = [] - for src in srcs: - copy_file( - name = src + "_copy", - src = package + ":" + src, - out = src, - ) - - native.filegroup( - name = name, - srcs = srcs, - visibility = ["//qt:__subpackages__"], - ) diff --git a/ts/copy.bzl b/ts/copy.bzl index 525814259..67f4227ef 100644 --- a/ts/copy.bzl +++ b/ts/copy.bzl @@ -1,3 +1,5 @@ +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") + def copy_files(ctx, files): cmds = [] inputs = [] @@ -51,3 +53,18 @@ def copy_select_files(ctx, files, include, exclude, base, unwanted_prefix): wanted.append((f, output)) return copy_files(ctx, wanted) + +def copy_files_into_group(name, package, srcs): + outs = [] + for src in srcs: + copy_file( + name = src + "_copy", + src = package + ":" + src, + out = src, + ) + + native.filegroup( + name = name, + srcs = srcs, + visibility = ["//qt:__subpackages__"], + )