diff options
author | 2016-05-20 17:59:11 +0000 | |
---|---|---|
committer | 2016-05-23 08:24:29 +0000 | |
commit | 243c6f2f906f8c9f4300a6b833def791d117b321 (patch) | |
tree | 6ef123f3f12da11067ee0d2e4f84a1e5d379f560 /src/test/java/com/google/devtools/build/lib/ideinfo | |
parent | 009b48bcfaf4ebb17f9ab03bea9036cfa3c12ff0 (diff) |
Change the way protos report their output.
--
MOS_MIGRATED_REVID=122846987
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/ideinfo')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/ideinfo/intellij_info.bzl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/ideinfo/intellij_info.bzl b/src/test/java/com/google/devtools/build/lib/ideinfo/intellij_info.bzl index 9648cba3e9..6e7ef44144 100644 --- a/src/test/java/com/google/devtools/build/lib/ideinfo/intellij_info.bzl +++ b/src/test/java/com/google/devtools/build/lib/ideinfo/intellij_info.bzl @@ -37,6 +37,14 @@ _kind_to_kind_id = { "java_wrap_cc": 17, } +# A map to convert JavaApiFlavor to ProtoLibraryLegacyJavaIdeInfo.ApiFlavor +_api_flavor_to_id = { + "FLAVOR_NONE": 0, + "FLAVOR_IMMUTABLE": 1, + "FLAVOR_MUTABLE": 2, + "FLAVOR_BOTH": 3, +} + _unrecognized_rule = -1; def get_kind_legacy(target, ctx): @@ -242,7 +250,7 @@ def java_rule_ide_info(target, ctx): Returns a pair of (JavaRuleIdeInfo proto, a set of ide-resolve-files). (or (None, empty set) if the rule is not Java rule). """ - if not hasattr(target, "java"): + if not hasattr(target, "java") or ctx.rule.kind == "proto_library": return (None, set()) sources = getSourcesFromRule(ctx) @@ -303,6 +311,19 @@ def is_test_rule(ctx): kind_string = ctx.rule.kind return kind_string.endswith("_test") +def proto_library_legacy_java_ide_info(target, ctx): + """ Build ProtoLibraryLegacyJavaIdeInfo.""" + if not hasattr(target, 'proto_legacy_java'): + return None + proto_info = target.proto_legacy_java.legacy_info + return struct_omit_none( + api_version = proto_info.api_version, + api_flavor = _api_flavor_to_id[proto_info.api_flavor], + jars1 = [library_artifact(output) for output in proto_info.jars1], + jars_mutable = [library_artifact(output) for output in proto_info.jars_mutable], + jars_immutable = [library_artifact(output) for output in proto_info.jars_immutable], + ) + def collect_labels(rule_attrs, attrs): """ Collect labels from attribute values. @@ -376,6 +397,8 @@ def _aspect_impl(target, ctx): (android_rule_ide_info, android_ide_resolve_files) = android_rule_ide_info(target, ctx) ide_resolve_files = ide_resolve_files | android_ide_resolve_files + proto_library_legacy_java_ide_info = proto_library_legacy_java_ide_info(target, ctx) + # Collect test info test_info = test_info(target, ctx) @@ -402,6 +425,7 @@ def _aspect_impl(target, ctx): android_rule_ide_info = android_rule_ide_info, tags = ctx.rule.attr.tags, test_info = test_info, + proto_library_legacy_java_ide_info = proto_library_legacy_java_ide_info, ) # Output the ide information file. |