Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/rswift/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct GlobalOptions: ParsableArguments {
@Option(help: "Source of default bundle to use")
var bundleSource: BundleSource = .finder

@Option(help: "Development region for provided inputFiles")
var developmentRegion: String?

// MARK: Project specific - Environment variable overrides

@Option(help: "Override environment variable \(EnvironmentKeys.targetName)")
Expand Down Expand Up @@ -121,7 +124,10 @@ extension App {
try core.generateFromXcodeproj(url: xcodeprojURL, targetName: targetName)

case .inputFiles:
try core.generateFromFiles(inputFileURLs: globals.inputFiles.map(URL.init(fileURLWithPath:)))
try core.generateFromFiles(
inputFileURLs: globals.inputFiles.map(URL.init(fileURLWithPath:)),
developmentRegion: globals.developmentRegion
)
}
} catch let error as ResourceParsingError {
throw ValidationError(error.description)
Expand Down
4 changes: 2 additions & 2 deletions Sources/rswift/RswiftCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public struct RswiftCore {
try generateFromProjectResources(resources: resources, developmentRegion: xcodeproj.developmentRegion, knownAssetTags: xcodeproj.knownAssetTags)
}

public func generateFromFiles(inputFileURLs urls: [URL]) throws {
public func generateFromFiles(inputFileURLs urls: [URL], developmentRegion: String?) throws {
let warning: (String) -> Void = { print("warning: [R.swift]", $0) }

let resources = try ProjectResources.parseURLs(
Expand All @@ -102,7 +102,7 @@ public struct RswiftCore {
warning: warning
)

try generateFromProjectResources(resources: resources, developmentRegion: nil, knownAssetTags: nil)
try generateFromProjectResources(resources: resources, developmentRegion: developmentRegion, knownAssetTags: nil)
}

private func generateFromProjectResources(resources: ProjectResources, developmentRegion: String?, knownAssetTags: [String]?) throws {
Expand Down