spm app builds

This commit is contained in:
Joe Mattiello
2023-03-01 14:36:52 -05:00
parent e036f07875
commit 8b1e87d2dd
117 changed files with 553 additions and 139 deletions

View File

@@ -0,0 +1,34 @@
// Copyright 2022 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import PackagePlugin
import Foundation
@main
struct IntentBuilderPlugin: BuildToolPlugin {
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
let outputDirectory = context.pluginWorkDirectory.appending("GeneratedSources")
guard let target = target as? SourceModuleTarget else {
Diagnostics.error("Attempted to use `IntentBuilderPlugin` on an unsupported module target")
return []
}
return target.sourceFiles(withSuffix: "intentdefinition")
.map { file in
.prebuildCommand(
displayName: "Generate intents sources",
executable: Path("/usr/bin/xcrun"),
arguments: [
"intentbuilderc", "generate",
"-input", file.path.string,
"-output", outputDirectory,
"-language", "Swift",
"-swiftVersion", "5.6",
"-classPrefix", ""
],
outputFilesDirectory: outputDirectory
)
}
}
}