Exemplo n.º 1
0
 @Override
 public AspectDefinition getDefinition(AspectParameters aspectParameters) {
   AspectDefinition.Builder builder =
       new AspectDefinition.Builder("parametrized_definition_aspect")
           .attributeAspect("foo", ParametrizedDefinitionAspect.class);
   ImmutableCollection<String> baz = aspectParameters.getAttribute("baz");
   if (baz != null) {
     try {
       builder.add(attr("$dep", LABEL).value(Label.parseAbsolute(baz.iterator().next())));
     } catch (LabelSyntaxException e) {
       throw new IllegalStateException();
     }
   }
   return builder.build();
 }
  @Override
  public AspectDefinition getDefinition(AspectParameters aspectParameters) {
    AspectDefinition.Builder builder =
        new AspectDefinition.Builder(NAME)
            .attributeAspect("runtime_deps", AndroidStudioInfoAspect.class)
            .attributeAspect("resources", AndroidStudioInfoAspect.class)
            .add(
                attr("$packageParser", LABEL)
                    .cfg(HOST)
                    .exec()
                    .value(
                        Label.parseAbsoluteUnchecked(
                            Constants.TOOLS_REPOSITORY + "//tools/android:PackageParser")));

    for (PrerequisiteAttr prerequisiteAttr : PREREQUISITE_ATTRS) {
      builder.attributeAspect(prerequisiteAttr.name, AndroidStudioInfoAspect.class);
    }

    return builder.build();
  }
 @Override
 protected AspectDefinition.Builder addAdditionalAttributes(AspectDefinition.Builder builder) {
   return builder
       .add(
           attr("$protoc_darwin", LABEL)
               .cfg(HOST)
               .exec()
               .value(parseLabel("//tools/objc:compile_protos")))
       .add(
           attr("$protoc_support_darwin", LABEL)
               .cfg(HOST)
               .exec()
               .value(parseLabel("//tools/objc:proto_support")))
       .add(
           attr("$j2objc_plugin", LABEL)
               .cfg(HOST)
               .exec()
               .value(parseLabel("//third_party/java/j2objc:proto_plugin")));
 }