You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Build or bring up-to-date any executable host-side tools on which this plugin depends. Add them and any binary dependencies to the tool-names-to-path map.
163
163
vartoolNamesToPaths:[String:AbsolutePath]=[:]
164
+
// Add supported triples info per tool so they can be looked up when running the tool
// Infer plugins from the declared dependencies, and collect them as well as any regular dependencies. Although usage of build tool plugins is declared separately from dependencies in the manifest, in the internal model we currently consider both to be dependencies.
326
328
varpluginTargets:[PluginTarget]=[]
@@ -360,14 +362,22 @@ extension PackageGraph {
360
362
switch tool {
361
363
case.builtTool(let name,let path):
362
364
dict[name]= builtToolsDir.appending(path)
363
-
case.vendedTool(let name,let path):
365
+
case.vendedTool(let name,let path, _):
364
366
dict[name]= path
365
367
}
366
368
})
367
369
368
370
// Determine additional input dependencies for any plugin commands, based on any executables the plugin target depends on.
369
371
lettoolPaths= toolNamesToPaths.values.sorted()
370
372
373
+
lettoolNamesToTriples= accessibleTools.reduce(into:[String:[String]](),{ dict, tool in
374
+
switch tool {
375
+
case.vendedTool(let name, _,let triple):
376
+
dict[name]= triple
377
+
default:break
378
+
}
379
+
})
380
+
371
381
// Assign a plugin working directory based on the package, target, and plugin.
// executable must exist before running prebuild command
432
442
if !fileSystem.exists(executable){
433
-
diagnostics.append(.error("exectuable target '\(executable.basename)' is not pre-built; a plugin running a prebuild command should only rely on an existing binary; as a workaround, build '\(executable.basename)' first and then run the plugin "))
443
+
diagnostics.append(.error("executable target '\(executable.basename)' is not pre-built; a plugin running a prebuild command should only rely on an existing binary; as a workaround, build '\(executable.basename)' first and then run the plugin "))
434
444
return
435
445
}
436
446
prebuildCommands.append(.init(
@@ -455,6 +465,7 @@ extension PackageGraph {
455
465
outputDirectory: pluginOutputDir,
456
466
toolSearchDirectories: toolSearchDirectories,
457
467
toolNamesToPaths: toolNamesToPaths,
468
+
toolNamesToTriples: toolNamesToTriples,
458
469
writableDirectories: writableDirectories,
459
470
readOnlyDirectories: readOnlyDirectories,
460
471
fileSystem: fileSystem,
@@ -492,7 +503,7 @@ public enum PluginAccessibleTool: Hashable {
492
503
case builtTool(name:String, path:RelativePath)
493
504
494
505
/// A tool that is vended by a BinaryTarget (the path is absolute and refers to an unpackaged binary target).
495
-
case vendedTool(name:String, path:AbsolutePath)
506
+
case vendedTool(name:String, path:AbsolutePath, supportedTriples:[String])
496
507
}
497
508
498
509
publicextensionPluginTarget{
@@ -522,7 +533,7 @@ public extension PluginTarget {
0 commit comments