@Override public <A extends Arg> AppleBundle createBuildRule( TargetGraph targetGraph, BuildRuleParams params, BuildRuleResolver resolver, A args) { AppleCxxPlatform appleCxxPlatform = getAppleCxxPlatformForBuildTarget(params.getBuildTarget()); AppleBundleDestinations destinations = AppleBundleDestinations.platformDestinations( appleCxxPlatform.getAppleSdk().getApplePlatform()); ImmutableSet.Builder<SourcePath> bundleDirsBuilder = ImmutableSet.builder(); ImmutableSet.Builder<SourcePath> dirsContainingResourceDirsBuilder = ImmutableSet.builder(); ImmutableSet.Builder<SourcePath> bundleFilesBuilder = ImmutableSet.builder(); ImmutableSet.Builder<SourcePath> bundleVariantFilesBuilder = ImmutableSet.builder(); AppleResources.collectResourceDirsAndFiles( targetGraph, Preconditions.checkNotNull(targetGraph.get(params.getBuildTarget())), bundleDirsBuilder, dirsContainingResourceDirsBuilder, bundleFilesBuilder, bundleVariantFilesBuilder); ImmutableSet<SourcePath> bundleDirs = bundleDirsBuilder.build(); ImmutableSet<SourcePath> dirsContainingResourceDirs = dirsContainingResourceDirsBuilder.build(); ImmutableSet<SourcePath> bundleFiles = bundleFilesBuilder.build(); ImmutableSet<SourcePath> bundleVariantFiles = bundleVariantFilesBuilder.build(); SourcePathResolver sourcePathResolver = new SourcePathResolver(resolver); Optional<AppleAssetCatalog> assetCatalog = AppleDescriptions.createBuildRuleForTransitiveAssetCatalogDependencies( targetGraph, params, sourcePathResolver, appleCxxPlatform.getAppleSdk().getApplePlatform(), appleCxxPlatform.getActool()); // TODO(user): Sort through the changes needed to make project generation work with // binary being optional. BuildRule flavoredBinaryRule = getFlavoredBinaryRule(targetGraph, params, resolver, args); BuildRuleParams bundleParamsWithFlavoredBinaryDep = getBundleParamsWithUpdatedDeps( params, args.binary, ImmutableSet.<BuildRule>builder() .add(flavoredBinaryRule) .addAll(assetCatalog.asSet()) .addAll( BuildRules.toBuildRulesFor( params.getBuildTarget(), resolver, SourcePaths.filterBuildTargetSourcePaths( Iterables.concat( bundleFiles, bundleDirs, dirsContainingResourceDirs, bundleVariantFiles)))) .build()); ImmutableMap<SourcePath, String> extensionBundlePaths = collectFirstLevelAppleDependencyBundles(params.getDeps(), destinations); return new AppleBundle( bundleParamsWithFlavoredBinaryDep, sourcePathResolver, args.extension, args.productName, args.infoPlist, args.infoPlistSubstitutions.get(), Optional.of(flavoredBinaryRule), destinations, bundleDirs, bundleFiles, dirsContainingResourceDirs, extensionBundlePaths, Optional.of(bundleVariantFiles), appleCxxPlatform.getIbtool(), appleCxxPlatform.getDsymutil(), appleCxxPlatform.getCxxPlatform().getStrip(), assetCatalog, args.getTests(), appleCxxPlatform.getAppleSdk(), codeSignIdentityStore, provisioningProfileStore, AppleBundle.DebugInfoFormat.DSYM); }