Skip to content

Commit

Permalink
Merge pull request #66 from 417-72KI/rename-executable-target
Browse files Browse the repository at this point in the history
Rename executable target
  • Loading branch information
417-72KI authored Oct 1, 2023
2 parents c8ed170 + 2b2154e commit 20a767c
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 14 deletions.
15 changes: 9 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import PackageDescription

let package = Package(
name: "BuildConfig.swift",
platforms: [ .macOS(.v12) ],
platforms: [.macOS(.v12)],
products: [
.executable(name: "buildconfigswift", targets: ["BuildConfig.swift"])
.executable(
name: "buildconfigswift",
targets: ["buildconfigswift"]
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
Expand All @@ -19,7 +22,7 @@ let package = Package(
],
targets: [
.executableTarget(
name: "BuildConfig.swift",
name: "buildconfigswift",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"Core"
Expand Down Expand Up @@ -55,9 +58,9 @@ let package = Package(
]
),
.testTarget(
name: "BuildConfig.swiftTests",
name: "buildconfigswiftTests",
dependencies: [
"BuildConfig.swift",
"buildconfigswift",
// "MirrorDiffKit"
],
resources: [.copy("Resources")]
Expand All @@ -77,7 +80,7 @@ let package = Package(
"MirrorDiffKit"
],
resources: [.copy("Resources")]
)
),
],
swiftLanguageVersions: [.v5]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
import PathKit

@main
struct BuildConfigSwift: ParsableCommand {
struct App: ParsableCommand {
@Option(name: .shortAndLong, help: "The directory to output BuildConfig.plist and BuildConfig.generated.swift.")
var outputDirectory: String = "./"

Expand All @@ -16,13 +16,16 @@ struct BuildConfigSwift: ParsableCommand {
var srcDir: String
}

extension BuildConfigSwift {
extension App {
static var configuration: CommandConfiguration {
CommandConfiguration(version: ApplicationInfo.version)
CommandConfiguration(
commandName: "buildconfigswift",
version: ApplicationInfo.version
)
}
}

extension BuildConfigSwift {
extension App {
func run() throws {
let outputDirectory = Path(outputDirectory)
let environment = environment.flatMap { $0.isEmpty ? nil : $0 }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ final class BuildConfigswiftTests: XCTestCase {
XCTAssertEqual(process.exitCode, .validationFailure)
XCTAssertEqual(stderr.outputString, """
Error: SCRIPT_INPUT_FILE_COUNT must be Int. Invalid value `foo`
Usage: build-config-swift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'build-config-swift --help' for more information.
Usage: buildconfigswift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'buildconfigswift --help' for more information.
""")
}
try context("SCRIPT_OUTPUT_FILE_COUNT") {
Expand All @@ -161,8 +161,8 @@ final class BuildConfigswiftTests: XCTestCase {
XCTAssertEqual(process.exitCode, .validationFailure)
XCTAssertEqual(stderr.outputString, """
Error: SCRIPT_OUTPUT_FILE_COUNT must be Int. Invalid value `bar`
Usage: build-config-swift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'build-config-swift --help' for more information.
Usage: buildconfigswift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'buildconfigswift --help' for more information.
""")
}
}
Expand Down
File renamed without changes.

0 comments on commit 20a767c

Please sign in to comment.