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(
9
9
name: " MyLocalTool " ,
10
10
plugins: [
11
11
" MySourceGenBuildToolPlugin " ,
12
+ " MyAmbiguouslyNamedCommandPlugin " ,
12
13
]
13
14
) ,
14
15
// The plugin that generates build tool commands to invoke MySourceGenBuildTool.
@@ -23,5 +24,13 @@ let package = Package(
23
24
. executableTarget(
24
25
name: " MySourceGenBuildTool "
25
26
) ,
27
+ // Plugin that emits commands with a generic name.
28
+ . plugin(
29
+ name: " MyAmbiguouslyNamedCommandPlugin " ,
30
+ capability: . buildTool( ) ,
31
+ dependencies: [
32
+ " MySourceGenBuildTool " ,
33
+ ]
34
+ ) ,
26
35
]
27
36
)
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 {
584
584
585
585
// Add any regular build commands created by plugins for the target (prebuild commands are handled separately).
586
586
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 .
588
588
let execPath = AbsolutePath ( command. configuration. executable, relativeTo: buildParameters. buildPath)
589
+ let uniquedName = ( [ execPath. pathString] + command. configuration. arguments) . joined ( separator: " | " )
589
590
manifest. addShellCmd (
590
- name: command. configuration. displayName,
591
+ name: command. configuration. displayName + " - " + ByteString ( encodingAsUTF8 : uniquedName ) . sha256Checksum ,
591
592
description: command. configuration. displayName,
592
593
inputs: [ . file( execPath) ] + command. inputFiles. map { . file( $0) } ,
593
594
outputs: command. outputFiles. map { . file( $0) } ,
You can’t perform that action at this time.
0 commit comments