Skip to content

Commit

Permalink
Add improvement of performance in SpecValidation on validateSettings (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zewuchen authored Dec 29, 2024
1 parent 126339f commit 681e320
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Sources/ProjectSpec/SpecValidation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,30 @@ extension Project {
errors.append(.invalidSettingsGroup(group))
}
}

for config in settings.configSettings.keys {
if !configs.contains(where: { $0.name.lowercased().contains(config.lowercased()) }) {
if !options.disabledValidations.contains(.missingConfigs) {
errors.append(.invalidBuildSettingConfig(config))
}
if !configs.contains(where: { $0.name.lowercased().contains(config.lowercased()) }),
!options.disabledValidations.contains(.missingConfigs) {
errors.append(.invalidBuildSettingConfig(config))
}
}

if settings.buildSettings.count == configs.count {
var allConfigs = true
for buildSetting in settings.buildSettings.keys {
outerLoop: for buildSetting in settings.buildSettings.keys {
var isConfig = false
for config in configs {
if config.name.lowercased().contains(buildSetting.lowercased()) {
isConfig = true
break
}
}
if !isConfig {
allConfigs = false
break outerLoop
}
}

if allConfigs {
errors.append(.invalidPerConfigSettings)
}
Expand Down

0 comments on commit 681e320

Please sign in to comment.