Lines Matching refs:r
98 func (r *RuleBuilder) MissingDeps(missingDeps []string) {
99 r.missingDeps = append(r.missingDeps, missingDeps...)
105 func (r *RuleBuilder) Restat() *RuleBuilder {
106 if r.sbox {
109 r.restat = true
110 return r
115 func (r *RuleBuilder) HighMem() *RuleBuilder {
116 r.highmem = true
117 return r
121 func (r *RuleBuilder) Remoteable(supports RemoteRuleSupports) *RuleBuilder {
122 r.remoteable = supports
123 return r
130 func (r *RuleBuilder) Rewrapper(params *remoteexec.REParams) *RuleBuilder {
131 if !r.sboxInputs {
134 r.rbeParams = params
135 return r
145 func (r *RuleBuilder) Sbox(outputDir WritablePath, manifestPath WritablePath) *RuleBuilder {
146 if r.sbox {
149 if len(r.commands) > 0 {
152 if r.restat {
155 r.sbox = true
156 r.outDir = outputDir
157 r.sboxManifestPath = manifestPath
158 return r
163 func (r *RuleBuilder) SandboxTools() *RuleBuilder {
164 if !r.sbox {
167 if len(r.commands) > 0 {
170 r.sboxTools = true
171 return r
181 func (r *RuleBuilder) SandboxInputs() *RuleBuilder {
182 if !r.sbox {
185 if len(r.commands) > 0 {
188 r.sboxTools = true
189 r.sboxInputs = true
190 return r
195 func (r *RuleBuilder) Install(from Path, to string) {
196 r.installs = append(r.installs, RuleBuilderInstall{from, to})
202 func (r *RuleBuilder) Command() *RuleBuilderCommand {
204 rule: r,
206 r.commands = append(r.commands, command)
212 func (r *RuleBuilder) Temporary(path WritablePath) {
213 r.temporariesSet[path] = true
218 func (r *RuleBuilder) DeleteTemporaryFiles() {
221 for intermediate := range r.temporariesSet {
229 r.Command().Text("rm").Flag("-f").Outputs(temporariesList)
236 func (r *RuleBuilder) Inputs() Paths {
237 outputs := r.outputSet()
238 depFiles := r.depFileSet()
241 for _, c := range r.commands {
266 func (r *RuleBuilder) OrderOnlys() Paths {
268 for _, c := range r.commands {
288 func (r *RuleBuilder) Validations() Paths {
290 for _, c := range r.commands {
308 func (r *RuleBuilder) outputSet() map[string]WritablePath {
310 for _, c := range r.commands {
321 func (r *RuleBuilder) Outputs() WritablePaths {
322 outputs := r.outputSet()
326 if !r.temporariesSet[output] {
338 func (r *RuleBuilder) symlinkOutputSet() map[string]WritablePath {
340 for _, c := range r.commands {
358 func (r *RuleBuilder) SymlinkOutputs() WritablePaths {
359 symlinkOutputs := r.symlinkOutputSet()
373 func (r *RuleBuilder) depFileSet() map[string]WritablePath {
375 for _, c := range r.commands {
385 func (r *RuleBuilder) DepFiles() WritablePaths {
388 for _, c := range r.commands {
398 func (r *RuleBuilder) Installs() RuleBuilderInstalls {
399 return append(RuleBuilderInstalls(nil), r.installs...)
402 func (r *RuleBuilder) toolsSet() map[string]Path {
404 for _, c := range r.commands {
415 func (r *RuleBuilder) Tools() Paths {
416 toolsSet := r.toolsSet()
431 func (r *RuleBuilder) RspFileInputs() Paths {
433 for _, c := range r.commands {
442 func (r *RuleBuilder) rspFiles() []rspFileAndPaths {
444 for _, c := range r.commands {
452 func (r *RuleBuilder) Commands() []string {
454 for _, c := range r.commands {
470 func (r *RuleBuilder) depFileMergerCmd(depFiles WritablePaths) *RuleBuilderCommand {
471 return r.Command().
478 func (r *RuleBuilder) Build(name string, desc string) {
481 if len(r.missingDeps) > 0 {
482 r.ctx.Build(pctx, BuildParams{
484 Outputs: r.Outputs(),
487 "error": "missing dependencies: " + strings.Join(r.missingDeps, ", "),
495 if depFiles := r.DepFiles(); len(depFiles) > 0 {
500 r.depFileMergerCmd(depFiles)
502 if r.sbox {
506 Rel(r.ctx, r.outDir.String(), path.String())
512 tools := r.Tools()
513 commands := r.Commands()
514 outputs := r.Outputs()
515 inputs := r.Inputs()
516 rspFiles := r.rspFiles()
527 if r.sbox {
541 if r.sboxTools {
545 To: proto.String(sboxPathForToolRel(r.ctx, tool)),
548 for _, c := range r.commands {
562 if r.sboxInputs {
566 To: proto.String(r.sboxPathForInputRel(input)),
578 From: proto.String(r.outDir.String()),
582 From: proto.String(PathForOutput(r.ctx).String()),
596 rel := Rel(r.ctx, r.outDir.String(), output.String())
606 for path := range r.temporariesSet {
607 Rel(r.ctx, r.outDir.String(), path.String())
617 _, manifestInOutDir := MaybeRel(r.ctx, r.outDir.String(), r.sboxManifestPath.String())
619 ReportPathErrorf(r.ctx, "sbox rule %q manifestPath %q must not be in outputDir %q",
620 name, r.sboxManifestPath.String(), r.outDir.String())
624 WriteFileRule(r.ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
631 ctx: r.ctx,
634 sboxCmd.Text("rm -rf").Output(r.outDir)
637 Flag("--sandbox-path").Text(shared.TempDirForOutDir(PathForOutput(r.ctx).String())).
638 Flag("--manifest").Input(r.sboxManifestPath)
646 if r.rbeParams != nil {
662 inputsListFile := r.sboxManifestPath.ReplaceExtension(r.ctx, "rbe_inputs.list")
663 writeRspFileRule(r.ctx, inputsListFile, remoteInputs)
669 r.rbeParams.OutputFiles = outputs.Strings()
670 r.rbeParams.RSPFiles = remoteRspFiles.Strings()
671 rewrapperCommand := r.rbeParams.NoVarTemplate(r.ctx.Config().RBEWrapper())
700 writeRspFileRule(r.ctx, rspFile.file, rspFile.paths)
709 if r.ctx.Config().UseGoma() && r.remoteable.Goma {
711 } else if r.ctx.Config().UseRBE() && r.remoteable.RBE {
714 } else if r.highmem {
716 } else if r.ctx.Config().UseRemoteBuild() {
720 r.ctx.Build(r.pctx, BuildParams{
721 Rule: r.ctx.Rule(pctx, name, blueprint.RuleParams{
724 Restat: r.restat,
731 OrderOnly: r.OrderOnlys(),
732 Validations: r.Validations(),
735 SymlinkOutputs: r.SymlinkOutputs(),
831 func (r *RuleBuilder) _sboxPathForInputRel(path Path) (rel string, inSandbox bool) {
833 rel, isRelSboxOut, _ := maybeRelErr(r.outDir.String(), path.String())
837 if r.sboxInputs {
841 rel, isRelOut, _ := maybeRelErr(PathForOutput(r.ctx).String(), path.String())
849 func (r *RuleBuilder) sboxPathForInputRel(path Path) string {
850 rel, _ := r._sboxPathForInputRel(path)
854 func (r *RuleBuilder) sboxPathsForInputsRel(paths Paths) []string {
857 ret[i] = r.sboxPathForInputRel(path)