private Artifact scopedArtifact(PathFragment scopeRelative, boolean inGenfiles) { Root root = inGenfiles ? buildConfiguration.getGenfilesDirectory(ruleContext.getRule().getRepository()) : buildConfiguration.getBinDirectory(ruleContext.getRule().getRepository()); // The path of this artifact will be RULE_PACKAGE/SCOPERELATIVE return ruleContext.getPackageRelativeArtifact(scopeRelative, root); }
/** * 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; }
public CppCompileActionBuilder setDotdFile(PathFragment outputName, String extension) { if (CppFileTypes.mustProduceDotdFile(outputName.toString())) { if (configuration.getFragment(CppConfiguration.class).getInmemoryDotdFiles()) { // Just set the path, no artifact is constructed PathFragment file = FileSystemUtils.replaceExtension(outputName, extension); Root root = configuration.getBinDirectory(); dotdFile = new DotdFile(root.getExecPath().getRelative(file)); } else { dotdFile = new DotdFile(ruleContext.getRelatedArtifact(outputName, extension)); } } else { dotdFile = null; } return this; }