Support for custom shell path in `ExecuteAction` (#5154)
* bump up Xcodeproj to 8.9.0 * add shellPath property at ExecuteAction * update changelog * run lint * update pull request link * match changelog with PR title * remove changes in changelog (it will be auto-generated) * update shellPath comment * update fixture to use shellPath in ExecutionAction * bump up XcodeProj to 8.10.0
This commit is contained in:
parent
aa56341720
commit
a80500c605
|
@ -265,8 +265,8 @@
|
|||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/tuist/XcodeProj.git",
|
||||
"state" : {
|
||||
"revision" : "b6de1bfe021b861c94e7c83821b595083f74b997",
|
||||
"version" : "8.8.0"
|
||||
"revision" : "5fdac93cb4a7fd4bad5ac2da34e5bc878263043f",
|
||||
"version" : "8.10.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ let package = Package(
|
|||
.package(url: "https://github.com/SwiftDocOrg/GraphViz.git", exact: "0.2.0"),
|
||||
.package(url: "https://github.com/SwiftGen/StencilSwiftKit.git", exact: "2.9.0"),
|
||||
.package(url: "https://github.com/SwiftGen/SwiftGen", exact: "6.5.1"),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.8.0"),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.10.0"),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
|
|
|
@ -6,9 +6,13 @@ public struct ExecutionAction: Equatable, Codable {
|
|||
public let scriptText: String
|
||||
public let target: TargetReference?
|
||||
|
||||
public init(title: String = "Run Script", scriptText: String, target: TargetReference? = nil) {
|
||||
/// The path to the shell which shall execute this script. if it is nil, Xcode will use default value.
|
||||
public let shellPath: String?
|
||||
|
||||
public init(title: String = "Run Script", scriptText: String, target: TargetReference? = nil, shellPath: String? = nil) {
|
||||
self.title = title
|
||||
self.scriptText = scriptText
|
||||
self.target = target
|
||||
self.shellPath = shellPath
|
||||
}
|
||||
}
|
||||
|
|
|
@ -731,6 +731,7 @@ final class SchemeDescriptorsGenerator: SchemeDescriptorsGenerating {
|
|||
return XCScheme.ExecutionAction(
|
||||
scriptText: action.scriptText,
|
||||
title: action.title,
|
||||
shellToInvoke: action.shellPath,
|
||||
environmentBuildable: nil
|
||||
)
|
||||
}
|
||||
|
@ -745,6 +746,7 @@ final class SchemeDescriptorsGenerator: SchemeDescriptorsGenerating {
|
|||
return XCScheme.ExecutionAction(
|
||||
scriptText: action.scriptText,
|
||||
title: action.title,
|
||||
shellToInvoke: action.shellPath,
|
||||
environmentBuildable: buildableReference
|
||||
)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ public struct ExecutionAction: Equatable, Codable {
|
|||
public let scriptText: String
|
||||
/// Name of the build or test target that will provide the action's build settings.
|
||||
public let target: TargetReference?
|
||||
/// The path to the shell which shall execute this script. if it is nil, Xcode will use default value.
|
||||
public let shellPath: String?
|
||||
|
||||
public let showEnvVarsInLog: Bool
|
||||
|
||||
|
@ -20,11 +22,13 @@ public struct ExecutionAction: Equatable, Codable {
|
|||
title: String,
|
||||
scriptText: String,
|
||||
target: TargetReference?,
|
||||
shellPath: String?,
|
||||
showEnvVarsInLog: Bool = true
|
||||
) {
|
||||
self.title = title
|
||||
self.scriptText = scriptText
|
||||
self.target = target
|
||||
self.shellPath = shellPath
|
||||
self.showEnvVarsInLog = showEnvVarsInLog
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ extension TuistGraph.ExecutionAction {
|
|||
name: $0.targetName
|
||||
)
|
||||
}
|
||||
return ExecutionAction(title: manifest.title, scriptText: manifest.scriptText, target: targetReference)
|
||||
return ExecutionAction(
|
||||
title: manifest.title,
|
||||
scriptText: manifest.scriptText,
|
||||
target: targetReference,
|
||||
shellPath: manifest.shellPath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ final class SchemeTests: XCTestCase {
|
|||
target: TargetReference(
|
||||
projectPath: nil,
|
||||
target: "target"
|
||||
)
|
||||
),
|
||||
shellPath: "/bin/sh"
|
||||
),
|
||||
]
|
||||
}
|
||||
|
|
|
@ -211,12 +211,14 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
let preAction = ExecutionAction(
|
||||
title: "Pre Action",
|
||||
scriptText: "echo Pre Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let postAction = ExecutionAction(
|
||||
title: "Post Action",
|
||||
scriptText: "echo Post Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let buildAction = BuildAction.test(
|
||||
targets: [TargetReference(projectPath: projectPath, name: "App")],
|
||||
|
@ -252,6 +254,7 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
// Pre Action
|
||||
XCTAssertEqual(got?.preActions.first?.title, "Pre Action")
|
||||
XCTAssertEqual(got?.preActions.first?.scriptText, "echo Pre Actions")
|
||||
XCTAssertEqual(got?.preActions.first?.shellToInvoke, "/bin/sh")
|
||||
|
||||
let preBuildableReference = got?.preActions.first?.environmentBuildable
|
||||
|
||||
|
@ -263,6 +266,7 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
// Post Action
|
||||
XCTAssertEqual(got?.postActions.first?.title, "Post Action")
|
||||
XCTAssertEqual(got?.postActions.first?.scriptText, "echo Post Actions")
|
||||
XCTAssertEqual(got?.postActions.first?.shellToInvoke, "/bin/sh")
|
||||
|
||||
let postBuildableReference = got?.postActions.first?.environmentBuildable
|
||||
|
||||
|
@ -319,7 +323,8 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
let preAction = ExecutionAction(
|
||||
title: "Pre Action",
|
||||
scriptText: "echo Pre Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: nil
|
||||
)
|
||||
let buildAction = BuildAction.test(
|
||||
targets: [TargetReference(projectPath: projectPath, name: "App")],
|
||||
|
@ -773,12 +778,14 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
let preAction = ExecutionAction(
|
||||
title: "Pre Action",
|
||||
scriptText: "echo Pre Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "AppTests")
|
||||
target: TargetReference(projectPath: projectPath, name: "AppTests"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let postAction = ExecutionAction(
|
||||
title: "Post Action",
|
||||
scriptText: "echo Post Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "AppTests")
|
||||
target: TargetReference(projectPath: projectPath, name: "AppTests"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let testAction = TestAction.test(
|
||||
targets: [TestableTarget(target: TargetReference(projectPath: projectPath, name: "AppTests"))],
|
||||
|
@ -824,6 +831,7 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
|
||||
XCTAssertEqual(result.preActions.first?.title, "Pre Action")
|
||||
XCTAssertEqual(result.preActions.first?.scriptText, "echo Pre Actions")
|
||||
XCTAssertEqual(result.preActions.first?.shellToInvoke, "/bin/sh")
|
||||
|
||||
let preBuildableReference = try XCTUnwrap(result.preActions.first?.environmentBuildable)
|
||||
|
||||
|
@ -835,6 +843,7 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
// Post Action
|
||||
XCTAssertEqual(result.postActions.first?.title, "Post Action")
|
||||
XCTAssertEqual(result.postActions.first?.scriptText, "echo Post Actions")
|
||||
XCTAssertEqual(result.postActions.first?.shellToInvoke, "/bin/sh")
|
||||
|
||||
let postBuildableReference = try XCTUnwrap(result.postActions.first?.environmentBuildable)
|
||||
|
||||
|
@ -1090,12 +1099,14 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
let preAction = ExecutionAction(
|
||||
title: "Pre Action",
|
||||
scriptText: "echo Pre Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let postAction = ExecutionAction(
|
||||
title: "Post Action",
|
||||
scriptText: "echo Post Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
|
||||
let launchAction = RunAction.test(
|
||||
|
@ -1136,8 +1147,10 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
// Then
|
||||
XCTAssertEqual(got?.preActions.first?.title, "Pre Action")
|
||||
XCTAssertEqual(got?.preActions.first?.scriptText, "echo Pre Actions")
|
||||
XCTAssertEqual(got?.preActions.first?.shellToInvoke, "/bin/sh")
|
||||
XCTAssertEqual(got?.postActions.first?.title, "Post Action")
|
||||
XCTAssertEqual(got?.postActions.first?.scriptText, "echo Post Actions")
|
||||
XCTAssertEqual(got?.postActions.first?.shellToInvoke, "/bin/sh")
|
||||
}
|
||||
|
||||
func test_schemeLaunchAction_with_disabled_attachDebugger() throws {
|
||||
|
@ -1562,12 +1575,14 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
let preAction = ExecutionAction(
|
||||
title: "Pre Action",
|
||||
scriptText: "echo Pre Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let postAction = ExecutionAction(
|
||||
title: "Post Action",
|
||||
scriptText: "echo Post Actions",
|
||||
target: TargetReference(projectPath: projectPath, name: "App")
|
||||
target: TargetReference(projectPath: projectPath, name: "App"),
|
||||
shellPath: "/bin/sh"
|
||||
)
|
||||
let scheme = makeProfileActionScheme(
|
||||
preActions: [preAction],
|
||||
|
@ -1599,8 +1614,10 @@ final class SchemeDescriptorsGeneratorTests: XCTestCase {
|
|||
// Then
|
||||
XCTAssertEqual(got?.preActions.first?.title, "Pre Action")
|
||||
XCTAssertEqual(got?.preActions.first?.scriptText, "echo Pre Actions")
|
||||
XCTAssertEqual(got?.preActions.first?.shellToInvoke, "/bin/sh")
|
||||
XCTAssertEqual(got?.postActions.first?.title, "Post Action")
|
||||
XCTAssertEqual(got?.postActions.first?.scriptText, "echo Post Actions")
|
||||
XCTAssertEqual(got?.postActions.first?.shellToInvoke, "/bin/sh")
|
||||
}
|
||||
|
||||
// MARK: - Analyze Action Tests
|
||||
|
|
|
@ -144,7 +144,8 @@ class SchemeLinterTests: TuistTestCase {
|
|||
target: .init(
|
||||
projectPath: try! AbsolutePath(validating: "/Project/../Project2"),
|
||||
name: "Target2"
|
||||
)
|
||||
),
|
||||
shellPath: nil
|
||||
)])
|
||||
),
|
||||
])
|
||||
|
|
|
@ -16,6 +16,7 @@ final class ArchiveActionTests: TuistUnitTestCase {
|
|||
title: "preActionTitle",
|
||||
scriptText: "text",
|
||||
target: nil,
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: false
|
||||
),
|
||||
],
|
||||
|
@ -24,6 +25,7 @@ final class ArchiveActionTests: TuistUnitTestCase {
|
|||
title: "postActionTitle",
|
||||
scriptText: "text",
|
||||
target: nil,
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: true
|
||||
),
|
||||
]
|
||||
|
|
|
@ -19,6 +19,7 @@ final class BuildActionTests: TuistUnitTestCase {
|
|||
title: "preActionTitle",
|
||||
scriptText: "text",
|
||||
target: nil,
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: true
|
||||
),
|
||||
],
|
||||
|
@ -27,6 +28,7 @@ final class BuildActionTests: TuistUnitTestCase {
|
|||
title: "postActionTitle",
|
||||
scriptText: "text",
|
||||
target: nil,
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: false
|
||||
),
|
||||
]
|
||||
|
|
|
@ -14,6 +14,7 @@ final class ExecutionActionTests: TuistUnitTestCase {
|
|||
projectPath: "/path/to/project",
|
||||
name: "name"
|
||||
),
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: false
|
||||
)
|
||||
|
||||
|
|
|
@ -363,7 +363,13 @@ final class TestModelGenerator {
|
|||
|
||||
private func createExecutionActions() -> [ExecutionAction] {
|
||||
(0 ..< 10).map {
|
||||
ExecutionAction(title: "ExecutionAction\($0)", scriptText: "ScripText\($0)", target: nil, showEnvVarsInLog: false)
|
||||
ExecutionAction(
|
||||
title: "ExecutionAction\($0)",
|
||||
scriptText: "ScripText\($0)",
|
||||
target: nil,
|
||||
shellPath: nil,
|
||||
showEnvVarsInLog: false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ let dependencies = Dependencies(
|
|||
.package(url: "https://github.com/SwiftDocOrg/GraphViz.git", .exact("0.2.0")),
|
||||
.package(url: "https://github.com/SwiftGen/StencilSwiftKit.git", .exact("2.9.0")),
|
||||
.package(url: "https://github.com/SwiftGen/SwiftGen", .exact("6.5.1")),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", .exact("8.8.0")),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", .exact("8.10.0")),
|
||||
],
|
||||
platforms: [.macOS]
|
||||
)
|
||||
|
|
|
@ -247,8 +247,8 @@
|
|||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/tuist/XcodeProj.git",
|
||||
"state" : {
|
||||
"revision" : "b6de1bfe021b861c94e7c83821b595083f74b997",
|
||||
"version" : "8.8.0"
|
||||
"revision" : "5fdac93cb4a7fd4bad5ac2da34e5bc878263043f",
|
||||
"version" : "8.10.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -10,14 +10,16 @@ let customAppScheme = Scheme(
|
|||
],
|
||||
preActions: [
|
||||
ExecutionAction(
|
||||
scriptText: "echo pre-action",
|
||||
target: .project(path: "App", target: "App")
|
||||
scriptText: "echo \"pre-action in $SHELL\"",
|
||||
target: .project(path: "App", target: "App"),
|
||||
shellPath: "/bin/zsh"
|
||||
),
|
||||
],
|
||||
postActions: [
|
||||
ExecutionAction(
|
||||
scriptText: "echo post-action",
|
||||
target: .project(path: "Frameworks/Framework1", target: "Framework1")
|
||||
scriptText: "echo \"post-action in $SHELL\"",
|
||||
target: .project(path: "Frameworks/Framework1", target: "Framework1"),
|
||||
shellPath: "/bin/zsh"
|
||||
),
|
||||
]
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue