@@ -327,6 +327,12 @@ public List<LibraryDescriptor.Dependency> getDependencies() {
327
327
}
328
328
return list ;
329
329
}
330
+
331
+ public List <LibraryDescriptor .Dependency > getAllDependenciesAnyScope () {
332
+ ArrayList <LibraryDescriptor .Dependency > list = new ArrayList <>(dependencies .size ());
333
+ list .addAll (dependencies );
334
+ return list ;
335
+ }
330
336
331
337
private class Reader extends Task .Cpu <Void , Exception > {
332
338
private Reader (AsyncWork <XMLStreamReader , Exception > startXMLReader , byte priority ,
@@ -742,18 +748,16 @@ public Void run() {
742
748
resolveProperties (properties , finalProperties );
743
749
744
750
Profile defaultProfile = null ;
745
- Profile activeProfile = null ;
751
+ List < Profile > activeProfiles = new LinkedList <>() ;
746
752
for (Profile profile : profiles ) {
747
- if (checkProfile (profile , finalProperties )) {
748
- activeProfile = profile ;
749
- break ;
750
- }
751
- if (profile .activeByDefault && defaultProfile == null )
753
+ if (checkProfile (profile , finalProperties ))
754
+ activeProfiles .add (profile );
755
+ else if (profile .activeByDefault && defaultProfile == null )
752
756
defaultProfile = profile ;
753
757
}
754
- if (activeProfile == null ) activeProfile = defaultProfile ;
755
- if ( activeProfile != null )
756
- addProfile (activeProfile );
758
+ if (activeProfiles . isEmpty () && defaultProfile != null ) activeProfiles . add ( defaultProfile ) ;
759
+ for ( Profile p : activeProfiles )
760
+ addProfile (p );
757
761
758
762
resolveProperties (properties , finalProperties );
759
763
properties = finalProperties ;
@@ -879,40 +883,40 @@ private boolean checkProfile(Profile profile, Map<String, String> finalPropertie
879
883
if (profile .activationOS .name != null ) {
880
884
String name = System .getProperty ("os.name" ).toLowerCase (Locale .US );
881
885
String s = profile .activationOS .name .toLowerCase ();
882
- if (s .startsWith ("!" ))
886
+ if (s .startsWith ("!" )) {
883
887
if (name .equals (s .substring (1 )))
884
888
return false ;
885
- if (!name .equals (s ))
889
+ } else if (!name .equals (s ))
886
890
return false ;
887
891
}
888
892
if (profile .activationOS .arch != null ) {
889
893
String arch = System .getProperty ("os.arch" ).toLowerCase (Locale .US );
890
894
String s = profile .activationOS .arch .toLowerCase ();
891
- if (s .startsWith ("!" ))
895
+ if (s .startsWith ("!" )) {
892
896
if (arch .equals (s .substring (1 )))
893
897
return false ;
894
- if (!arch .equals (s ))
898
+ } else if (!arch .equals (s ))
895
899
return false ;
896
900
}
897
901
if (profile .activationOS .family != null ) {
898
902
OSFamily family = SystemEnvironment .getOSFamily ();
899
903
if (family == null )
900
904
return false ;
901
- String fam = profile . activationOS . family .toLowerCase ();
902
- String s = family .getName ();
903
- if (s .startsWith ("!" ))
905
+ String fam = family .getName ();
906
+ String s = profile . activationOS . family .toLowerCase ();
907
+ if (s .startsWith ("!" )) {
904
908
if (fam .equals (s .substring (1 )))
905
909
return false ;
906
- if (!fam .equals (s ))
910
+ } else if (!fam .equals (s ))
907
911
return false ;
908
912
}
909
913
if (profile .activationOS .version != null ) {
910
914
String ver = System .getProperty ("os.version" ).toLowerCase (Locale .US );
911
915
String s = profile .activationOS .version .toLowerCase ();
912
- if (s .startsWith ("!" ))
916
+ if (s .startsWith ("!" )) {
913
917
if (ver .equals (s .substring (1 )))
914
918
return false ;
915
- if (!ver .equals (s ))
919
+ } else if (!ver .equals (s ))
916
920
return false ;
917
921
}
918
922
}
0 commit comments