File tree Expand file tree Collapse file tree 4 files changed +39
-2
lines changed
Fixtures/Miscellaneous/Plugins/ContrivedTestPlugin
Plugins/MyAmbiguouslyNamedCommandPlugin Expand file tree Collapse file tree 4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ let package = Package(
99 name: " MyLocalTool " ,
1010 plugins: [
1111 " MySourceGenBuildToolPlugin " ,
12+ " MyAmbiguouslyNamedCommandPlugin " ,
1213 ]
1314 ) ,
1415 // The plugin that generates build tool commands to invoke MySourceGenBuildTool.
@@ -23,5 +24,13 @@ let package = Package(
2324 . executableTarget(
2425 name: " MySourceGenBuildTool "
2526 ) ,
27+ // Plugin that emits commands with a generic name.
28+ . plugin(
29+ name: " MyAmbiguouslyNamedCommandPlugin " ,
30+ capability: . buildTool( ) ,
31+ dependencies: [
32+ " MySourceGenBuildTool " ,
33+ ]
34+ ) ,
2635 ]
2736)
Original file line number Diff line number Diff line change 1+ import PackagePlugin
2+
3+ for inputFile in targetBuildContext. inputFiles. filter ( { $0. path. extension == " dat " } ) {
4+ let inputPath = inputFile. path
5+ let outputName = " Ambiguous_ " + inputPath. stem + " .swift "
6+ let outputPath = targetBuildContext. pluginWorkDirectory. appending ( outputName)
7+ commandConstructor. addBuildCommand (
8+ displayName:
9+ " This is a constant name " ,
10+ executable:
11+ try targetBuildContext. tool ( named: " MySourceGenBuildTool " ) . path,
12+ arguments: [
13+ " \( inputPath) " ,
14+ " \( outputPath) "
15+ ] ,
16+ environment: [
17+ " VARIABLE_NAME_PREFIX " : " SECOND_PREFIX_ "
18+ ] ,
19+ inputFiles: [
20+ inputPath,
21+ ] ,
22+ outputFiles: [
23+ outputPath
24+ ]
25+ )
26+ }
Original file line number Diff line number Diff line change 1+ I am Bar!
Original file line number Diff line number Diff line change @@ -584,10 +584,11 @@ extension LLBuildManifestBuilder {
584584
585585 // Add any regular build commands created by plugins for the target (prebuild commands are handled separately).
586586 for command in target. pluginInvocationResults. reduce ( [ ] , { $0 + $1. buildCommands } ) {
587- // Create a shell command to invoke the executable. We include the path of the executable as a dependency.
587+ // Create a shell command to invoke the executable. We include the path of the executable as a dependency, and make sure the name is unique .
588588 let execPath = AbsolutePath ( command. configuration. executable, relativeTo: buildParameters. buildPath)
589+ let uniquedName = ( [ execPath. pathString] + command. configuration. arguments) . joined ( separator: " | " )
589590 manifest. addShellCmd (
590- name: command. configuration. displayName,
591+ name: command. configuration. displayName + " - " + ByteString ( encodingAsUTF8 : uniquedName ) . sha256Checksum ,
591592 description: command. configuration. displayName,
592593 inputs: [ . file( execPath) ] + command. inputFiles. map { . file( $0) } ,
593594 outputs: command. outputFiles. map { . file( $0) } ,
You can’t perform that action at this time.
0 commit comments