-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
118 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "swift" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: CI | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: swiftlang/swift:nightly-6.0-jammy | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: swift build | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: swiftlang/swift:nightly-6.0-jammy | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: swift format lint -r -p -s . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 33 additions & 29 deletions
62
Plugins/LicenseProviderPlugin/LicenseProviderPlugin.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,78 @@ | ||
import PackagePlugin | ||
import Foundation | ||
import PackagePlugin | ||
|
||
@main | ||
struct LicenseViewPlugin { | ||
static let commandName = "LicenseProviderExec" | ||
|
||
func sourcePackagesPath(workDirectory: URL) -> URL? { | ||
var workDirectory = workDirectory | ||
|
||
guard workDirectory.absoluteString.contains("SourcePackages") else { | ||
return nil | ||
} | ||
|
||
while workDirectory.lastPathComponent != "SourcePackages" { | ||
workDirectory = workDirectory.deletingLastPathComponent() | ||
} | ||
|
||
return workDirectory | ||
} | ||
|
||
func buildCommands(executablePath: URL, workDirectory: URL) -> Command? { | ||
let fileName = "LicenseProvider.swift" | ||
|
||
let output = workDirectory.appending(path: fileName) | ||
guard let sourcePackages = sourcePackagesPath(workDirectory: workDirectory) else { | ||
return nil | ||
} | ||
|
||
return .buildCommand( | ||
displayName: "LicenseProviderPlugin", | ||
executable: executablePath, | ||
arguments: [ | ||
output.path(), | ||
sourcePackages.path() | ||
sourcePackages.path(), | ||
], | ||
outputFiles: [ output ] | ||
outputFiles: [output] | ||
) | ||
} | ||
} | ||
|
||
extension LicenseViewPlugin: BuildToolPlugin { | ||
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] { | ||
let executablePath = try context.tool(named: LicenseViewPlugin.commandName).url | ||
|
||
guard let command = buildCommands( | ||
executablePath: executablePath, | ||
workDirectory: context.pluginWorkDirectoryURL | ||
) else { | ||
|
||
guard | ||
let command = buildCommands( | ||
executablePath: executablePath, | ||
workDirectory: context.pluginWorkDirectoryURL | ||
) | ||
else { | ||
return [] | ||
} | ||
|
||
return [command] | ||
} | ||
} | ||
|
||
#if canImport(XcodeProjectPlugin) | ||
import XcodeProjectPlugin | ||
import XcodeProjectPlugin | ||
|
||
extension LicenseViewPlugin: XcodeBuildToolPlugin { | ||
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] { | ||
let executablePath = try context.tool(named: LicenseViewPlugin.commandName).url | ||
|
||
guard let command = buildCommands( | ||
executablePath: executablePath, | ||
workDirectory: context.pluginWorkDirectoryURL | ||
) else { | ||
return [] | ||
extension LicenseViewPlugin: XcodeBuildToolPlugin { | ||
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] { | ||
let executablePath = try context.tool(named: LicenseViewPlugin.commandName).url | ||
|
||
guard | ||
let command = buildCommands( | ||
executablePath: executablePath, | ||
workDirectory: context.pluginWorkDirectoryURL | ||
) | ||
else { | ||
return [] | ||
} | ||
|
||
return [command] | ||
} | ||
|
||
return [command] | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters