From 39b314725a5d5cbcf0367b22295c73d5156e2ef0 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Sun, 15 Dec 2024 17:56:40 -0800 Subject: [PATCH] refactor: back out of vanity go module name for Aspect CLI (#7621) Updates copybara to account for https://github.com/aspect-build/aspect-cli/pull/791. --- ### Changes are visible to end-users: no ### Test plan - Manual testing; please provide instructions so we can reproduce: After this and https://github.com/aspect-build/aspect-cli/pull/791 lands, run copybara sync out. GitOrigin-RevId: 9234a139099662e5bcec7b464ec4dbc95586949e --- bazel/action_cache/BUILD.bazel | 2 +- bazel/analysis/BUILD.bazel | 2 +- bazel/buildeventstream/BUILD.bazel | 2 +- bazel/command_line/BUILD.bazel | 2 +- bazel/failure_details/BUILD.bazel | 2 +- bazel/flags/BUILD.bazel | 2 +- bazel/invocation_policy/BUILD.bazel | 2 +- bazel/options/BUILD.bazel | 2 +- bazel/packages_metrics/BUILD.bazel | 2 +- bazel/query/BUILD.bazel | 2 +- bazel/ts/BUILD.bazel | 0 bazel/ts/defs.bzl | 75 ------------------------- docs/bazelrc/BUILD.bazel | 2 +- gazelle/js/resolve.go | 16 ------ gazelle/kotlin/resolver.go | 16 ------ integration_tests/aspect/common.bats | 4 +- pkg/aspect/outputs/hash_test.go | 6 +- pkg/osutils/filesystem/windows_test.go | 2 + pkg/plugin/system/besproxy/bes_proxy.go | 2 +- 19 files changed, 19 insertions(+), 124 deletions(-) delete mode 100644 bazel/ts/BUILD.bazel delete mode 100644 bazel/ts/defs.bzl diff --git a/bazel/action_cache/BUILD.bazel b/bazel/action_cache/BUILD.bazel index c326c91dc..1fc84170f 100644 --- a/bazel/action_cache/BUILD.bazel +++ b/bazel/action_cache/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "bazel_proto", diff --git a/bazel/analysis/BUILD.bazel b/bazel/analysis/BUILD.bazel index e5fb971e8..d9382f251 100644 --- a/bazel/analysis/BUILD.bazel +++ b/bazel/analysis/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "bazel_proto", diff --git a/bazel/buildeventstream/BUILD.bazel b/bazel/buildeventstream/BUILD.bazel index 53919a783..a5c6bd3c3 100644 --- a/bazel/buildeventstream/BUILD.bazel +++ b/bazel/buildeventstream/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "buildeventstream_proto", diff --git a/bazel/command_line/BUILD.bazel b/bazel/command_line/BUILD.bazel index 03d1b7def..1b54ce1dd 100644 --- a/bazel/command_line/BUILD.bazel +++ b/bazel/command_line/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "command_line_proto", diff --git a/bazel/failure_details/BUILD.bazel b/bazel/failure_details/BUILD.bazel index 3b7615a6d..ebd34384e 100644 --- a/bazel/failure_details/BUILD.bazel +++ b/bazel/failure_details/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "failure_details_proto", diff --git a/bazel/flags/BUILD.bazel b/bazel/flags/BUILD.bazel index 962b30e3f..e8de93cf9 100644 --- a/bazel/flags/BUILD.bazel +++ b/bazel/flags/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "bazel_proto", diff --git a/bazel/invocation_policy/BUILD.bazel b/bazel/invocation_policy/BUILD.bazel index 160180e65..5aebd17f5 100644 --- a/bazel/invocation_policy/BUILD.bazel +++ b/bazel/invocation_policy/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "invocation_policy_proto", diff --git a/bazel/options/BUILD.bazel b/bazel/options/BUILD.bazel index 85131115d..235208158 100644 --- a/bazel/options/BUILD.bazel +++ b/bazel/options/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "options_proto", diff --git a/bazel/packages_metrics/BUILD.bazel b/bazel/packages_metrics/BUILD.bazel index b0ea7de34..6f3da09de 100644 --- a/bazel/packages_metrics/BUILD.bazel +++ b/bazel/packages_metrics/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "devtools_build_lib_packages_metrics_proto", diff --git a/bazel/query/BUILD.bazel b/bazel/query/BUILD.bazel index 8b0ac6af3..33d06e1cb 100644 --- a/bazel/query/BUILD.bazel +++ b/bazel/query/BUILD.bazel @@ -1,8 +1,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") load("//bazel/ts:defs.bzl", "ts_proto_library") +load("//bazel/go:write_go_generated_source_files.bzl", "write_go_generated_source_files") proto_library( name = "blaze_query_aspect_mirror_proto", diff --git a/bazel/ts/BUILD.bazel b/bazel/ts/BUILD.bazel deleted file mode 100644 index e69de29bb..000000000 diff --git a/bazel/ts/defs.bzl b/bazel/ts/defs.bzl deleted file mode 100644 index 16f4a675a..000000000 --- a/bazel/ts/defs.bzl +++ /dev/null @@ -1,75 +0,0 @@ -""" -Defaults for Typescript projects in Silo -""" - -load("@aspect_rules_swc//swc:defs.bzl", _swc = "swc") -load("@aspect_rules_ts//ts:defs.bzl", _ts_config = "ts_config", _ts_project = "ts_project") -load("@aspect_rules_ts//ts:proto.bzl", _ts_proto_library = "ts_proto_library") -load("@bazel_skylib//lib:partial.bzl", "partial") -load("@bazel_skylib//rules:write_file.bzl", _write_file = "write_file") - -ts_config = _ts_config - -def ts_project(name, module_type = "commonjs", **kwargs): - """Macro around ts_project for silo. - - Args: - name: Name of the ts_project target - module_type: Type of module swc should transpile to - **kwargs: Additional attributes to pass to the ts_project rule - """ - swcrc = ".swcrc_%s" % name - _write_file( - name = "swcrc_%s" % name, - out = swcrc, - content = json.encode({ - "inlineSourcesContent": True, - "jsc": { - "keepClassNames": True, - "parser": { - "decorators": True, - "decoratorsBeforeExport": False, - "dynamicImport": True, - "syntax": "typescript", - }, - "transform": { - "decoratorMetadata": True, - "legacyDecorator": True, - "react": { - "runtime": "automatic", - }, - }, - }, - "module": { - "type": module_type, - }, - "sourceMaps": True, - }).splitlines(), - ) - - tsconfig = kwargs.pop("tsconfig", "//bazel/ts:tsconfig.node") - - _ts_project( - name = name, - declaration = True, - source_map = True, - tsconfig = {"include": ["**/*.{ts,tsx}"]}, - extends = tsconfig, - transpiler = partial.make( - _swc, - source_maps = "true", - swcrc = swcrc, - ), - **kwargs - ) - -def ts_proto_library(name, protoc_gen_options = { - "js_import_style": "legacy_commonjs", - "target": "js+dts", -}, **kwargs): - _ts_proto_library( - name = name, - protoc_gen_options = protoc_gen_options, - proto_srcs = kwargs.pop("proto_srcs", native.glob(["*.proto"])), - **kwargs - ) diff --git a/docs/bazelrc/BUILD.bazel b/docs/bazelrc/BUILD.bazel index ca360ca76..54ee14d26 100644 --- a/docs/bazelrc/BUILD.bazel +++ b/docs/bazelrc/BUILD.bazel @@ -18,9 +18,9 @@ go_library( "convenience.bazelrc", "correctness.bazelrc", "debug.bazelrc", + "java.bazelrc", "javascript.bazelrc", "performance.bazelrc", - "java.bazelrc", ], importpath = "github.com/aspect-build/aspect-cli/docs/bazelrc", visibility = ["//visibility:public"], diff --git a/gazelle/js/resolve.go b/gazelle/js/resolve.go index 931190c5d..76dbeba9a 100644 --- a/gazelle/js/resolve.go +++ b/gazelle/js/resolve.go @@ -1,19 +1,3 @@ -/* - * Copyright 2023 Aspect Build Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package gazelle import ( diff --git a/gazelle/kotlin/resolver.go b/gazelle/kotlin/resolver.go index b7aa8aa04..8651daebe 100644 --- a/gazelle/kotlin/resolver.go +++ b/gazelle/kotlin/resolver.go @@ -1,19 +1,3 @@ -/* - * Copyright 2023 Aspect Build Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package gazelle import ( diff --git a/integration_tests/aspect/common.bats b/integration_tests/aspect/common.bats index 5e6ce4e2b..b429de675 100644 --- a/integration_tests/aspect/common.bats +++ b/integration_tests/aspect/common.bats @@ -6,12 +6,12 @@ aspect() { # but the configured path is only writable by specific users which we can't run as within the sandbox. # these system wide flag affect the output path of the bazel-in-bazel that is run inside the tests leading to errors. # NOTE: the output files left by bazel-in-bazel should be discarded as they are not part of the action. - "$TEST_SRCDIR/$TEST_WORKSPACE/cmd/aspect/aspect_/aspect" --aspect:nosystem_config --nosystem_rc --nohome_rc "$@" + "$TEST_SRCDIR/$TEST_WORKSPACE/cli/core/cmd/aspect/aspect_/aspect" --aspect:nosystem_config --nosystem_rc --nohome_rc "$@" } aspect_vanilla() { # for use with --version, -v and --bazel-version - "$TEST_SRCDIR/$TEST_WORKSPACE/cmd/aspect/aspect_/aspect" "$@" + "$TEST_SRCDIR/$TEST_WORKSPACE/cli/core/cmd/aspect/aspect_/aspect" "$@" } setup_file() { diff --git a/pkg/aspect/outputs/hash_test.go b/pkg/aspect/outputs/hash_test.go index 52c1cdde6..16d0a2b4a 100644 --- a/pkg/aspect/outputs/hash_test.go +++ b/pkg/aspect/outputs/hash_test.go @@ -1,5 +1,5 @@ /* - * Copyright 2023 Aspect Build Systems, Inc. + * Copyright 2022 Aspect Build Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +37,8 @@ func TestHash(t *testing.T) { t.Run("hashMurmur3Sync and hashMurmur3Concurrent return the same hash for the same set of files", func(t *testing.T) { g := NewGomegaWithT(t) - const testTarget1 = "//pkg/aspect/outputs:test_label" - const testTarget2 = "//pkg/aspect/outputs:test_label" + const testTarget1 = "//cli/core/pkg/aspect/outputs:test_label" + const testTarget2 = "//cli/core/pkg/aspect/outputs:test_label" hashFiles := make(map[string][]string) hashFiles["//:test_label_1"] = testFixtures(1) diff --git a/pkg/osutils/filesystem/windows_test.go b/pkg/osutils/filesystem/windows_test.go index 41ae47c10..1d6738194 100644 --- a/pkg/osutils/filesystem/windows_test.go +++ b/pkg/osutils/filesystem/windows_test.go @@ -19,6 +19,7 @@ package filesystem_test import ( + "io/fs" "syscall" "testing" "time" @@ -27,6 +28,7 @@ import ( . "github.com/onsi/gomega" "github.com/aspect-build/aspect-cli/pkg/osutils/filesystem" + filesystem_mock "github.com/aspect-build/aspect-cli/pkg/osutils/filesystem/mock" stdlib_mock "github.com/aspect-build/aspect-cli/pkg/stdlib/mock" ) diff --git a/pkg/plugin/system/besproxy/bes_proxy.go b/pkg/plugin/system/besproxy/bes_proxy.go index 6027385e6..2976a91e8 100644 --- a/pkg/plugin/system/besproxy/bes_proxy.go +++ b/pkg/plugin/system/besproxy/bes_proxy.go @@ -98,7 +98,7 @@ func (bp *besProxy) Send(req *buildv1.PublishBuildToolEventStreamRequest) error } // If we want to mutate the BES events in the future before they are sent out to external consumers, this is the place - // to do it. See https://github.com/aspect-build/silo/blob/7f13ab16fa10ffcec71b09737f0370f22a508823/pkg/plugin/system/besproxy/bes_proxy.go#L103 + // to do it. See https://github.com/aspect-build/silo/blob/7f13ab16fa10ffcec71b09737f0370f22a508823/cli/core/pkg/plugin/system/besproxy/bes_proxy.go#L103 // as an example. return bp.stream.Send(req)