From a1b836c4583c035ec8f91bb9d4400b848c812d3a Mon Sep 17 00:00:00 2001 From: Vyacheslav Khorkov Date: Sat, 16 Mar 2024 21:01:12 +0500 Subject: [PATCH 1/3] Delete target sources based on project targets --- .../XcodeProject/Services/XcodeTargetsEditor.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/RugbyFoundation/XcodeProject/Services/XcodeTargetsEditor.swift b/Sources/RugbyFoundation/XcodeProject/Services/XcodeTargetsEditor.swift index 8b343114..b2c4ec4c 100644 --- a/Sources/RugbyFoundation/XcodeProject/Services/XcodeTargetsEditor.swift +++ b/Sources/RugbyFoundation/XcodeProject/Services/XcodeTargetsEditor.swift @@ -68,9 +68,10 @@ final class XcodeTargetsEditor: Loggable { try dictionary[target.project.uuid, default: [:]][target.uuid] = target } let targets = try await targetsDataSource.targets - targetsByProject.forEach { _, targetsForRemove in + try targetsByProject.forEach { _, targetsForRemove in guard let project = targetsForRemove.values.first?.project else { return } - project.deleteTargetGroups(targetsForRemove, targets: targets) + let projectTargets = try targets.filter { try $0.value.project.uuid == project.uuid } + project.deleteTargetGroups(targetsForRemove, targets: projectTargets) } } From d39ec74e3e249a7ad27ec9c83fbf1614f7f7fa3f Mon Sep 17 00:00:00 2001 From: Vyacheslav Khorkov Date: Sat, 16 Mar 2024 21:13:21 +0500 Subject: [PATCH 2/3] Fix help output width --- Sources/Rugby/Core/Help/HelpPrinter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Rugby/Core/Help/HelpPrinter.swift b/Sources/Rugby/Core/Help/HelpPrinter.swift index b22f7a20..caa67258 100644 --- a/Sources/Rugby/Core/Help/HelpPrinter.swift +++ b/Sources/Rugby/Core/Help/HelpPrinter.swift @@ -6,7 +6,7 @@ private extension String { } final class HelpPrinter { - private let terminalWidth = Terminal.columns() ?? 80 + private let terminalWidth = Terminal.columns() ?? Int.max private let arguments: [(String, ArgumentInfoV0.KindV0)] = [ ("Arguments", .positional), ("Options", .option), From 3b3ec0ebbbae543742083b9b144a46034a9eec1a Mon Sep 17 00:00:00 2001 From: Vyacheslav Khorkov Date: Sat, 16 Mar 2024 21:21:43 +0500 Subject: [PATCH 3/3] Implement ability to add warmup headers in cache command --- Docs/commands-help/shortcuts/cache.md | 25 ++++++++++---------- Sources/Rugby/Commands/Mixed/Shortcuts.swift | 4 ++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Docs/commands-help/shortcuts/cache.md b/Docs/commands-help/shortcuts/cache.md index 1db754c0..227499ed 100644 --- a/Docs/commands-help/shortcuts/cache.md +++ b/Docs/commands-help/shortcuts/cache.md @@ -11,18 +11,19 @@ > Run the build and use commands. Options: -╭───────────────────────────────────────────────────────────────────────────────╮ -│ --warmup * Warmup cache with this endpoint. │ -│ -s, --sdk * Build SDK: sim or ios. │ -│ -a, --arch * Build architecture: auto, x86_64 or arm64. │ -│ -c, --config * Build configuration. (Debug) │ -│ -t, --targets [] * Target names to select. Empty means all targets. │ -│ -g, --targets-as-regex [] * Regular expression patterns to select targets. │ -│ -e, --except [] * Target names to exclude. │ -│ -x, --except-as-regex [] * Regular expression patterns to exclude targets. │ -│ --result-bundle-path * Path to xcresult bundle. │ -│ -o, --output * Output mode: fold, multiline, silent, raw. │ -╰───────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────╮ +│ --warmup * Warmup cache with this endpoint. │ +│ --headers [] * Extra HTTP header fields for warmup ("s3-key: my-secret-key"). │ +│ -s, --sdk * Build SDK: sim or ios. │ +│ -a, --arch * Build architecture: auto, x86_64 or arm64. │ +│ -c, --config * Build configuration. (Debug) │ +│ -t, --targets [] * Target names to select. Empty means all targets. │ +│ -g, --targets-as-regex [] * Regular expression patterns to select targets. │ +│ -e, --except [] * Target names to exclude. │ +│ -x, --except-as-regex [] * Regular expression patterns to exclude targets. │ +│ --result-bundle-path * Path to xcresult bundle. │ +│ -o, --output * Output mode: fold, multiline, silent, raw. │ +╰─────────────────────────────────────────────────────────────────────────────────────────────╯ Flags: ╭─────────────────────────────────────────────────────────────────────────╮ │ -r, --rollback * Restore projects state before the last Rugby usage. │ diff --git a/Sources/Rugby/Commands/Mixed/Shortcuts.swift b/Sources/Rugby/Commands/Mixed/Shortcuts.swift index 2bb9e0d6..6b00ef9d 100644 --- a/Sources/Rugby/Commands/Mixed/Shortcuts.swift +++ b/Sources/Rugby/Commands/Mixed/Shortcuts.swift @@ -72,6 +72,9 @@ extension Shortcuts { @Option(help: "Warmup cache with this endpoint.") var warmup: String? + @Option(help: "Extra HTTP header fields for warmup (\"s3-key: my-secret-key\").") + var headers: [String] = [] + @OptionGroup var buildOptions: BuildOptions @@ -120,6 +123,7 @@ extension Shortcuts.Cache: RunnableCommand { warmup.commonOptions = commonOptions warmup.timeout = Self.settings.warmupTimeout warmup.maxConnections = Self.settings.warmupMaximumConnectionsPerHost + warmup.headers = headers runnableCommands.append(("Warmup", warmup)) }