Skip to content

Commit

Permalink
getting closer
Browse files Browse the repository at this point in the history
  • Loading branch information
Full Queue Developer authored and Full Queue Developer committed Oct 8, 2023
1 parent 82fff7b commit eb320c3
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 881 deletions.
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
"revision" : "1c30064de9dceac00aa3fefc70a1431e425e5f28",
"version" : "1.3.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
}
],
"version" : 2
Expand Down
8 changes: 6 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/onevcat/Rainbow", from: "4.0.0"),
.package(url: "https://github.com/FullQueueDeveloper/Sh.git", from: "1.3.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0"),
// .package(path: "PluginsPackage"),
],
targets: [
Expand All @@ -39,7 +40,10 @@ let package = Package(
"GenerateTemplatesTool"
]
),
.executableTarget(name: "GenerateTemplatesTool",
dependencies: [])
.executableTarget(
name: "GenerateTemplatesTool",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
])
]
)
17 changes: 13 additions & 4 deletions Plugins/GenerateTemplatesPlugin/GenerateTemplatesPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@ import Foundation
struct GenerateTemplatesPlugin: BuildToolPlugin {
func createBuildCommands(context: PackagePlugin.PluginContext, target: PackagePlugin.Target) async throws -> [PackagePlugin.Command] {

// let spxlibTarget = try context.package.targets(named: ["SPXLib"]).first!
// let outputDir = context.pluginWorkDirectory.appending("GeneratedFiles")
let templatesDir = context.package.directory.appending(subpath: "templates")

let contents = try FileManager.default.contentsOfDirectory(atPath: templatesDir.string)

print(contents)

return [
.buildCommand(
displayName: "GenerateTemplatesPlugin",
executable: try context.tool(named: "GenerateTemplatesTool").path,
arguments: [
templatesDir.string,
context.pluginWorkDirectory.string
],
outputFiles: [context.pluginWorkDirectory.appending("/ttt.swift")]
inputFiles: contents.map { Path($0) },
outputFiles: [
context.pluginWorkDirectory.appending("Templates.swift"),
] + contents.map({ templateName in
Path("\(templateName)Template.swift")
})
),

]
}
}
21 changes: 0 additions & 21 deletions PluginsPackage/Package.swift

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions SPX/Package.resolved

This file was deleted.

22 changes: 0 additions & 22 deletions SPX/Package.swift

This file was deleted.

This file was deleted.

131 changes: 0 additions & 131 deletions SPX/Sources/generate-scaffold-code/GenerateMain.swift

This file was deleted.

0 comments on commit eb320c3

Please sign in to comment.