-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously if there was an existing plugins attribute, and an additional plugin was added, the old value would get preserved rather than merged.
- Loading branch information
1 parent
0bef82e
commit 72a8d23
Showing
8 changed files
with
368 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
java/gazelle/testdata/additional_annotation_processor/BUILD.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# gazelle:java_annotation_processor_plugin com.google.auto.value.AutoValue com.google.auto.value.processor.AutoValueProcessor | ||
# gazelle:java_annotation_processor_plugin org.apache.logging.log4j.core.config.plugins.Plugin org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor |
39 changes: 39 additions & 0 deletions
39
java/gazelle/testdata/additional_annotation_processor/WORKSPACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
RULES_JVM_EXTERNAL_TAG = "6.1" | ||
|
||
RULES_JVM_EXTERNAL_SHA = "08ea921df02ffe9924123b0686dc04fd0ff875710bfadb7ad42badb931b0fd50" | ||
|
||
http_archive( | ||
name = "rules_jvm_external", | ||
sha256 = RULES_JVM_EXTERNAL_SHA, | ||
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, | ||
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG), | ||
) | ||
|
||
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") | ||
|
||
rules_jvm_external_deps() | ||
|
||
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") | ||
|
||
rules_jvm_external_setup() | ||
|
||
load("@rules_jvm_external//:defs.bzl", "maven_install") | ||
|
||
maven_install( | ||
name = "maven", | ||
artifacts = [ | ||
"com.google.auto.value:auto-value:1.10.4", | ||
"com.google.auto.value:auto-value-annotations:1.10.4", | ||
"org.apache.logging.log4j:log4j-core:2.23.1", | ||
], | ||
maven_install_json = "@//:maven_install.json", | ||
repositories = [ | ||
"https://repo1.maven.org/maven2", | ||
], | ||
) | ||
|
||
load("@maven//:defs.bzl", "pinned_maven_install") | ||
|
||
pinned_maven_install() |
242 changes: 242 additions & 0 deletions
242
java/gazelle/testdata/additional_annotation_processor/maven_install.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
{ | ||
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", | ||
"__INPUT_ARTIFACTS_HASH": -925168523, | ||
"__RESOLVED_ARTIFACTS_HASH": -749883653, | ||
"artifacts": { | ||
"com.google.auto.value:auto-value": { | ||
"shasums": { | ||
"jar": "f3c438d1f82904bbcb452084d488b660f3c7488e9274c3a58f049e121632d434" | ||
}, | ||
"version": "1.10.4" | ||
}, | ||
"com.google.auto.value:auto-value-annotations": { | ||
"shasums": { | ||
"jar": "e1c45e6beadaef9797cb0d9afd5a45621ad061cd8632012f85582853a3887825" | ||
}, | ||
"version": "1.10.4" | ||
}, | ||
"org.apache.logging.log4j:log4j-api": { | ||
"shasums": { | ||
"jar": "92ec1fd36ab3bc09de6198d2d7c0914685c0f7127ea931acc32fd2ecdd82ea89" | ||
}, | ||
"version": "2.23.1" | ||
}, | ||
"org.apache.logging.log4j:log4j-core": { | ||
"shasums": { | ||
"jar": "7079368005fc34f56248f57f8a8a53361c3a53e9007d556dbc66fc669df081b5" | ||
}, | ||
"version": "2.23.1" | ||
} | ||
}, | ||
"dependencies": { | ||
"org.apache.logging.log4j:log4j-core": [ | ||
"org.apache.logging.log4j:log4j-api" | ||
] | ||
}, | ||
"packages": { | ||
"com.google.auto.value:auto-value": [ | ||
"autovalue.shaded.com.google.auto.common", | ||
"autovalue.shaded.com.google.auto.service", | ||
"autovalue.shaded.com.google.common.annotations", | ||
"autovalue.shaded.com.google.common.base", | ||
"autovalue.shaded.com.google.common.cache", | ||
"autovalue.shaded.com.google.common.collect", | ||
"autovalue.shaded.com.google.common.escape", | ||
"autovalue.shaded.com.google.common.eventbus", | ||
"autovalue.shaded.com.google.common.graph", | ||
"autovalue.shaded.com.google.common.hash", | ||
"autovalue.shaded.com.google.common.html", | ||
"autovalue.shaded.com.google.common.io", | ||
"autovalue.shaded.com.google.common.math", | ||
"autovalue.shaded.com.google.common.net", | ||
"autovalue.shaded.com.google.common.primitives", | ||
"autovalue.shaded.com.google.common.reflect", | ||
"autovalue.shaded.com.google.common.util.concurrent", | ||
"autovalue.shaded.com.google.common.xml", | ||
"autovalue.shaded.com.google.errorprone.annotations", | ||
"autovalue.shaded.com.google.errorprone.annotations.concurrent", | ||
"autovalue.shaded.com.google.escapevelocity", | ||
"autovalue.shaded.com.google.j2objc.annotations", | ||
"autovalue.shaded.com.squareup.javapoet", | ||
"autovalue.shaded.kotlin", | ||
"autovalue.shaded.kotlin.annotation", | ||
"autovalue.shaded.kotlin.collections", | ||
"autovalue.shaded.kotlin.collections.builders", | ||
"autovalue.shaded.kotlin.collections.unsigned", | ||
"autovalue.shaded.kotlin.comparisons", | ||
"autovalue.shaded.kotlin.contracts", | ||
"autovalue.shaded.kotlin.coroutines", | ||
"autovalue.shaded.kotlin.coroutines.intrinsics", | ||
"autovalue.shaded.kotlin.coroutines.jvm.internal", | ||
"autovalue.shaded.kotlin.enums", | ||
"autovalue.shaded.kotlin.experimental", | ||
"autovalue.shaded.kotlin.internal", | ||
"autovalue.shaded.kotlin.internal.jdk7", | ||
"autovalue.shaded.kotlin.internal.jdk8", | ||
"autovalue.shaded.kotlin.jvm", | ||
"autovalue.shaded.kotlin.jvm.functions", | ||
"autovalue.shaded.kotlin.jvm.internal", | ||
"autovalue.shaded.kotlin.jvm.internal.markers", | ||
"autovalue.shaded.kotlin.random", | ||
"autovalue.shaded.kotlin.random.jdk8", | ||
"autovalue.shaded.kotlin.ranges", | ||
"autovalue.shaded.kotlin.reflect", | ||
"autovalue.shaded.kotlin.sequences", | ||
"autovalue.shaded.kotlin.text", | ||
"autovalue.shaded.kotlinx.metadata", | ||
"autovalue.shaded.kotlinx.metadata.internal", | ||
"autovalue.shaded.kotlinx.metadata.internal.common", | ||
"autovalue.shaded.kotlinx.metadata.internal.extensions", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata.deserialization", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata.jvm", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata.jvm.deserialization", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata.jvm.serialization", | ||
"autovalue.shaded.kotlinx.metadata.internal.metadata.serialization", | ||
"autovalue.shaded.kotlinx.metadata.internal.protobuf", | ||
"autovalue.shaded.kotlinx.metadata.jvm", | ||
"autovalue.shaded.kotlinx.metadata.jvm.internal", | ||
"autovalue.shaded.net.ltgt.gradle.incap", | ||
"autovalue.shaded.org.checkerframework.checker.nullness.qual", | ||
"autovalue.shaded.org.checkerframework.framework.qual", | ||
"autovalue.shaded.org.jetbrains.annotations", | ||
"autovalue.shaded.org.objectweb.asm", | ||
"com.google.auto.value.extension", | ||
"com.google.auto.value.extension.memoized.processor", | ||
"com.google.auto.value.extension.serializable.processor", | ||
"com.google.auto.value.extension.serializable.serializer", | ||
"com.google.auto.value.extension.serializable.serializer.impl", | ||
"com.google.auto.value.extension.serializable.serializer.interfaces", | ||
"com.google.auto.value.extension.serializable.serializer.runtime", | ||
"com.google.auto.value.extension.toprettystring.processor", | ||
"com.google.auto.value.processor" | ||
], | ||
"com.google.auto.value:auto-value-annotations": [ | ||
"com.google.auto.value", | ||
"com.google.auto.value.extension.memoized", | ||
"com.google.auto.value.extension.serializable", | ||
"com.google.auto.value.extension.toprettystring" | ||
], | ||
"org.apache.logging.log4j:log4j-api": [ | ||
"org.apache.logging.log4j", | ||
"org.apache.logging.log4j.internal", | ||
"org.apache.logging.log4j.message", | ||
"org.apache.logging.log4j.simple", | ||
"org.apache.logging.log4j.spi", | ||
"org.apache.logging.log4j.status", | ||
"org.apache.logging.log4j.util", | ||
"org.apache.logging.log4j.util.internal" | ||
], | ||
"org.apache.logging.log4j:log4j-core": [ | ||
"org.apache.logging.log4j.core", | ||
"org.apache.logging.log4j.core.appender", | ||
"org.apache.logging.log4j.core.appender.db", | ||
"org.apache.logging.log4j.core.appender.db.jdbc", | ||
"org.apache.logging.log4j.core.appender.mom", | ||
"org.apache.logging.log4j.core.appender.mom.jeromq", | ||
"org.apache.logging.log4j.core.appender.mom.kafka", | ||
"org.apache.logging.log4j.core.appender.nosql", | ||
"org.apache.logging.log4j.core.appender.rewrite", | ||
"org.apache.logging.log4j.core.appender.rolling", | ||
"org.apache.logging.log4j.core.appender.rolling.action", | ||
"org.apache.logging.log4j.core.appender.routing", | ||
"org.apache.logging.log4j.core.async", | ||
"org.apache.logging.log4j.core.config", | ||
"org.apache.logging.log4j.core.config.arbiters", | ||
"org.apache.logging.log4j.core.config.builder.api", | ||
"org.apache.logging.log4j.core.config.builder.impl", | ||
"org.apache.logging.log4j.core.config.composite", | ||
"org.apache.logging.log4j.core.config.json", | ||
"org.apache.logging.log4j.core.config.plugins", | ||
"org.apache.logging.log4j.core.config.plugins.convert", | ||
"org.apache.logging.log4j.core.config.plugins.processor", | ||
"org.apache.logging.log4j.core.config.plugins.util", | ||
"org.apache.logging.log4j.core.config.plugins.validation", | ||
"org.apache.logging.log4j.core.config.plugins.validation.constraints", | ||
"org.apache.logging.log4j.core.config.plugins.validation.validators", | ||
"org.apache.logging.log4j.core.config.plugins.visitors", | ||
"org.apache.logging.log4j.core.config.properties", | ||
"org.apache.logging.log4j.core.config.status", | ||
"org.apache.logging.log4j.core.config.xml", | ||
"org.apache.logging.log4j.core.config.yaml", | ||
"org.apache.logging.log4j.core.filter", | ||
"org.apache.logging.log4j.core.filter.mutable", | ||
"org.apache.logging.log4j.core.impl", | ||
"org.apache.logging.log4j.core.jackson", | ||
"org.apache.logging.log4j.core.jmx", | ||
"org.apache.logging.log4j.core.layout", | ||
"org.apache.logging.log4j.core.layout.internal", | ||
"org.apache.logging.log4j.core.lookup", | ||
"org.apache.logging.log4j.core.message", | ||
"org.apache.logging.log4j.core.net", | ||
"org.apache.logging.log4j.core.net.ssl", | ||
"org.apache.logging.log4j.core.osgi", | ||
"org.apache.logging.log4j.core.parser", | ||
"org.apache.logging.log4j.core.pattern", | ||
"org.apache.logging.log4j.core.script", | ||
"org.apache.logging.log4j.core.selector", | ||
"org.apache.logging.log4j.core.time", | ||
"org.apache.logging.log4j.core.time.internal", | ||
"org.apache.logging.log4j.core.tools", | ||
"org.apache.logging.log4j.core.tools.picocli", | ||
"org.apache.logging.log4j.core.util", | ||
"org.apache.logging.log4j.core.util.datetime", | ||
"org.apache.logging.log4j.core.util.internal" | ||
] | ||
}, | ||
"repositories": { | ||
"https://repo1.maven.org/maven2/": [ | ||
"com.google.auto.value:auto-value", | ||
"com.google.auto.value:auto-value-annotations", | ||
"org.apache.logging.log4j:log4j-api", | ||
"org.apache.logging.log4j:log4j-core" | ||
] | ||
}, | ||
"services": { | ||
"com.google.auto.value:auto-value": { | ||
"autovalue.shaded.kotlinx.metadata.internal.extensions.MetadataExtensions": [ | ||
"autovalue.shaded.kotlinx.metadata.jvm.internal.JvmMetadataExtensions" | ||
], | ||
"com.google.auto.value.extension.AutoValueExtension": [ | ||
"com.google.auto.value.extension.memoized.processor.MemoizeExtension", | ||
"com.google.auto.value.extension.serializable.processor.SerializableAutoValueExtension", | ||
"com.google.auto.value.extension.toprettystring.processor.ToPrettyStringExtension" | ||
], | ||
"com.google.auto.value.extension.serializable.serializer.interfaces.SerializerExtension": [ | ||
"com.google.auto.value.extension.serializable.serializer.impl.ImmutableListSerializerExtension", | ||
"com.google.auto.value.extension.serializable.serializer.impl.ImmutableMapSerializerExtension", | ||
"com.google.auto.value.extension.serializable.serializer.impl.OptionalSerializerExtension" | ||
], | ||
"javax.annotation.processing.Processor": [ | ||
"com.google.auto.value.extension.memoized.processor.MemoizedValidator", | ||
"com.google.auto.value.extension.toprettystring.processor.ToPrettyStringValidator", | ||
"com.google.auto.value.processor.AutoAnnotationProcessor", | ||
"com.google.auto.value.processor.AutoBuilderProcessor", | ||
"com.google.auto.value.processor.AutoOneOfProcessor", | ||
"com.google.auto.value.processor.AutoValueBuilderProcessor", | ||
"com.google.auto.value.processor.AutoValueProcessor" | ||
] | ||
}, | ||
"org.apache.logging.log4j:log4j-api": { | ||
"org.apache.logging.log4j.util.PropertySource": [ | ||
"org.apache.logging.log4j.util.EnvironmentPropertySource", | ||
"org.apache.logging.log4j.util.SystemPropertiesPropertySource" | ||
] | ||
}, | ||
"org.apache.logging.log4j:log4j-core": { | ||
"javax.annotation.processing.Processor": [ | ||
"org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor" | ||
], | ||
"org.apache.logging.log4j.core.util.ContextDataProvider": [ | ||
"org.apache.logging.log4j.core.impl.ThreadContextDataProvider" | ||
], | ||
"org.apache.logging.log4j.message.ThreadDumpMessage$ThreadInfoFactory": [ | ||
"org.apache.logging.log4j.core.message.ExtendedThreadInfoFactory" | ||
], | ||
"org.apache.logging.log4j.spi.Provider": [ | ||
"org.apache.logging.log4j.core.impl.Log4jProvider" | ||
] | ||
} | ||
}, | ||
"version": "2" | ||
} |
16 changes: 16 additions & 0 deletions
16
java/gazelle/testdata/additional_annotation_processor/src/main/java/com/example/BUILD.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary", "java_library") | ||
|
||
java_library( | ||
name = "example", | ||
srcs = ["Main.java"], | ||
plugins = ["@maven//:com_google_auto_value_auto_value__java_plugin__com_google_auto_value_processor_AutoValueProcessor"], | ||
visibility = ["//:__subpackages__"], | ||
deps = ["@maven//:com_google_auto_value_auto_value_annotations"], | ||
) | ||
|
||
java_binary( | ||
name = "Main", | ||
main_class = "com.example.Main", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = [":example"], | ||
) |
25 changes: 25 additions & 0 deletions
25
java/gazelle/testdata/additional_annotation_processor/src/main/java/com/example/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
load("@rules_java//java:defs.bzl", "java_binary", "java_library") | ||
|
||
java_library( | ||
name = "example", | ||
srcs = [ | ||
"LogProcessor.java", | ||
"Main.java", | ||
], | ||
plugins = [ | ||
"@maven//:com_google_auto_value_auto_value__java_plugin__com_google_auto_value_processor_AutoValueProcessor", | ||
"@maven//:org_apache_logging_log4j_log4j_core__java_plugin__org_apache_logging_log4j_core_config_plugins_processor_PluginProcessor", | ||
], | ||
visibility = ["//:__subpackages__"], | ||
deps = [ | ||
"@maven//:com_google_auto_value_auto_value_annotations", | ||
"@maven//:org_apache_logging_log4j_log4j_core", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "Main", | ||
main_class = "com.example.Main", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = [":example"], | ||
) |
19 changes: 19 additions & 0 deletions
19
...elle/testdata/additional_annotation_processor/src/main/java/com/example/LogProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example; | ||
|
||
import org.apache.logging.log4j.core.LogEvent; | ||
import org.apache.logging.log4j.core.appender.AbstractAppender; | ||
import org.apache.logging.log4j.core.config.plugins.Plugin; | ||
import org.apache.logging.log4j.core.config.plugins.PluginFactory; | ||
|
||
@Plugin(name = "LogProcessor") | ||
public class LogProcessor extends AbstractAppender { | ||
@PluginFactory | ||
public static LogProcessor create() { | ||
return new LogProcessor(); | ||
} | ||
|
||
@Override | ||
public void append(LogEvent event) { | ||
// This is not a very useful log appender, and that's ok. | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
java/gazelle/testdata/additional_annotation_processor/src/main/java/com/example/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
class Main { | ||
public static void main(String[] args) { | ||
Animal pig = Animal.create("pig", 4); | ||
Animal chicken = Animal.create("chicken", 2); | ||
System.out.printf("Checking if %s has same legs as %s: %s%n", pig, chicken, pig.numberOfLegs() == chicken.numberOfLegs()); | ||
} | ||
|
||
@AutoValue | ||
public abstract static class Animal { | ||
static Animal create(String name, int numberOfLegs) { | ||
return new AutoValue_Main_Animal(name, numberOfLegs); | ||
} | ||
|
||
abstract String name(); | ||
abstract int numberOfLegs(); | ||
} | ||
} |