mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Merge pull request #365 from brentleyjones/static-library-headers
Automatically copy public headers for static libraries
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
- Changed default group sorting to be after files [356](https://github.com/yonaskolb/XcodeGen/pull/356) @yonaskolb
|
||||
- Moved `Frameworks` and `Products` top level groups to bottom [356](https://github.com/yonaskolb/XcodeGen/pull/356) @yonaskolb
|
||||
- `modulemap` files are automatically copied to the products directory for static library targets [346](https://github.com/yonaskolb/XcodeGen/pull/346) @brentleyjones
|
||||
- Public header files are automatically copied to the products directory for static library targets [365](https://github.com/yonaskolb/XcodeGen/pull/365) @brentleyjones
|
||||
|
||||
#### Internal
|
||||
- Moved brew formula to homebrew core
|
||||
|
||||
@@ -55,7 +55,9 @@ class SourceGenerator {
|
||||
func generateSourceFile(targetType: PBXProductType, targetSource: TargetSource, path: Path, buildPhase: TargetSource.BuildPhase? = nil) -> SourceFile {
|
||||
let fileReference = fileReferencesByPath[path.string.lowercased()]!
|
||||
var settings: [String: Any] = [:]
|
||||
let chosenBuildPhase: TargetSource.BuildPhase?
|
||||
var chosenBuildPhase: TargetSource.BuildPhase?
|
||||
|
||||
let headerVisibility = targetSource.headerVisibility ?? .public
|
||||
|
||||
if let buildPhase = buildPhase {
|
||||
chosenBuildPhase = buildPhase
|
||||
@@ -64,9 +66,21 @@ class SourceGenerator {
|
||||
} else {
|
||||
chosenBuildPhase = getDefaultBuildPhase(for: path, targetType: targetType)
|
||||
}
|
||||
|
||||
if chosenBuildPhase == .headers && targetType == .staticLibrary {
|
||||
// Static libraries don't support the header build phase
|
||||
// For public headers they need to be copied
|
||||
if headerVisibility == .public {
|
||||
chosenBuildPhase = .copyFiles(TargetSource.BuildPhase.CopyFilesSettings(
|
||||
destination: .productsDirectory,
|
||||
subpath: "include/$(PRODUCT_NAME)"
|
||||
))
|
||||
} else {
|
||||
chosenBuildPhase = nil
|
||||
}
|
||||
}
|
||||
|
||||
if chosenBuildPhase == .headers {
|
||||
let headerVisibility = targetSource.headerVisibility ?? .public
|
||||
if headerVisibility != .project {
|
||||
// Xcode doesn't write the default of project
|
||||
settings["ATTRIBUTES"] = [headerVisibility.settingName]
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
BF_538515166673 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG_256263906698 /* LaunchScreen.storyboard */; };
|
||||
BF_561304997165 /* Standalone.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR_675266829517 /* Standalone.swift */; };
|
||||
BF_563614389392 = {isa = PBXBuildFile; fileRef = FR_618687462494 /* iMessageExtension.appex */; };
|
||||
BF_607543323797 = {isa = PBXBuildFile; fileRef = FR_698230898030 /* StaticLibrary_ObjC.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
BF_607543323797 /* StaticLibrary_ObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = FR_698230898030 /* StaticLibrary_ObjC.h */; };
|
||||
BF_612351978356 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG_264279911176 /* Interface.storyboard */; };
|
||||
BF_624802436672 /* FrameworkFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR_172952167809 /* FrameworkFile.swift */; };
|
||||
BF_632297340262 /* StaticLibrary_ObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = "FR_698230898030-1" /* StaticLibrary_ObjC.m */; };
|
||||
@@ -214,6 +214,7 @@
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
BF_607543323797 /* StaticLibrary_ObjC.h in CopyFiles */,
|
||||
BF_755064703081 /* module.modulemap in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
Reference in New Issue
Block a user