From ea0279c5114df01f4fc5069e6c053f35d6ea854b Mon Sep 17 00:00:00 2001 From: Xuan-Son Trinh Date: Fri, 4 Oct 2024 19:21:43 +0200 Subject: [PATCH] attempt to fix aspect test --- WORKSPACE.bzlmod | 7 +++++++ .../idea/blaze/aspect/integration/BUILD | 1 + .../BazelInvokingIntegrationTestRunner.java | 8 +++++++- aspect_template/BUILD | 20 ++++++++++++++++++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index af8719a298d..268e9e2488c 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -30,3 +30,10 @@ load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", " scalatest_repositories() scalatest_toolchain() + +load("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository") + +local_repository( + name = "intellij_aspect_template", + path = "aspect_template" +) diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BUILD b/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BUILD index 36cd49132c7..ac2031cb31e 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BUILD +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BUILD @@ -10,6 +10,7 @@ java_binary( srcs = ["BazelInvokingIntegrationTestRunner.java"], data = [ "//aspect:aspect_files", + "//aspect_template:aspect_files", ], main_class = "com.google.idea.blaze.aspect.integration.BazelInvokingIntegrationTestRunner", deps = [ diff --git a/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BazelInvokingIntegrationTestRunner.java b/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BazelInvokingIntegrationTestRunner.java index 7c9b07c8a0b..d2a69301d20 100644 --- a/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BazelInvokingIntegrationTestRunner.java +++ b/aspect/testing/tests/src/com/google/idea/blaze/aspect/integration/BazelInvokingIntegrationTestRunner.java @@ -57,7 +57,13 @@ public static void main(String[] a) throws Exception { "%s=%s/%s/aspect", AspectRepositoryProvider.OVERRIDE_REPOSITORY_FLAG, System.getenv("TEST_SRCDIR"), - System.getenv("TEST_WORKSPACE"))); + System.getenv("TEST_WORKSPACE")), + String.format( + "%s=%s/%s/aspect_template", + AspectRepositoryProvider.OVERRIDE_REPOSITORY_TEMPLATE_FLAG, + System.getenv("TEST_SRCDIR"), + System.getenv("TEST_WORKSPACE")) + ); if (bazelVersion.isAtLeast(6, 0, 0) && !aspectFlags.contains( diff --git a/aspect_template/BUILD b/aspect_template/BUILD index 94c750d4bf8..a13ef816525 100644 --- a/aspect_template/BUILD +++ b/aspect_template/BUILD @@ -1,5 +1,23 @@ filegroup( name = "aspect_files", - srcs = glob(["**"]), + srcs = [ + "WORKSPACE", + "BUILD.bazel", + "java_info.bzl", + ], visibility = ["//visibility:public"], +) + +genrule( + name = "rename_files", + srcs = ["BUILD.aspect"], + outs = ["BUILD.bazel"], + cmd = "cp $< $@", +) + +genrule( + name = "create_workspace_file", + outs = ["WORKSPACE"], + srcs = [], + cmd = r"""echo 'workspace(name = "intellij_aspect_template")' > $@""" ) \ No newline at end of file