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

Class MSBuildRule

tools/gyp/pylib/gyp/generator/msvs.py:2369–2425  ·  view source on GitHub ↗

Used to store information used to generate an MSBuild rule. Attributes: rule_name: The rule name, sanitized to use in XML. target_name: The name of the target. after_targets: The name of the AfterTargets element. before_targets: The name of the BeforeTargets element.

Source from the content-addressed store, hash-verified

2367
2368
2369class MSBuildRule:
2370 """Used to store information used to generate an MSBuild rule.
2371
2372 Attributes:
2373 rule_name: The rule name, sanitized to use in XML.
2374 target_name: The name of the target.
2375 after_targets: The name of the AfterTargets element.
2376 before_targets: The name of the BeforeTargets element.
2377 depends_on: The name of the DependsOn element.
2378 compute_output: The name of the ComputeOutput element.
2379 dirs_to_make: The name of the DirsToMake element.
2380 inputs: The name of the _inputs element.
2381 tlog: The name of the _tlog element.
2382 extension: The extension this rule applies to.
2383 description: The message displayed when this rule is invoked.
2384 additional_dependencies: A string listing additional dependencies.
2385 outputs: The outputs of this rule.
2386 command: The command used to run the rule.
2387 """
2388
2389 def __init__(self, rule, spec):
2390 self.display_name = rule["rule_name"]
2391 # Assure that the rule name is only characters and numbers
2392 self.rule_name = re.sub(r"\W", "_", self.display_name)
2393 # Create the various element names, following the example set by the
2394 # Visual Studio 2008 to 2010 conversion. I don't know if VS2010
2395 # is sensitive to the exact names.
2396 self.target_name = "_" + self.rule_name
2397 self.after_targets = self.rule_name + "AfterTargets"
2398 self.before_targets = self.rule_name + "BeforeTargets"
2399 self.depends_on = self.rule_name + "DependsOn"
2400 self.compute_output = "Compute%sOutput" % self.rule_name
2401 self.dirs_to_make = self.rule_name + "DirsToMake"
2402 self.inputs = self.rule_name + "_inputs"
2403 self.tlog = self.rule_name + "_tlog"
2404 self.extension = rule["extension"]
2405 if not self.extension.startswith("."):
2406 self.extension = "." + self.extension
2407
2408 self.description = MSVSSettings.ConvertVCMacrosToMSBuild(
2409 rule.get("message", self.rule_name)
2410 )
2411 old_additional_dependencies = _FixPaths(rule.get("inputs", []))
2412 self.additional_dependencies = ";".join(
2413 [
2414 MSVSSettings.ConvertVCMacrosToMSBuild(i)
2415 for i in old_additional_dependencies
2416 ]
2417 )
2418 old_outputs = _FixPaths(rule.get("outputs", []))
2419 self.outputs = ";".join(
2420 [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in old_outputs]
2421 )
2422 old_command = _BuildCommandLineForRule(
2423 spec, rule, has_input_path=True, do_setup_env=True
2424 )
2425 self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command)
2426

Callers 1

_GenerateRulesForMSBuildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected