@@ -771,6 +771,105 @@ - (NSDictionary *)buildSettingsForFirstBuildable
771
771
return settings;
772
772
}
773
773
774
+ - (NSString *)matchingSchemePathForWorkspace
775
+ {
776
+ NSString *matchingSchemePath =nil ;
777
+
778
+ NSArray *schemePaths = [XcodeSubjectInfoschemePathsInWorkspace: self .subjectWorkspace];
779
+ for (NSString *schemePath in schemePaths) {
780
+ if ([schemePathhasSuffix: [NSString stringWithFormat: @" /%@ .xcscheme" ,self .subjectScheme]]) {
781
+ matchingSchemePath = schemePath;
782
+ }
783
+ }
784
+
785
+ return matchingSchemePath;
786
+ }
787
+
788
+ - (NSString *)matchingSchemePathForProject
789
+ {
790
+ NSString *matchingSchemePath =nil ;
791
+
792
+ NSArray *schemePaths = [XcodeSubjectInfoschemePathsInContainer: self .subjectProject];
793
+ for (NSString *schemePath in schemePaths) {
794
+ if ([schemePathhasSuffix: [NSString stringWithFormat: @" /%@ .xcscheme" ,self .subjectScheme]]) {
795
+ matchingSchemePath = schemePath;
796
+ }
797
+ }
798
+
799
+ return matchingSchemePath;
800
+ }
801
+
802
+ - (void )populateBuildablesAndTestablesForWorkspaceWithSchemePath : (NSString *)schemePath
803
+ {
804
+ NSArray *testables = [[self class ]testablesInSchemePath: schemePath
805
+ basePath: BasePathFromSchemePath (schemePath)];
806
+ NSArray *buildables = [[self class ]buildablesInSchemePath: schemePath
807
+ basePath: BasePathFromSchemePath (schemePath)];
808
+
809
+
810
+ // It's possible that the scheme references projects that aren't part of the workspace. When
811
+ // Xcode encounters these, it just skips them so we'll do the same.
812
+ NSSet *projectPathsInWorkspace = [NSSet setWithArray: [XcodeSubjectInfoprojectPathsInWorkspace: self .subjectWorkspace]];
813
+ BOOL (^workspaceContainsProject)(id ) = ^(id item) {
814
+ return [projectPathsInWorkspacecontainsObject: [itemobjectForKey: @" projectPath" ]];
815
+ };
816
+
817
+ self.testables = [testablesobjectsAtIndexes:
818
+ [testablesindexesOfObjectsPassingTest:
819
+ ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
820
+ return workspaceContainsProject (obj);
821
+ }]];
822
+
823
+ self.buildables = [buildablesobjectsAtIndexes:
824
+ [buildablesindexesOfObjectsPassingTest:
825
+ ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
826
+ return workspaceContainsProject (obj);
827
+ }]];
828
+
829
+ self.buildablesForTest = [buildablesobjectsAtIndexes:
830
+ [buildablesindexesOfObjectsPassingTest:
831
+ ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
832
+ return (workspaceContainsProject (obj) &&
833
+ [[objobjectForKey: @" forTesting" ]boolValue ]);
834
+ }]];
835
+ }
836
+
837
+ - (void )populateBuildablesAndTestablesForProjectWithSchemePath : (NSString *)schemePath
838
+ {
839
+ self.testables = [[self class ]testablesInSchemePath: schemePath
840
+ basePath: BasePathFromSchemePath (schemePath)];
841
+
842
+ NSArray *buildables = [[self class ]buildablesInSchemePath: schemePath
843
+ basePath: BasePathFromSchemePath (schemePath)];
844
+ self.buildablesForTest = [buildablesobjectsAtIndexes:
845
+ [buildablesindexesOfObjectsPassingTest:
846
+ ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
847
+ return [[objobjectForKey: @" forTesting" ]boolValue ];
848
+ }]];
849
+ }
850
+
851
+ - (void )populateBuildActionPropertiesWithSchemePath : (NSString *)schemePath
852
+ {
853
+ NSError *error =nil ;
854
+ NSXMLDocument *doc = [[[NSXMLDocument alloc ]initWithContentsOfURL: [NSURL fileURLWithPath: schemePath]
855
+ options: 0
856
+ error: &error]autorelease ];
857
+ if (error !=nil ) {
858
+ NSLog (@" Error in parsing:%@ :%@ " , schemePath, error);
859
+ abort ();
860
+ }
861
+
862
+ NSArray *buildActionNodes = [docnodesForXPath: @" //BuildAction" error: &error];
863
+ NSAssert (error ==nil ,@" Failed to get BuildAction node:%@ " , [errorlocalizedFailureReason ]);
864
+ NSAssert ([buildActionNodescount ] ==1 ,@" Should have only one BuildAction node" );
865
+ NSXMLElement *buildActionNode = buildActionNodes[0 ];
866
+
867
+ self.parallelizeBuildables =
868
+ [[[buildActionNodeattributeForName: @" parallelizeBuildables" ]stringValue ]isEqualToString: @" YES" ];
869
+ self.buildImplicitDependencies =
870
+ [[[buildActionNodeattributeForName: @" buildImplicitDependencies" ]stringValue ]isEqualToString: @" YES" ];
871
+ }
872
+
774
873
- (void )populate
775
874
{
776
875
if (_didPopulate) {
@@ -798,64 +897,19 @@ - (void)populate
798
897
NSString *matchingSchemePath =nil ;
799
898
800
899
if (self.subjectWorkspace ) {
801
- NSArray *schemePaths = [XcodeSubjectInfoschemePathsInWorkspace: self .subjectWorkspace];
802
- for (NSString *schemePath in schemePaths) {
803
- if ([schemePathhasSuffix: [NSString stringWithFormat: @" /%@ .xcscheme" ,self .subjectScheme]]) {
804
- matchingSchemePath = schemePath;
805
- }
806
- }
807
-
808
- NSArray *testables = [[self class ]testablesInSchemePath: matchingSchemePath
809
- basePath: BasePathFromSchemePath (matchingSchemePath)];
810
- NSArray *buildables = [[self class ]buildablesInSchemePath: matchingSchemePath
811
- basePath: BasePathFromSchemePath (matchingSchemePath)];
812
-
813
-
814
- // It's possible that the scheme references projects that aren't part of the workspace. When
815
- // Xcode encounters these, it just skips them so we'll do the same.
816
- NSSet *projectPathsInWorkspace = [NSSet setWithArray: [XcodeSubjectInfoprojectPathsInWorkspace: self .subjectWorkspace]];
817
- BOOL (^workspaceContainsProject)(id ) = ^(id item) {
818
- return [projectPathsInWorkspacecontainsObject: [itemobjectForKey: @" projectPath" ]];
819
- };
820
-
821
- self.testables = [testablesobjectsAtIndexes:
822
- [testablesindexesOfObjectsPassingTest:
823
- ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
824
- return workspaceContainsProject (obj);
825
- }]];
826
-
827
- self.buildables = [buildablesobjectsAtIndexes:
828
- [buildablesindexesOfObjectsPassingTest:
829
- ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
830
- return workspaceContainsProject (obj);
831
- }]];
832
-
833
- self.buildablesForTest = [buildablesobjectsAtIndexes:
834
- [buildablesindexesOfObjectsPassingTest:
835
- ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
836
- return (workspaceContainsProject (obj) &&
837
- [[objobjectForKey: @" forTesting" ]boolValue ]);
838
- }]];
900
+ matchingSchemePath = [self matchingSchemePathForWorkspace ];
839
901
}else {
840
- NSArray *schemePaths = [XcodeSubjectInfoschemePathsInContainer: self .subjectProject];
841
- for (NSString *schemePath in schemePaths) {
842
- if ([schemePathhasSuffix: [NSString stringWithFormat: @" /%@ .xcscheme" ,self .subjectScheme]]) {
843
- matchingSchemePath = schemePath;
844
- }
845
- }
846
-
847
- self.testables = [[self class ]testablesInSchemePath: matchingSchemePath
848
- basePath: BasePathFromSchemePath (matchingSchemePath)];
902
+ matchingSchemePath = [self matchingSchemePathForProject ];
903
+ }
849
904
850
- NSArray *buildables = [[self class ]buildablesInSchemePath: matchingSchemePath
851
- basePath: BasePathFromSchemePath (matchingSchemePath)];
852
- self.buildablesForTest = [buildablesobjectsAtIndexes:
853
- [buildablesindexesOfObjectsPassingTest:
854
- ^BOOL (id obj,NSUInteger idx,BOOL *stop) {
855
- return [[objobjectForKey: @" forTesting" ]boolValue ];
856
- }]];
905
+ if (self.subjectWorkspace ) {
906
+ [self populateBuildablesAndTestablesForWorkspaceWithSchemePath: matchingSchemePath];
907
+ }else {
908
+ [self populateBuildablesAndTestablesForProjectWithSchemePath: matchingSchemePath];
857
909
}
858
910
911
+ [self populateBuildActionPropertiesWithSchemePath: matchingSchemePath];
912
+
859
913
_configurationNameByAction =
860
914
[BuildConfigurationsByActionForSchemePath (matchingSchemePath)retain ];
861
915
@@ -909,6 +963,18 @@ - (NSArray *)buildables
909
963
return _buildables;
910
964
}
911
965
966
+ - (BOOL )parallelizeBuildables
967
+ {
968
+ [self populate ];
969
+ return _parallelizeBuildables;
970
+ }
971
+
972
+ - (BOOL )buildImplicitDependencies
973
+ {
974
+ [self populate ];
975
+ return _buildImplicitDependencies;
976
+ }
977
+
912
978
- (NSArray *)testablesAndBuildablesForTest
913
979
{
914
980
[self populate ];