コード例 #1
0
ファイル: PrebuiltCxxLibrary.java プロジェクト: rowillia/buck
  @Override
  public CxxPreprocessorInput getCxxPreprocessorInput(
      CxxPlatform cxxPlatform, HeaderVisibility headerVisibility)
      throws NoSuchBuildTargetException {
    CxxPreprocessorInput.Builder builder = CxxPreprocessorInput.builder();

    switch (headerVisibility) {
      case PUBLIC:
        if (Preconditions.checkNotNull(hasHeaders.apply(cxxPlatform))) {
          CxxPreprocessables.addHeaderSymlinkTree(
              builder,
              getBuildTarget(),
              ruleResolver,
              cxxPlatform.getFlavor(),
              headerVisibility,
              CxxPreprocessables.IncludeType.SYSTEM);
        }
        builder.putAllPreprocessorFlags(
            Preconditions.checkNotNull(exportedPreprocessorFlags.apply(cxxPlatform)));
        // Just pass the include dirs as system includes.
        builder.addAllSystemIncludeRoots(
            Iterables.transform(includeDirs, getProjectFilesystem().getAbsolutifier()));
        return builder.build();
      case PRIVATE:
        return builder.build();
    }

    // We explicitly don't put this in a default statement because we
    // want the compiler to warn if someone modifies the HeaderVisibility enum.
    throw new RuntimeException("Invalid header visibility: " + headerVisibility);
  }
コード例 #2
0
ファイル: CxxPreprocessables.java プロジェクト: davido/buck
 /** Builds a {@link CxxPreprocessorInput} for a rule. */
 public static CxxPreprocessorInput getCxxPreprocessorInput(
     BuildRuleParams params,
     BuildRuleResolver ruleResolver,
     Flavor flavor,
     HeaderVisibility headerVisibility,
     IncludeType includeType,
     Multimap<CxxSource.Type, String> exportedPreprocessorFlags,
     Iterable<FrameworkPath> frameworks)
     throws NoSuchBuildTargetException {
   CxxPreprocessorInput.Builder builder =
       addHeaderSymlinkTree(
           CxxPreprocessorInput.builder(),
           params.getBuildTarget(),
           ruleResolver,
           flavor,
           headerVisibility,
           includeType);
   return builder
       .putAllPreprocessorFlags(exportedPreprocessorFlags)
       .addAllFrameworks(frameworks)
       .build();
 }