INNER CODE UNIT · Swift
createBuildCommands
mono0926/LicensePlist · Plugins/LicensePlistBuildTool/LicensePlistBuildTool.swift:16
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] {
let licensePlist = try context.tool(named: "license-plist")
let fileManager = FileManager.default
// Checks LicensePlist config
let configPath = context.xcodeProject.directoryURL.appending(component: "license_plist.yml")
guard fileManager.fileExists(atPath: configPath.path) else {
Diagnostics.error("Can't find 'license_plist.yml' file")
return []
}
// Checks if the plugin working directory is a sub folder of SourcePackages.
// Starting from Xcode 16.3, the plugin working directory no longer is
// `SourcePackages/plugins/MyApp.output/...` but
// `Build/Intermediates.noindex/BuildToolPluginIntermediates/MyApp.output/...`
//
// See https://github.com/mono0926/LicensePlist/issues/240 for more details.
var packageSourcesPath = context.pluginWorkDirectoryURL