Java Examples for com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.TargetControl

The following java examples will help you to understand the usage of com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.TargetControl. These source code samples are taken from different open source projects.

Example 1
Project: bazel-master  File: XcodeprojGeneration.java View source code
/**
   * Detects the product type of the given target based on multiple fields in {@code targetControl}.
   * {@code productType} is set as a field on {@code PBXNativeTarget} objects in Xcode project
   * files, and we support three values: {@link ProductType#APPLICATION},
   * {@link ProductType#STATIC_LIBRARY}, and {@link ProductType#BUNDLE}. The product type is not
   * only what xcodegen sets the {@code productType} field to - it also dictates what can be built
   * with this target (e.g. a library cannot be built with resources), what build phase it should be
   * added to of its dependers, and the name and shape of its build output.
   */
public static ProductType productType(TargetControl targetControl) {
    if (targetControl.hasProductType()) {
        for (ProductType supportedType : SUPPORTED_PRODUCT_TYPES) {
            if (targetControl.getProductType().equals(supportedType.identifier)) {
                return supportedType;
            }
        }
        throw new IllegalArgumentException("Unsupported product type: " + targetControl.getProductType());
    }
    return targetControl.hasInfoplist() ? ProductType.APPLICATION : ProductType.STATIC_LIBRARY;
}
Example 2
Project: test-master  File: XcodeprojGeneration.java View source code
/**
   * Detects the product type of the given target based on multiple fields in {@code targetControl}.
   * {@code productType} is set as a field on {@code PBXNativeTarget} objects in Xcode project
   * files, and we support three values: {@link ProductType#APPLICATION},
   * {@link ProductType#STATIC_LIBRARY}, and {@link ProductType#BUNDLE}. The product type is not
   * only what xcodegen sets the {@code productType} field to - it also dictates what can be built
   * with this target (e.g. a library cannot be built with resources), what build phase it should be
   * added to of its dependers, and the name and shape of its build output.
   */
public static ProductType productType(TargetControl targetControl) {
    if (targetControl.hasProductType()) {
        for (ProductType supportedType : SUPPORTED_PRODUCT_TYPES) {
            if (targetControl.getProductType().equals(supportedType.identifier)) {
                return supportedType;
            }
        }
        throw new IllegalArgumentException("Unsupported product type: " + targetControl.getProductType());
    }
    return targetControl.hasInfoplist() ? ProductType.APPLICATION : ProductType.STATIC_LIBRARY;
}
Example 3
Project: Correct-master  File: XcodeprojGeneration.java View source code
/**
   * Detects the product type of the given target based on multiple fields in {@code targetControl}.
   * {@code productType} is set as a field on {@code PBXNativeTarget} objects in Xcode project
   * files, and we support three values: {@link ProductType#APPLICATION},
   * {@link ProductType#STATIC_LIBRARY}, and {@link ProductType#BUNDLE}. The product type is not
   * only what xcodegen sets the {@code productType} field to - it also dictates what can be built
   * with this target (e.g. a library cannot be built with resources), what build phase it should be
   * added to of its dependers, and the name and shape of its build output.
   */
public static ProductType productType(TargetControl targetControl) {
    if (targetControl.hasProductType()) {
        for (ProductType supportedType : SUPPORTED_PRODUCT_TYPES) {
            if (targetControl.getProductType().equals(supportedType.identifier)) {
                return supportedType;
            }
        }
        throw new IllegalArgumentException("Unsupported product type: " + targetControl.getProductType());
    }
    return targetControl.hasInfoplist() ? ProductType.APPLICATION : ProductType.STATIC_LIBRARY;
}