@@ -483,8 +483,7 @@ public ActionOwner getActionOwner(String execGroup) {
483
483
aspectDescriptors ,
484
484
getConfiguration (),
485
485
getExecProperties (execGroup , execProperties ),
486
- getExecutionPlatform (execGroup ),
487
- ImmutableSet .of (execGroup ));
486
+ getExecutionPlatform (execGroup ));
488
487
actionOwners .put (execGroup , actionOwner );
489
488
return actionOwner ;
490
489
}
@@ -591,31 +590,12 @@ public ImmutableList<Artifact> getBuildInfo(BuildInfoKey key) throws Interrupted
591
590
AnalysisUtils .isStampingEnabled (this , getConfiguration ()), key , getConfiguration ());
592
591
}
593
592
594
- /**
595
- * Computes a map of exec properties given the execution platform, taking only properties in exec
596
- * groups that are applicable to this action. Properties for specific exec groups take precedence
597
- * over properties that don't specify an exec group.
598
- */
599
593
private static ImmutableMap <String , String > computeExecProperties (
600
- Map <String , String > targetExecProperties ,
601
- @ Nullable PlatformInfo executionPlatform ,
602
- Set <String > execGroups ) {
594
+ Map <String , String > targetExecProperties , @ Nullable PlatformInfo executionPlatform ) {
603
595
Map <String , String > execProperties = new HashMap <>();
604
596
605
597
if (executionPlatform != null ) {
606
- Map <String , Map <String , String >> execPropertiesPerGroup =
607
- parseExecGroups (executionPlatform .execProperties ());
608
-
609
- if (execPropertiesPerGroup .containsKey (DEFAULT_EXEC_GROUP_NAME )) {
610
- execProperties .putAll (execPropertiesPerGroup .get (DEFAULT_EXEC_GROUP_NAME ));
611
- execPropertiesPerGroup .remove (DEFAULT_EXEC_GROUP_NAME );
612
- }
613
-
614
- for (Map .Entry <String , Map <String , String >> execGroup : execPropertiesPerGroup .entrySet ()) {
615
- if (execGroups .contains (execGroup .getKey ())) {
616
- execProperties .putAll (execGroup .getValue ());
617
- }
618
- }
598
+ execProperties .putAll (executionPlatform .execProperties ());
619
599
}
620
600
621
601
// If the same key occurs both in the platform and in target-specific properties, the
@@ -631,8 +611,7 @@ public static ActionOwner createActionOwner(
631
611
ImmutableList <AspectDescriptor > aspectDescriptors ,
632
612
BuildConfiguration configuration ,
633
613
Map <String , String > targetExecProperties ,
634
- @ Nullable PlatformInfo executionPlatform ,
635
- Set <String > execGroups ) {
614
+ @ Nullable PlatformInfo executionPlatform ) {
636
615
return ActionOwner .create (
637
616
rule .getLabel (),
638
617
aspectDescriptors ,
@@ -642,7 +621,7 @@ public static ActionOwner createActionOwner(
642
621
configuration .checksum (),
643
622
configuration .toBuildEvent (),
644
623
configuration .isHostConfiguration () ? HOST_CONFIGURATION_PROGRESS_TAG : null ,
645
- computeExecProperties (targetExecProperties , executionPlatform , execGroups ),
624
+ computeExecProperties (targetExecProperties , executionPlatform ),
646
625
executionPlatform );
647
626
}
648
627
@@ -1279,18 +1258,20 @@ private ImmutableMap<String, ImmutableMap<String, String>> parseExecProperties(
1279
1258
return ImmutableMap .of (DEFAULT_EXEC_GROUP_NAME , ImmutableMap .of ());
1280
1259
} else {
1281
1260
return parseExecProperties (
1282
- execProperties , toolchainContexts == null ? null : toolchainContexts .getExecGroups ());
1261
+ execProperties ,
1262
+ toolchainContexts == null ? ImmutableSet .of () : toolchainContexts .getExecGroups ());
1283
1263
}
1284
1264
}
1285
1265
1286
1266
/**
1287
1267
* Parse raw exec properties attribute value into a map of exec group names to their properties.
1288
1268
* The raw map can have keys of two forms: (1) 'property' and (2) 'exec_group_name.property'. The
1289
- * former get parsed into the default exec group, the latter get parsed into their relevant exec
1290
- * groups.
1269
+ * former get parsed into the target's default exec group, the latter get parsed into their
1270
+ * relevant exec groups.
1291
1271
*/
1292
- private static Map <String , Map <String , String >> parseExecGroups (
1293
- Map <String , String > rawExecProperties ) {
1272
+ private static ImmutableMap <String , ImmutableMap <String , String >> parseExecProperties (
1273
+ Map <String , String > rawExecProperties , Set <String > execGroups )
1274
+ throws InvalidExecGroupException {
1294
1275
Map <String , Map <String , String >> consolidatedProperties = new HashMap <>();
1295
1276
consolidatedProperties .put (DEFAULT_EXEC_GROUP_NAME , new HashMap <>());
1296
1277
for (Map .Entry <String , String > execProperty : rawExecProperties .entrySet ()) {
@@ -1303,30 +1284,14 @@ private static Map<String, Map<String, String>> parseExecGroups(
1303
1284
} else {
1304
1285
String execGroup = rawProperty .substring (0 , delimiterIndex );
1305
1286
String property = rawProperty .substring (delimiterIndex + 1 );
1306
- consolidatedProperties .putIfAbsent (execGroup , new HashMap <>());
1307
- consolidatedProperties .get (execGroup ).put (property , execProperty .getValue ());
1308
- }
1309
- }
1310
- return consolidatedProperties ;
1311
- }
1312
-
1313
- /**
1314
- * Parse raw exec properties attribute value into a map of exec group names to their properties.
1315
- * If given a set of exec groups, validates all the exec groups in the map are applicable to the
1316
- * action.
1317
- */
1318
- private static ImmutableMap <String , ImmutableMap <String , String >> parseExecProperties (
1319
- Map <String , String > rawExecProperties , @ Nullable Set <String > execGroups )
1320
- throws InvalidExecGroupException {
1321
- Map <String , Map <String , String >> consolidatedProperties = parseExecGroups (rawExecProperties );
1322
- if (execGroups != null ) {
1323
- for (Map .Entry <String , Map <String , String >> execGroup : consolidatedProperties .entrySet ()) {
1324
- String execGroupName = execGroup .getKey ();
1325
- if (!execGroupName .equals (DEFAULT_EXEC_GROUP_NAME ) && !execGroups .contains (execGroupName )) {
1287
+ if (!execGroups .contains (execGroup )) {
1326
1288
throw new InvalidExecGroupException (
1327
1289
String .format (
1328
- "Tried to set properties for non-existent exec group '%s'." , execGroupName ));
1290
+ "Tried to set exec property '%s' for non-existent exec group '%s'." ,
1291
+ property , execGroup ));
1329
1292
}
1293
+ consolidatedProperties .putIfAbsent (execGroup , new HashMap <>());
1294
+ consolidatedProperties .get (execGroup ).put (property , execProperty .getValue ());
1330
1295
}
1331
1296
}
1332
1297
0 commit comments