use of com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder in project bazel by bazelbuild.
the class Watch2ExtensionSupport method createBundle.
/**
* Registers actions to create a watchOS2 extension bundle and zip it into an {@code .ipa}.
*
* @param ipaArtifact an .ipa artifact containing to extension bundle; this is the output artifact
* of the bundling
*/
void createBundle(Artifact ipaArtifact, NestedSetBuilder<Artifact> extensionFilesToBuild, ObjcProvider.Builder exposedObjcProviderBuilder) throws InterruptedException {
ObjcProvider.Builder releaseBundlingObjcProviderBuilder = new ObjcProvider.Builder();
releaseBundlingObjcProviderBuilder.addTransitiveAndPropagate(attributes.binaryDependencies());
releaseBundlingObjcProviderBuilder.addAll(GENERAL_RESOURCE_FILE, attributes.resources()).addAll(GENERAL_RESOURCE_FILE, attributes.strings()).addAll(GENERAL_RESOURCE_DIR, ObjcCommon.xcodeStructuredResourceDirs(attributes.structuredResources())).addAll(BUNDLE_FILE, BundleableFile.flattenedRawResourceFiles(attributes.resources())).addAll(BUNDLE_FILE, BundleableFile.structuredRawResourceFiles(attributes.structuredResources())).addAll(STRINGS, attributes.strings());
ObjcProvider releaseBundlingObjcProvider = releaseBundlingObjcProviderBuilder.build();
ReleaseBundling.Builder releaseBundling = new ReleaseBundling.Builder().setIpaArtifact(ipaArtifact).setBundleId(attributes.bundleId()).setProvisioningProfile(attributes.provisioningProfile()).setProvisioningProfileAttributeName(WATCH_EXT_PROVISIONING_PROFILE_ATTR).setTargetDeviceFamilies(ImmutableSet.of(TargetDeviceFamily.WATCH)).setIntermediateArtifacts(intermediateArtifacts).setInfoPlistsFromRule(attributes.infoPlists()).setEntitlements(attributes.entitlements());
if (attributes.isBundleIdExplicitySpecified()) {
releaseBundling.setPrimaryBundleId(attributes.bundleId());
} else {
releaseBundling.setFallbackBundleId(attributes.bundleId());
}
AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
ReleaseBundlingSupport releaseBundlingSupport = new ReleaseBundlingSupport(ruleContext, releaseBundlingObjcProvider, LinkedBinary.DEPENDENCIES_ONLY, ReleaseBundlingSupport.EXTENSION_BUNDLE_DIR_FORMAT, bundleName, appleConfiguration.getMinimumOsForPlatformType(PlatformType.WATCHOS), releaseBundling.build(), appleConfiguration.getMultiArchPlatform(PlatformType.WATCHOS));
releaseBundlingSupport.registerActions(DsymOutputType.APP).addFilesToBuild(extensionFilesToBuild, Optional.of(DsymOutputType.APP)).validateResources().validateAttributes().addExportedDebugArtifacts(exposedObjcProviderBuilder, DsymOutputType.APP);
}
use of com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder in project bazel by bazelbuild.
the class WatchApplicationSupport method createBundle.
private void createBundle(Optional<XcodeProvider.Builder> xcodeProviderBuilder, ObjcProvider depsObjcProvider, NestedSetBuilder<Artifact> filesToBuild) throws InterruptedException {
registerActions();
ReleaseBundling.Builder releaseBundling = new ReleaseBundling.Builder().setIpaArtifact(ipaArtifact).setBundleId(attributes.bundleId()).setAppIcon(attributes.appIcon()).setProvisioningProfile(attributes.provisioningProfile()).setProvisioningProfileAttributeName(WATCH_APP_PROVISIONING_PROFILE_ATTR).setTargetDeviceFamilies(families()).setIntermediateArtifacts(intermediateArtifacts).setInfoPlistsFromRule(attributes.infoPlists()).setArtifactPrefix(artifactPrefix).setEntitlements(attributes.entitlements());
if (attributes.isBundleIdExplicitySpecified()) {
releaseBundling.setPrimaryBundleId(attributes.bundleId());
} else {
releaseBundling.setFallbackBundleId(attributes.bundleId());
}
AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
PlatformType appPlatformType = watchOSVersion == WatchOSVersion.OS1 ? PlatformType.IOS : PlatformType.WATCHOS;
DottedVersion minimumOsVersion = appPlatformType == PlatformType.IOS ? WatchUtils.determineMinimumIosVersion(appleConfiguration.getMinimumOsForPlatformType(PlatformType.IOS)) : appleConfiguration.getMinimumOsForPlatformType(PlatformType.WATCHOS);
ReleaseBundlingSupport releaseBundlingSupport = new ReleaseBundlingSupport(ruleContext, depsObjcProvider, LinkedBinary.DEPENDENCIES_ONLY, watchOSVersion.getApplicationBundleDirFormat(), bundleName, minimumOsVersion, releaseBundling.build(), appleConfiguration.getMultiArchPlatform(appPlatformType)).registerActions(DsymOutputType.APP);
if (xcodeProviderBuilder.isPresent()) {
releaseBundlingSupport.addXcodeSettings(xcodeProviderBuilder.get());
}
releaseBundlingSupport.addFilesToBuild(filesToBuild, Optional.<DsymOutputType>absent()).validateResources().validateAttributes();
}
use of com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder in project bazel by bazelbuild.
the class BuildView method getDirectPrerequisiteDependenciesForTesting.
@VisibleForTesting
public OrderedSetMultimap<Attribute, Dependency> getDirectPrerequisiteDependenciesForTesting(final ExtendedEventHandler eventHandler, final ConfiguredTarget ct, BuildConfigurationCollection configurations) throws EvalException, InvalidConfigurationException, InterruptedException, InconsistentAspectOrderException {
if (!(ct.getTarget() instanceof Rule)) {
return OrderedSetMultimap.create();
}
class SilentDependencyResolver extends DependencyResolver {
@Override
protected void invalidVisibilityReferenceHook(TargetAndConfiguration node, Label label) {
throw new RuntimeException("bad visibility on " + label + " during testing unexpected");
}
@Override
protected void invalidPackageGroupReferenceHook(TargetAndConfiguration node, Label label) {
throw new RuntimeException("bad package group on " + label + " during testing unexpected");
}
@Override
protected void missingEdgeHook(Target from, Label to, NoSuchThingException e) {
throw new RuntimeException("missing dependency from " + from.getLabel() + " to " + to + ": " + e.getMessage(), e);
}
@Override
protected Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses) throws InterruptedException {
try {
return skyframeExecutor.getPackageManager().getTarget(eventHandler, label);
} catch (NoSuchThingException e) {
throw new IllegalStateException(e);
}
}
@Override
protected List<BuildConfiguration> getConfigurations(Set<Class<? extends BuildConfiguration.Fragment>> fragments, Iterable<BuildOptions> buildOptions) {
Preconditions.checkArgument(ct.getConfiguration().fragmentClasses().equals(fragments));
Dependency asDep = Dependency.withTransitionAndAspects(ct.getLabel(), Attribute.ConfigurationTransition.NONE, AspectCollection.EMPTY);
ImmutableList.Builder<BuildConfiguration> builder = ImmutableList.builder();
for (BuildOptions options : buildOptions) {
builder.add(Iterables.getOnlyElement(skyframeExecutor.getConfigurations(eventHandler, options, ImmutableList.<Dependency>of(asDep)).values()));
}
return builder.build();
}
}
DependencyResolver dependencyResolver = new SilentDependencyResolver();
TargetAndConfiguration ctgNode = new TargetAndConfiguration(ct.getTarget(), ct.getConfiguration());
return dependencyResolver.dependentNodeMap(ctgNode, configurations.getHostConfiguration(), /*aspect=*/
null, getConfigurableAttributeKeysForTesting(eventHandler, ctgNode));
}
Aggregations