mas/Package.swift
Ross Goldberg 466ea67194
Improve scripts: bootstrap, build, format, lint, test & version.
Allow them to be run from any directory.

Call version from lint & test to create Package.swift with version info.

Fail when accessing unset variables.

Improve variable names.

Fix lint issues.

Improve lint & format scripts.

Don't require user input to continue linting.

Much cleaner lint output.

Reorder lint output.

Get swift-format from Brewfile instead of from Package.swift:

 - Speeds up linting.
 - Properly models dependency (not a code dependency).
 - swift-format depends on an old version of swift-argument-parser. Will refactor to use SAP soon.

Include some improvements from 1.8.7 PR.

Other scripts need improvement, too.

Resolve #545

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
2024-10-05 20:33:45 -04:00

77 lines
2.7 KiB
Swift

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "mas",
platforms: [
.macOS(.v10_11)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.executable(
name: "mas",
targets: ["mas"]
),
.library(
name: "MasKit",
targets: ["MasKit"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/Carthage/Commandant.git", from: "0.18.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "10.0.0"),
.package(url: "https://github.com/Quick/Quick.git", from: "5.0.0"),
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.16.2"),
.package(url: "https://github.com/mxcl/Version.git", from: "2.0.1"),
.package(url: "https://github.com/sharplet/Regex.git", from: "2.1.1"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "mas",
dependencies: ["MasKit"],
swiftSettings: [
.unsafeFlags([
"-I", "Sources/PrivateFrameworks/CommerceKit",
"-I", "Sources/PrivateFrameworks/StoreFoundation",
])
]
),
.target(
name: "MasKit",
dependencies: [
"Commandant",
"PromiseKit",
"Regex",
"Version",
],
swiftSettings: [
.unsafeFlags([
"-I", "Sources/PrivateFrameworks/CommerceKit",
"-I", "Sources/PrivateFrameworks/StoreFoundation",
])
],
linkerSettings: [
.linkedFramework("CommerceKit"),
.linkedFramework("StoreFoundation"),
.unsafeFlags(["-F", "/System/Library/PrivateFrameworks"]),
]
),
.testTarget(
name: "MasKitTests",
dependencies: ["MasKit", "Nimble", "Quick"],
resources: [.copy("JSON")],
swiftSettings: [
.unsafeFlags([
"-I", "Sources/PrivateFrameworks/CommerceKit",
"-I", "Sources/PrivateFrameworks/StoreFoundation",
])
]
),
],
swiftLanguageVersions: [.v5]
)