File tree Expand file tree Collapse file tree
Plugins/SwiftLintBuildToolPlugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7272 ` redundant_self ` rule.
7373 [ SimplyDanny] ( https://github.com/SimplyDanny )
7474 [ #6553 ] ( https://github.com/realm/SwiftLint/issues/6553 )
75+
76+ * Respect existing environment variables when setting ` BUILD_WORKSPACE_DIRECTORY `
77+ in build tool plugins.
78+ [ SimplyDanny] ( https://github.com/SimplyDanny )
79+ [ #6080 ] ( https://github.com/realm/SwiftLint/issues/6080 )
7580
7681## 0.63.2: High-Speed Extraction
7782
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ struct SwiftLintBuildToolPlugin: BuildToolPlugin {
3636 target: Target
3737 ) throws -> [ String : String ] {
3838 let workingDirectory : Path = try target. directory. resolveWorkingDirectory ( in: context. package . directory)
39- return [ " BUILD_WORKSPACE_DIRECTORY " : " \( workingDirectory) " ]
39+ return addedToEnvironment ( [ " BUILD_WORKSPACE_DIRECTORY " : " \( workingDirectory) " ] )
4040 }
4141
4242 private func makeCommand(
@@ -83,6 +83,10 @@ struct SwiftLintBuildToolPlugin: BuildToolPlugin {
8383 }
8484}
8585
86+ private func addedToEnvironment( _ new: [ String : String ] ) -> [ String : String ] {
87+ ProcessInfo . processInfo. environment. merging ( new) { _, new in new }
88+ }
89+
8690#if canImport(XcodeProjectPlugin)
8791
8892import XcodeProjectPlugin
@@ -138,7 +142,7 @@ extension SwiftLintBuildToolPlugin: XcodeBuildToolPlugin {
138142 throw SwiftLintBuildToolPluginError . swiftFilesNotInWorkingDirectory ( workingDirectory)
139143 }
140144
141- return [ " BUILD_WORKSPACE_DIRECTORY " : " \( workingDirectory) " ]
145+ return addedToEnvironment ( [ " BUILD_WORKSPACE_DIRECTORY " : " \( workingDirectory) " ] )
142146 }
143147}
144148
You can’t perform that action at this time.
0 commit comments