@@ -32,17 +32,23 @@ import var TSCBasic.stdoutStream
32
32
struct MigrateOptions : ParsableArguments {
33
33
@Option (
34
34
name: . customLong( " target " ) ,
35
- parsing: . upToNextOption,
36
35
help: " The targets to migrate to specified set of features. "
37
36
)
38
- var targets : [ String ] = [ ]
37
+ var _targets : String ?
38
+
39
+ var targets : OrderedSet < String > {
40
+ self . _targets. flatMap { OrderedSet ( $0. components ( separatedBy: " , " ) ) } ?? [ ]
41
+ }
39
42
40
43
@Option (
41
44
name: . customLong( " to-feature " ) ,
42
- parsing: . upToNextOption,
43
45
help: " The Swift language upcoming/experimental feature to migrate to. "
44
46
)
45
- var features : [ String ]
47
+ var _features : String
48
+
49
+ var features : Set < String > {
50
+ Set ( self . _features. components ( separatedBy: " , " ) )
51
+ }
46
52
}
47
53
48
54
extension SwiftPackageCommand {
@@ -84,20 +90,20 @@ extension SwiftPackageCommand {
84
90
features. append ( feature)
85
91
}
86
92
87
- let uniqueTargets = OrderedSet ( self . options. targets)
93
+ let targets = self . options. targets
88
94
89
95
let buildSystem = try await createBuildSystem (
90
96
swiftCommandState,
91
- targets: uniqueTargets ,
97
+ targets: targets ,
92
98
features: features
93
99
)
94
100
95
101
// Next, let's build all of the individual targets or the
96
102
// whole project to get diagnostic files.
97
103
98
104
print ( " > Starting the build " )
99
- if !uniqueTargets . isEmpty {
100
- for target in uniqueTargets {
105
+ if !targets . isEmpty {
106
+ for target in targets {
101
107
try await buildSystem. build ( subset: . target( target) )
102
108
}
103
109
} else {
@@ -108,9 +114,9 @@ extension SwiftPackageCommand {
108
114
let buildPlan = try buildSystem. buildPlan
109
115
110
116
var modules : [ any ModuleBuildDescription ] = [ ]
111
- if !uniqueTargets . isEmpty {
117
+ if !targets . isEmpty {
112
118
for buildDescription in buildPlan. buildModules
113
- where uniqueTargets . contains ( buildDescription. module. name) {
119
+ where targets . contains ( buildDescription. module. name) {
114
120
modules. append ( buildDescription)
115
121
}
116
122
} else {
0 commit comments