private ExtraActoolArgs extraActoolArgs() { ImmutableList.Builder<String> extraArgs = ImmutableList.builder(); if (attributes.appIcon() != null) { extraArgs.add("--app-icon", attributes.appIcon()); } if (attributes.launchImage() != null) { extraArgs.add("--launch-image", attributes.launchImage()); } return new ExtraActoolArgs(extraArgs.build()); }
private ExtraActoolArgs extraActoolArgs() { ImmutableList.Builder<String> extraArgs = ImmutableList.builder(); if (attributes.appIcon() != null) { extraArgs.add("--app-icon", attributes.appIcon()); } if (attributes.launchImage() != null && !ObjcRuleClasses.useLaunchStoryboard(ruleContext)) { extraArgs.add("--launch-image", attributes.launchImage()); } return new ExtraActoolArgs(extraArgs.build()); }
/** * Validates application-related attributes set on this rule and registers any errors with the * rule context. * * @return this application support */ ReleaseBundlingSupport validateAttributes() { // No asset catalogs. That means you cannot specify app_icon or // launch_image attributes, since they must not exist. However, we don't // run actool in this case, which means it does not do validity checks, // and we MUST raise our own error somehow... if (!objcProvider.hasAssetCatalogs()) { if (attributes.appIcon() != null) { ruleContext.attributeError( "app_icon", String.format(NO_ASSET_CATALOG_ERROR_FORMAT, attributes.appIcon())); } if (attributes.launchImage() != null) { ruleContext.attributeError( "launch_image", String.format(NO_ASSET_CATALOG_ERROR_FORMAT, attributes.launchImage())); } } if (bundleSupport.targetDeviceFamilies().isEmpty()) { ruleContext.attributeError("families", INVALID_FAMILIES_ERROR); } return this; }
/** 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(); }