private PathFragment getWorkspaceRelativeOutputDir() { // Generate sources in a package-and-rule-scoped directory; adds both the // package-and-rule-scoped directory and the header-containing-directory to the include path // of dependers. PathFragment rootRelativeOutputDir = ruleContext.getUniqueDirectory(UNIQUE_DIRECTORY_NAME); return new PathFragment( ruleContext.getBinOrGenfilesDirectory().getExecPath(), rootRelativeOutputDir); }
/** * Returns a derived artifact in the bin directory obtained by appending some extension to the * main label name; the result artifact is placed in a unique "entitlements" directory. For * example, if this artifact is for a target Foo with extension ".extension", the result artifact * will be located at {target_base_path}/entitlements/Foo.extension. */ public Artifact appendExtensionForEntitlementArtifact(String extension) { PathFragment entitlementsDirectory = ruleContext.getUniqueDirectory("entitlements"); Artifact artifact = ruleContext.getDerivedArtifact( entitlementsDirectory.replaceName( addOutputPrefix(entitlementsDirectory.getBaseName(), extension)), buildConfiguration.getBinDirectory(ruleContext.getRule().getRepository())); return artifact; }
/** * Returns the location of this target's extension plist which contains entries required by all * watch extensions (for final merging into the bundle plist). */ public Artifact watchExtensionAutomaticPlist() { return ruleContext.getRelatedArtifact( ruleContext.getUniqueDirectory("plists"), "-automatic-watchExtensionInfo.plist"); }
private ResourceApk createApk( Artifact resourceApk, RuleContext ruleContext, NestedSet<ResourceContainer> resourceContainers, Artifact rTxt, Artifact symbolsTxt, List<String> configurationFilters, List<String> uncompressedExtensions, List<String> densities, String applicationId, String versionCode, String versionName, boolean incremental, LocalResourceContainer data, Artifact proguardCfg) { ResourceContainer resourceContainer = checkForInlinedResources( new AndroidResourceContainerBuilder() .withData(data) .withManifest(getManifest()) .withROutput(rTxt) .withSymbolsFile(symbolsTxt) .buildFromRule(ruleContext, resourceApk), resourceContainers, ruleContext); AndroidResourcesProcessorBuilder builder = new AndroidResourcesProcessorBuilder(ruleContext) .setApkOut(resourceContainer.getApk()) .setConfigurationFilters(configurationFilters) .setUncompressedExtensions(uncompressedExtensions) .setJavaPackage(resourceContainer.getJavaPackage()) .setDebug(ruleContext.getConfiguration().getCompilationMode() != CompilationMode.OPT) .withPrimary(resourceContainer) .withDependencies(resourceContainers) .setWorkingDirectory(ruleContext.getUniqueDirectory("_resources")) .setDensities(densities) .setProguardOut(proguardCfg) .setApplicationId(applicationId) .setVersionCode(versionCode) .setVersionName(versionName); if (!incremental) { builder .setRTxtOut(resourceContainer.getRTxt()) .setSymbolsTxt(resourceContainer.getSymbolsTxt()) .setSourceJarOut(resourceContainer.getJavaSourceJar()); } ResourceContainer processed = builder.build(ruleContext); NestedSet<ResourceContainer> transitiveResources = NestedSetBuilder.<ResourceContainer>naiveLinkOrder() // TODO(bazel-team): If this is replaced with .addTransitive(), a few tests fail. // Investigate. .addAll(resourceContainers) .add(processed) .build(); return new ResourceApk( resourceApk, processed.getJavaSourceJar(), transitiveResources, processed, manifest, proguardCfg, false); }
private Artifact getGeneratedEnvironmentPlist() { return ruleContext.getRelatedArtifact( ruleContext.getUniqueDirectory("plists"), "-environment.plist"); }
private Artifact getGeneratedVersionPlist() { return ruleContext.getRelatedArtifact( ruleContext.getUniqueDirectory("plists"), "-version.plist"); }
private Artifact getGeneratedAutomaticPlist() { return ruleContext.getRelatedArtifact( ruleContext.getUniqueDirectory("plists"), "-automatic.plist"); }
private Artifact getLaunchStoryboardPlist() { return ruleContext.getRelatedArtifact( ruleContext.getUniqueDirectory("plists"), "-launchstoryboard.plist"); }