Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
(cherry picked from commit f273278)
  • Loading branch information
Googler authored and mai93 committed May 6, 2024
1 parent 8eab498 commit 8be0ea9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
5 changes: 3 additions & 2 deletions build_defs/intellij_plugin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ intellij_plugin(
"""

load("@rules_java//java:defs.bzl", "java_binary", "java_import")
load(
"//build_defs:restrictions.bzl",
"RestrictedInfo",
Expand Down Expand Up @@ -291,7 +292,7 @@ def intellij_plugin(name, deps, plugin_xml, optional_plugin_xmls = [], jar_name
name = java_deps_name,
deps = deps,
)
native.java_binary(
java_binary(
name = binary_name,
runtime_deps = [":" + java_deps_name] + extra_runtime_deps,
create_executable = 0,
Expand Down Expand Up @@ -335,7 +336,7 @@ def intellij_plugin(name, deps, plugin_xml, optional_plugin_xmls = [], jar_name
)

# included (with tag) as a hack so that IJwB can recognize this is an intellij plugin
native.java_import(
java_import(
name = name,
jars = [jar_target_name],
tags = ["intellij-plugin"] + kwargs.pop("tags", []),
Expand Down
32 changes: 16 additions & 16 deletions intellij_platform_sdk/android_studio.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module contains the rules that exposes a plugin api for android studio.
"""

load("@rules_java//java:defs.bzl", "java_import", "java_library")
load("//intellij_platform_sdk:build_defs.bzl", "no_mockito_extensions")

def _glob(files, dir, extension, recursive = False, exclude = []):
Expand Down Expand Up @@ -103,7 +104,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):

# TODO: All these targets should be prefixed with ${name}, but for now keeping backwards compatibility.
kotlin_jars = my_glob(files, "plugins/Kotlin/lib", ".jar")
native.java_import(
java_import(
name = "kotlin",
jars = kotlin_jars,
tags = ["incomplete-deps"],
Expand All @@ -112,7 +113,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += kotlin_jars

terminal_jars = ["android-studio/plugins/terminal/lib/terminal.jar"]
native.java_import(
java_import(
name = "terminal",
jars = terminal_jars,
tags = ["incomplete-deps"],
Expand All @@ -121,7 +122,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += terminal_jars

java_jars = my_glob(files, "plugins/java/lib", ".jar") + ["android-studio/plugins/java/lib/resources/jdkAnnotations.jar"]
native.java_import(
java_import(
name = "java",
jars = java_jars,
tags = ["incomplete-deps"],
Expand All @@ -130,7 +131,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += java_jars

platform_images_jars = my_glob(files, "plugins/platform-images/lib", ".jar")
native.java_import(
java_import(
name = "platform_images",
jars = platform_images_jars,
tags = ["incomplete-deps"],
Expand All @@ -139,7 +140,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += platform_images_jars

devkit_jars = my_glob(files, "plugins/devkit/lib", ".jar")
native.java_import(
java_import(
name = "devkit",
jars = devkit_jars,
tags = ["incomplete-deps"],
Expand All @@ -148,7 +149,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += devkit_jars

hg4idea_jars = my_glob(files, "plugins/vcs-hg/lib", ".jar")
native.java_import(
java_import(
name = "hg4idea",
jars = hg4idea_jars,
tags = ["incomplete-deps"],
Expand All @@ -166,7 +167,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
my_glob(files, "plugins/android-ndk/lib", ".jar") +
my_glob(files, "plugins/sdk-updates/lib", ".jar")
)
native.java_import(
java_import(
name = "android",
jars = android_jars,
tags = ["incomplete-deps"],
Expand All @@ -193,7 +194,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
my_glob(files, "plugins/webp/lib", ".jar")
)
bundled_plugins_data = my_glob(files, "plugins/design-tools/resources/layoutlib", "", recursive = True)
native.java_import(
java_import(
name = "bundled_plugins",
testonly = 1,
data = bundled_plugins_data,
Expand All @@ -207,7 +208,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += bundled_plugins_jars + bundled_plugins_data

test_recorder_jars = my_glob(files, "plugins/test-recorder/lib", ".jar")
native.java_import(
java_import(
name = "test_recorder",
jars = test_recorder_jars,
tags = ["incomplete-deps"],
Expand All @@ -216,7 +217,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += test_recorder_jars

coverage_jars = my_glob(files, "plugins/java-coverage/lib", ".jar")
native.java_import(
java_import(
name = "coverage",
jars = coverage_jars,
tags = ["incomplete-deps"],
Expand All @@ -225,7 +226,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
unpacked += coverage_jars

junit_jars = my_glob(files, "plugins/junit/lib", ".jar")
native.java_import(
java_import(
name = "junit",
jars = junit_jars,
tags = ["incomplete-deps"],
Expand All @@ -239,7 +240,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
"lib/testFramework.jar",
"lib/bouncy-castle.jar",
]) # b/183925215: mockito-extensions needs to be removed from these jars.
native.java_import(
java_import(
name = "sdk_import",
jars = sdk_import_jars,
tags = [
Expand All @@ -263,8 +264,7 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
cidr_plugins_jars += my_glob(files, "plugins/c-clangd-plugin/lib", ".jar") # required for NDK debugging
else:
cidr_plugins_jars += my_glob(files, "plugins/c-clangd/lib", ".jar") # required for NDK debugging

native.java_import(
java_import(
name = "cidr_plugins",
jars = cidr_plugins_jars,
tags = ["incomplete-deps"],
Expand All @@ -276,15 +276,15 @@ def _android_studio(name, files, major, minor, revision, my_glob, **kwargs):
guava_jars = ["android-studio/lib/lib.jar"]
else:
guava_jars = ["android-studio/lib/3rd-party-rt.jar"]
native.java_import(
java_import(
name = "guava",
jars = guava_jars,
tags = ["incomplete-deps"],
**kwargs
)
# unpacked += guava_jars # Already extracted in sdk_import

native.java_library(
java_library(
name = "sdk",
exports = [
":jars_without_mockito_extensions",
Expand Down
5 changes: 3 additions & 2 deletions intellij_platform_sdk/build_defs.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Convenience methods for plugin_api."""

load("@rules_java//java:defs.bzl", "java_import")

# The current indirect ij_product mapping (eg. "intellij-latest")
INDIRECT_IJ_PRODUCTS = {
# Indirect ij_product mapping for internal Blaze Plugin
Expand Down Expand Up @@ -596,8 +598,7 @@ def no_mockito_extensions(name, jars, **kwargs):
""",
)
output_jars.append(output_jar_name)

native.java_import(
java_import(
name = name,
jars = output_jars,
**kwargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public void testBuildIncludes() throws IOException {
assertThat(qs.getSourceFilesMap()).containsKey(buildLabel);
SourceFile buildSrc = qs.getSourceFilesMap().get(buildLabel);
assertThat(buildSrc.getSubincludeList())
.containsExactly(TestData.ROOT_PACKAGE + "/buildincludes:includes.bzl");
.contains(TestData.ROOT_PACKAGE + "/buildincludes:includes.bzl");
assertThat(qs.getReverseSubincludeMap())
.containsExactly(
.containsAtLeast(
TestData.ROOT.resolve("buildincludes/includes.bzl"),
TestData.ROOT.resolve("buildincludes/BUILD"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Test module for the purpose of including something in a BUILD file."""

load("@rules_java//java:defs.bzl", "java_library")

def my_java_library(name):
native.java_library(
java_library(
name = name,
srcs = native.glob(["*.java"]),
deps = [],
Expand Down
6 changes: 3 additions & 3 deletions testing/test_defs.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Custom rule for creating IntelliJ plugin tests.
"""

load("@rules_java//java:defs.bzl", "java_test")
load(
"//build_defs:build_defs.bzl",
"api_version_txt",
Expand Down Expand Up @@ -127,7 +128,7 @@ def intellij_unit_test_suite(
test_package_root = test_package_root,
class_rules = class_rules,
)
native.java_test(
java_test(
name = name,
size = size,
srcs = srcs + [suite_class_name],
Expand Down Expand Up @@ -231,8 +232,7 @@ def intellij_integration_test_suite(
args = kwargs.pop("args", [])
args.append("--main_advice_classpath=./%s/%s_protoeditor_resource_fix" % (native.package_name(), name))
data.append(name + "_protoeditor_resource_fix")

native.java_test(
java_test(
name = name,
size = size,
srcs = srcs + [suite_class_name],
Expand Down

0 comments on commit 8be0ea9

Please sign in to comment.