MCPcopy Create free account
hub / github.com/nodejs/node / WriteCopies

Method WriteCopies

tools/gyp/pylib/gyp/generator/android.py:458–498  ·  view source on GitHub ↗

Write Makefile code for any 'copies' from the gyp input. extra_outputs: a list that will be filled in with any outputs of this action (used to make other pieces dependent on this action)

(self, copies, extra_outputs)

Source from the content-addressed store, hash-verified

456 self.WriteLn()
457
458 def WriteCopies(self, copies, extra_outputs):
459 """Write Makefile code for any 'copies' from the gyp input.
460
461 extra_outputs: a list that will be filled in with any outputs of this action
462 (used to make other pieces dependent on this action)
463 """
464 self.WriteLn("### Generated for copy rule.")
465
466 variable = make.StringToMakefileVariable(self.relative_target + "_copies")
467 outputs = []
468 for copy in copies:
469 for path in copy["files"]:
470 # The Android build system does not allow generation of files into the
471 # source tree. The destination should start with a variable, which will
472 # typically be $(gyp_intermediate_dir) or
473 # $(gyp_shared_intermediate_dir). Note that we can't use an assertion
474 # because some of the gyp tests depend on this.
475 if not copy["destination"].startswith("$"):
476 print(
477 "WARNING: Copy rule for target %s writes output to "
478 "local path %s" % (self.target, copy["destination"])
479 )
480
481 # LocalPathify() calls normpath, stripping trailing slashes.
482 path = Sourceify(self.LocalPathify(path))
483 filename = os.path.split(path)[1]
484 output = Sourceify(
485 self.LocalPathify(os.path.join(copy["destination"], filename))
486 )
487
488 self.WriteLn(f"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)")
489 self.WriteLn("\t@echo Copying: $@")
490 self.WriteLn("\t$(hide) mkdir -p $(dir $@)")
491 self.WriteLn("\t$(hide) $(ACP) -rpf $< $@")
492 self.WriteLn()
493 outputs.append(output)
494 self.WriteLn(
495 "{} = {}".format(variable, " ".join(map(make.QuoteSpaces, outputs)))
496 )
497 extra_outputs.append("$(%s)" % variable)
498 self.WriteLn()
499
500 def WriteSourceFlags(self, spec, configs):
501 """Write out the flags and include paths used to compile source files for

Callers 1

WriteMethod · 0.95

Calls 9

WriteLnMethod · 0.95
LocalPathifyMethod · 0.95
SourceifyFunction · 0.70
formatMethod · 0.65
printFunction · 0.50
mapFunction · 0.50
splitMethod · 0.45
joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected