Exemple #1
0
 /** Returns a list of default XCode build settings for Bazel-generated XCode projects. */
 @VisibleForTesting
 static Iterable<XcodeprojBuildSetting> defaultXcodeSettings() {
   // Do not use XCode headermap because Bazel-generated header search paths are sufficient for
   // resolving header imports.
   return ImmutableList.of(
       XcodeprojBuildSetting.newBuilder().setName("USE_HEADERMAP").setValue("NO").build());
 }
  /** Returns this target's Xcode build settings. */
  private Iterable<XcodeprojBuildSetting> buildSettings() {
    ImmutableList.Builder<XcodeprojBuildSetting> buildSettings = new ImmutableList.Builder<>();
    if (attributes.appIcon() != null) {
      buildSettings.add(
          XcodeprojBuildSetting.newBuilder()
              .setName("ASSETCATALOG_COMPILER_APPICON_NAME")
              .setValue(attributes.appIcon())
              .build());
    }
    if (attributes.launchImage() != null) {
      buildSettings.add(
          XcodeprojBuildSetting.newBuilder()
              .setName("ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME")
              .setValue(attributes.launchImage())
              .build());
    }

    // Convert names to a sequence containing "1" and/or "2" for iPhone and iPad, respectively.
    ImmutableSet<TargetDeviceFamily> families = bundleSupport.targetDeviceFamilies();
    Iterable<Integer> familyIndexes =
        families.isEmpty() ? ImmutableList.<Integer>of() : UI_DEVICE_FAMILY_VALUES.get(families);
    buildSettings.add(
        XcodeprojBuildSetting.newBuilder()
            .setName("TARGETED_DEVICE_FAMILY")
            .setValue(Joiner.on(',').join(familyIndexes))
            .build());

    Artifact entitlements = attributes.entitlements();
    if (entitlements != null) {
      buildSettings.add(
          XcodeprojBuildSetting.newBuilder()
              .setName("CODE_SIGN_ENTITLEMENTS")
              .setValue("$(WORKSPACE_ROOT)/" + entitlements.getExecPathString())
              .build());
    }

    return buildSettings.build();
  }