Basic parsing of package info on carton dev
This commit is contained in:
parent
e815da98c1
commit
ad6e5512dd
|
@ -0,0 +1 @@
|
|||
5.2.4
|
|
@ -47,12 +47,12 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"package": "SKQueue",
|
||||
"repositoryURL": "https://github.com/MaxDesiatov/SKQueue.git",
|
||||
"package": "ShellOut",
|
||||
"repositoryURL": "https://github.com/JohnSundell/ShellOut.git",
|
||||
"state": {
|
||||
"branch": "master",
|
||||
"revision": "448a61e772c5beb60ab035b2af140e3165f71b23",
|
||||
"version": null
|
||||
"branch": null,
|
||||
"revision": "e1577acf2b6e90086d01a6d5e2b8efdaae033568",
|
||||
"version": "2.3.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -136,6 +136,15 @@
|
|||
"version": "2.7.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-tools-support-core",
|
||||
"repositoryURL": "https://github.com/apple/swift-tools-support-core.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "912919ab8441306c86c514b78800e4498ab60b60",
|
||||
"version": "0.1.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "vapor",
|
||||
"repositoryURL": "https://github.com/vapor/vapor.git",
|
||||
|
|
|
@ -9,9 +9,10 @@ let package = Package(
|
|||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.0.5")),
|
||||
.package(url: "https://github.com/vapor/vapor.git", from: "4.5.0"),
|
||||
.package(url: "https://github.com/MaxDesiatov/SKQueue.git", .branch("master")),
|
||||
.package(url: "https://github.com/apple/swift-tools-support-core.git", .upToNextMinor(from: "0.1.3")),
|
||||
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.1.1"),
|
||||
.package(url: "https://github.com/NSHipster/HypertextLiteral", from: "0.0.1"),
|
||||
.package(url: "https://github.com/NSHipster/HypertextLiteral", .upToNextMinor(from: "0.0.1")),
|
||||
.package(url: "https://github.com/JohnSundell/ShellOut.git", from: "2.3.0"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
|
@ -22,8 +23,9 @@ let package = Package(
|
|||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||
.product(name: "Vapor", package: "vapor"),
|
||||
.product(name: "AsyncHTTPClient", package: "async-http-client"),
|
||||
"SKQueue",
|
||||
.product(name: "SwiftToolsSupport", package: "swift-tools-support-core"),
|
||||
"HypertextLiteral",
|
||||
"ShellOut",
|
||||
]
|
||||
),
|
||||
.testTarget(
|
||||
|
|
|
@ -1,4 +1,38 @@
|
|||
import ArgumentParser
|
||||
import Foundation
|
||||
import ShellOut
|
||||
|
||||
struct ProductType: Codable {
|
||||
let executable: String?
|
||||
let library: [String]
|
||||
}
|
||||
|
||||
/**
|
||||
Simple Product structure from package dump
|
||||
*/
|
||||
struct Product: Codable {
|
||||
let name: String
|
||||
let type: ProductType
|
||||
}
|
||||
|
||||
/**
|
||||
Simple Package structure from package dump
|
||||
*/
|
||||
struct Package: Codable {
|
||||
let name: String
|
||||
let products: [Product]
|
||||
let targets: [Target]
|
||||
}
|
||||
|
||||
enum TargetType: String, Codable {
|
||||
case regular
|
||||
case test
|
||||
}
|
||||
|
||||
struct Target: Codable {
|
||||
let name: String
|
||||
let type: TargetType
|
||||
}
|
||||
|
||||
struct Dev: ParsableCommand {
|
||||
static var configuration = CommandConfiguration(
|
||||
|
@ -6,6 +40,10 @@ struct Dev: ParsableCommand {
|
|||
)
|
||||
|
||||
func run() throws {
|
||||
let output = try shellOut(to: "swift", arguments: ["package", "dump-package"])
|
||||
guard let data = output.data(using: .utf8)
|
||||
else { fatalError("failed to decode `swift package dump-package` output") }
|
||||
try print(JSONDecoder().decode(Package.self, from: data))
|
||||
try Server.run()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
wasm-DEVELOPMENT-SNAPSHOT-2020-05-02-a
|
||||
wasm-DEVELOPMENT-SNAPSHOT-2020-05-25-a
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
"package": "JavaScriptKit",
|
||||
"repositoryURL": "https://github.com/kateinoigakukun/JavaScriptKit",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "1edcf707dcb06f50e980c6cac542f226361dc124",
|
||||
"version": "0.3.0"
|
||||
"branch": "b245ad5",
|
||||
"revision": "b245ad5a2c1c4f5e519900ff06d845cbc106378a",
|
||||
"version": null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -5,8 +5,11 @@ import PackageDescription
|
|||
|
||||
let package = Package(
|
||||
name: "CartonTestApp",
|
||||
products: [
|
||||
.executable(name: "TestApp", targets: ["TestApp"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/kateinoigakukun/JavaScriptKit", from: "0.3.0"),
|
||||
.package(url: "https://github.com/kateinoigakukun/JavaScriptKit", .revision("b245ad5")),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
|
|
Loading…
Reference in New Issue