Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filegroups that subsume sources work again #133

Merged
merged 1 commit into from
Nov 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
26 changes: 23 additions & 3 deletions Fixtures/TestProject/Project.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
BF1744565901 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR6218091901 /* ViewController.swift */; settings = {COMPILER_FLAGS = "-Werror"; }; };
BF2018435801 /* Framework_iOS.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FR4722960401 /* Framework_iOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BF2250910101 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG2043127501 /* Main.storyboard */; };
BF2301913502 /* MoreUnder.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR8488480101 /* MoreUnder.swift */; };
BF2445564001 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG2858723001 /* LaunchScreen.storyboard */; };
BF2513089601 /* LocalizedStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG3182922801 /* LocalizedStoryboard.storyboard */; };
BF2535278401 = {isa = PBXBuildFile; fileRef = FR4387045301 /* Framework_watchOS.framework */; };
Expand Down Expand Up @@ -96,6 +97,7 @@
FR7831228901 /* App_iOS_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = xctest; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = App_iOS_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FR8182352201 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LocalizedStoryboard.strings; sourceTree = "<group>"; };
FR8252321101 /* App_iOS.app */ = {isa = PBXFileReference; explicitFileType = app; includeInIndex = 0; lastKnownFileType = wrapper.application; path = App_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
FR8488480101 /* MoreUnder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreUnder.swift; sourceTree = "<group>"; };
FR9612050601 /* Base */ = {isa = PBXFileReference; name = Base; path = Base.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
FR9612050602 /* en */ = {isa = PBXFileReference; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -165,6 +167,25 @@
path = Carthage/Build;
sourceTree = "<group>";
};
G32346300301 /* FileGroup */ = {
isa = PBXGroup;
children = (
G41880875201 /* UnderFileGroup */,
);
name = FileGroup;
path = FileGroup;
sourceTree = "<group>";
};
G41880875201 /* UnderFileGroup */ = {
isa = PBXGroup;
children = (
FR8488480101 /* MoreUnder.swift */,
FR8488480101 /* MoreUnder.swift */,
);
name = UnderFileGroup;
path = UnderFileGroup;
sourceTree = "<group>";
};
G46615002701 /* Framework */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -271,13 +292,11 @@
isa = PBXGroup;
children = (
G83406189501 /* Configs */,
G32346300301 /* FileGroup */,
G82523211001 /* App_iOS */,
G66512504301 /* StandaloneFiles */,
G78312289901 /* App_iOS_Tests */,
G46615002701 /* Framework */,
G46615002701 /* Framework */,
G46615002701 /* Framework */,
G46615002701 /* Framework */,
G86202385201 /* Products */,
G19527407101 /* Frameworks */,
);
Expand Down Expand Up @@ -655,6 +674,7 @@
buildActionMask = 2147483647;
files = (
BF1073850101 /* AppDelegate.swift in Sources */,
BF2301913502 /* MoreUnder.swift in Sources */,
BF1628293501 /* Standalone.swift in Sources */,
BF1744565901 /* ViewController.swift in Sources */,
);
Expand Down
2 changes: 2 additions & 0 deletions Fixtures/TestProject/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ options:
bundleIdPrefix: com.project
fileGroups:
- Configs
- FileGroup
configFiles:
Test Debug: Configs/config.xcconfig
targets:
Expand All @@ -15,6 +16,7 @@ targets:
compilerFlags:
- "-Werror"
- path: StandaloneFiles/Standalone.swift
- FileGroup/UnderFileGroup
settings:
PRODUCT_BUNDLE_IDENTIFIER: com.project$(BUNDLE_ID_SUFFIX)
INFOPLIST_FILE: App_iOS/Info.plist
Expand Down
9 changes: 5 additions & 4 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ public class PBXProjGenerator {
)
addObject(group)
groupsByPath[path] = group

if depth == 0 {
topLevelGroups.append(group)
}
}
return group
}
Expand Down Expand Up @@ -556,7 +560,7 @@ public class PBXProjGenerator {
}
return variantGroup
}

func getSources(sourceMetadata source: Source, path: Path, depth: Int = 0) throws -> (sourceFiles: [SourceFile], groups: [PBXGroup]) {
// if we have a file, move it to children and use the parent as the path
let (children, path) = path.isFile ?
Expand Down Expand Up @@ -640,9 +644,6 @@ public class PBXProjGenerator {
group = getSingleGroup(path: path, mergingChildren: groupChildren, depth: depth)
}

if depth == 0 {
topLevelGroups.append(group)
}
groups.insert(group, at: 0)
return (allSourceFiles, groups)
}
Expand Down