@@ -98,31 +98,25 @@ fn build_pomace_target(name: &str, sdk: &str, deployment_targets: &DeploymentTar
9898 build. compile ( name) ;
9999}
100100
101- fn try_build ( targets : & [ & str ] , sdk : & str , deployment_targets : & DeploymentTargets ) {
102- for name in targets {
103- build_pomace_target ( name, sdk, deployment_targets) ;
104- }
105- }
106-
107- fn collect_build_groups ( sdk : & str ) -> Vec < Vec < & ' static str > > {
108- let mut groups = Vec :: new ( ) ;
101+ fn collect_targets ( sdk : & str ) -> Vec < & ' static str > {
102+ let mut targets = Vec :: new ( ) ;
109103
110104 // Available on all platforms
111- groups . push ( vec ! [ "ut" , "un" , "sn" , "ns" , "av" , "cl" , "nl" , "ml" , "at" ] ) ;
105+ targets . extend_from_slice ( & [ "ut" , "un" , "sn" , "ns" , "av" , "cl" , "nl" , "ml" , "at" ] ) ;
112106
113107 // Not available on watchOS
114108 if sdk != "watchos" && sdk != "watchsimulator" {
115- groups . push ( vec ! [
109+ targets . extend_from_slice ( & [
116110 "ca" , "vn" , "mps" , "mpsg" , "mc" , "mtl" , "mtk" , "ci" , "gc" , "av_kit" ,
117111 ] ) ;
118112 if sdk != "xros" && sdk != "xrsimulator" {
119- groups . push ( vec ! [ "mlc" ] ) ;
113+ targets . push ( "mlc" ) ;
120114 }
121115 }
122116
123117 // Not available on tvOS
124118 if sdk != "appletvos" && sdk != "appletvsimulator" {
125- groups . push ( vec ! [ "core_motion" ] ) ;
119+ targets . push ( "core_motion" ) ;
126120 }
127121
128122 // Not available on tvOS or watchOS
@@ -131,7 +125,7 @@ fn collect_build_groups(sdk: &str) -> Vec<Vec<&'static str>> {
131125 && sdk != "watchos"
132126 && sdk != "watchsimulator"
133127 {
134- groups . push ( vec ! [ "wk" ] ) ;
128+ targets . push ( "wk" ) ;
135129 }
136130
137131 // iOS/tvOS/watchOS/visionOS/Catalyst only
@@ -148,28 +142,29 @@ fn collect_build_groups(sdk: &str) -> Vec<Vec<&'static str>> {
148142 ]
149143 . contains ( & sdk)
150144 {
151- groups . push ( vec ! [ "ui" ] ) ;
145+ targets . push ( "ui" ) ;
152146 }
153147
154148 // iPhone/iPad/Catalyst only
155149 if sdk == "iphoneos" || sdk == "iphonesimulator" {
156- groups . push ( vec ! [ "wc" ] ) ;
150+ targets . push ( "wc" ) ;
157151 }
158152 if sdk == "iphoneos" || sdk == "iphonesimulator" || sdk == "maccatalyst" {
159- groups . push ( vec ! [ "ar" ] ) ;
153+ targets . push ( "ar" ) ;
160154 }
161155
162156 // macOS/Catalyst only
163157 if sdk == "macosx" || sdk == "maccatalyst" {
164- groups . push ( vec ! [ "sc" , "app" ] ) ;
158+ targets . extend_from_slice ( & [ "sc" , "app" ] ) ;
165159 }
166160
167161 // macOS only
168162 if sdk == "macosx" {
169- groups . push ( vec ! [ "core_audio" ] ) ;
163+ targets . push ( "core_audio" ) ;
170164 }
171165
172- groups
166+ targets. retain ( |target| has_feature ( target) ) ;
167+ targets
173168}
174169
175170fn parse_deployment_targets ( ) -> DeploymentTargets {
@@ -349,22 +344,13 @@ fn main() {
349344
350345 println ! ( "cargo:rerun-if-changed=./pomace/" ) ;
351346
352- let build_groups: Vec < Vec < & ' static str > > = collect_build_groups ( sdk)
353- . into_iter ( )
354- . map ( |group| {
355- group
356- . into_iter ( )
357- . filter ( |name| has_feature ( name) )
358- . collect :: < Vec < _ > > ( )
359- } )
360- . filter ( |group| !group. is_empty ( ) )
361- . collect ( ) ;
347+ let targets = collect_targets ( sdk) ;
362348 let deployment_targets = & deployment_targets;
363349
364350 thread:: scope ( |scope| {
365- for targets in build_groups {
351+ for target in targets {
366352 scope. spawn ( move || {
367- try_build ( & targets , sdk, deployment_targets) ;
353+ build_pomace_target ( target , sdk, deployment_targets) ;
368354 } ) ;
369355 }
370356 } ) ;
0 commit comments