From ad2b8119a4deba07c7721bd43a46ec117408d90d Mon Sep 17 00:00:00 2001 From: "roux g. buciu" Date: Fri, 1 May 2026 09:28:48 -0400 Subject: [PATCH] General improvemnents --- Sources/fxios/Commands/L10n/L10nProduct.swift | 54 ------------------ Sources/fxios/Commands/Nimbus/Nimbus.swift | 3 + .../Commands/{ => Version}/Version.swift | 0 Sources/fxios/Core/Products.swift | 56 +++++++++++++++++++ 4 files changed, 59 insertions(+), 54 deletions(-) delete mode 100644 Sources/fxios/Commands/L10n/L10nProduct.swift rename Sources/fxios/Commands/{ => Version}/Version.swift (100%) diff --git a/Sources/fxios/Commands/L10n/L10nProduct.swift b/Sources/fxios/Commands/L10n/L10nProduct.swift deleted file mode 100644 index ef4a653..0000000 --- a/Sources/fxios/Commands/L10n/L10nProduct.swift +++ /dev/null @@ -1,54 +0,0 @@ -// 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 ArgumentParser - -/// Product presets for l10n commands, providing default configuration values. -enum L10nProduct: String, ExpressibleByArgument, CaseIterable { - case firefox - case focus - - var xliffName: String { - switch self { - case .firefox: return "firefox-ios.xliff" - case .focus: return "focus-ios.xliff" - } - } - - var exportBasePath: String { - switch self { - case .firefox: return "/tmp/ios-localization" - case .focus: return "/tmp/ios-localization-focus" - } - } - - var developmentRegion: String { - switch self { - case .firefox: return "en-US" - case .focus: return "en" - } - } - - var projectName: String { - switch self { - case .firefox: return "Client.xcodeproj" - case .focus: return "Blockzilla.xcodeproj" - } - } - - /// Relative path from repo root to .xcodeproj - var projectPath: String { - switch self { - case .firefox: return "firefox-ios/Client.xcodeproj" - case .focus: return "focus-ios/Blockzilla.xcodeproj" - } - } - - var skipWidgetKit: Bool { - switch self { - case .firefox: return false - case .focus: return true - } - } -} diff --git a/Sources/fxios/Commands/Nimbus/Nimbus.swift b/Sources/fxios/Commands/Nimbus/Nimbus.swift index 642d844..1be0fb1 100644 --- a/Sources/fxios/Commands/Nimbus/Nimbus.swift +++ b/Sources/fxios/Commands/Nimbus/Nimbus.swift @@ -22,6 +22,9 @@ struct Nimbus: ParsableCommand { // MARK: - Constants +// These paths are firefox-ios repo conventions, not values we discover at runtime. The Nimbus +// subcommands (add/remove/refresh) all touch this same set of files in lockstep, so if firefox-ios +// ever reorganizes the FeatureFlags or Nimbus directories these constants must be updated together. enum NimbusConstants { static let nimbusFmlPath = "firefox-ios/nimbus.fml.yaml" static let nimbusFeaturesPath = "firefox-ios/nimbus-features" diff --git a/Sources/fxios/Commands/Version.swift b/Sources/fxios/Commands/Version/Version.swift similarity index 100% rename from Sources/fxios/Commands/Version.swift rename to Sources/fxios/Commands/Version/Version.swift diff --git a/Sources/fxios/Core/Products.swift b/Sources/fxios/Core/Products.swift index 40cca3b..f878905 100644 --- a/Sources/fxios/Core/Products.swift +++ b/Sources/fxios/Core/Products.swift @@ -5,6 +5,11 @@ import ArgumentParser import Foundation +// Two product enums live here on purpose. They serve different command groups and +// carry different configuration, so keeping them as siblings makes the choice obvious: +// - BuildProduct: used by `build`, `run`, `test`, `clean` (Xcode schemes, configurations, bundle IDs) +// - L10nProduct: used by `l10n export`, `l10n import`, `l10n templates` (xliff names, Pontoon paths) + // MARK: - Build Product /// Represents the available products that can be built, run, or tested @@ -52,3 +57,54 @@ enum BuildProduct: String, ExpressibleByArgument, CaseIterable { } } } + +// MARK: - L10n Product + +/// Product presets for l10n commands, providing default configuration values. +enum L10nProduct: String, ExpressibleByArgument, CaseIterable { + case firefox + case focus + + var xliffName: String { + switch self { + case .firefox: return "firefox-ios.xliff" + case .focus: return "focus-ios.xliff" + } + } + + var exportBasePath: String { + switch self { + case .firefox: return "/tmp/ios-localization" + case .focus: return "/tmp/ios-localization-focus" + } + } + + var developmentRegion: String { + switch self { + case .firefox: return "en-US" + case .focus: return "en" + } + } + + var projectName: String { + switch self { + case .firefox: return "Client.xcodeproj" + case .focus: return "Blockzilla.xcodeproj" + } + } + + /// Relative path from repo root to .xcodeproj + var projectPath: String { + switch self { + case .firefox: return "firefox-ios/Client.xcodeproj" + case .focus: return "focus-ios/Blockzilla.xcodeproj" + } + } + + var skipWidgetKit: Bool { + switch self { + case .firefox: return false + case .focus: return true + } + } +}