Files
SwiftLint/Source/SwiftLintFramework/ProcessInfo+XcodeCloud.swift
Danny Mösch 246643fe55 Keep only command-line related functions in swiftlint module (#5806)
Swift 6 doesn't allow importing executable targets. So we need to
move testable logic into a framework.
2024-09-29 17:23:46 +02:00

29 lines
796 B
Swift

import Foundation
extension ProcessInfo {
var isLikelyXcodeCloudEnvironment: Bool {
// https://developer.apple.com/documentation/xcode/environment-variable-reference
let requiredKeys: Set = [
"CI",
"CI_BUILD_ID",
"CI_BUILD_NUMBER",
"CI_BUNDLE_ID",
"CI_COMMIT",
"CI_DERIVED_DATA_PATH",
"CI_PRODUCT",
"CI_PRODUCT_ID",
"CI_PRODUCT_PLATFORM",
"CI_PROJECT_FILE_PATH",
"CI_START_CONDITION",
"CI_TEAM_ID",
"CI_WORKFLOW",
"CI_WORKSPACE",
"CI_XCODE_PROJECT",
"CI_XCODE_SCHEME",
"CI_XCODEBUILD_ACTION",
]
return requiredKeys.isSubset(of: environment.keys)
}
}