Ejemplo n.º 1
0
  private JavaCompilationHelper initAttributes(
      JavaTargetAttributes.Builder attributes, JavaSemantics semantics) {
    JavaCompilationHelper helper =
        new JavaCompilationHelper(ruleContext, semantics, javaCommon.getJavacOpts(), attributes);

    helper.addLibrariesToAttributes(javaCommon.targetsTreatedAsDeps(ClasspathType.COMPILE_ONLY));
    helper.addProvidersToAttributes(
        JavaCommon.compilationArgsFromSources(ruleContext), asNeverLink);
    attributes.setStrictJavaDeps(getStrictAndroidDeps());
    attributes.setRuleKind(ruleContext.getRule().getRuleClass());
    attributes.setTargetLabel(ruleContext.getLabel());

    JavaCommon.validateConstraint(
        ruleContext, "android", javaCommon.targetsTreatedAsDeps(ClasspathType.BOTH));
    ruleContext.checkSrcsSamePackage(true);
    return helper;
  }
Ejemplo n.º 2
0
 JackCompilationHelper initJack(JavaTargetAttributes attributes) throws InterruptedException {
   AndroidSdkProvider sdk = AndroidSdkProvider.fromRuleContext(ruleContext);
   return new JackCompilationHelper.Builder()
       // blaze infrastructure
       .setRuleContext(ruleContext)
       // configuration
       .setOutputArtifact(
           ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_LIBRARY_JACK_FILE))
       // tools
       .setJackBinary(sdk.getJack())
       .setJillBinary(sdk.getJill())
       .setResourceExtractorBinary(sdk.getResourceExtractor())
       .setJackBaseClasspath(sdk.getAndroidBaseClasspathForJack())
       // sources
       .addJavaSources(attributes.getSourceFiles())
       .addSourceJars(attributes.getSourceJars())
       .addResources(attributes.getResources())
       .addProcessorNames(attributes.getProcessorNames())
       .addProcessorClasspathJars(attributes.getProcessorPath())
       .addExports(JavaCommon.getExports(ruleContext))
       .addClasspathDeps(javaCommon.targetsTreatedAsDeps(ClasspathType.COMPILE_ONLY))
       .addRuntimeDeps(javaCommon.targetsTreatedAsDeps(ClasspathType.RUNTIME_ONLY))
       .build();
 }
Ejemplo n.º 3
0
 public CcLinkParamsStore getCcLinkParamsStore() {
   return getCcLinkParamsStore(javaCommon.targetsTreatedAsDeps(ClasspathType.BOTH));
 }