Skip to content

Commit

Permalink
Merge pull request #164 from polac24/20220831-optional-public-headers…
Browse files Browse the repository at this point in the history
…-folder

Make PUBLIC_HEADERS_FOLDER_PATH ENV optional
  • Loading branch information
polac24 authored Nov 24, 2022
2 parents de066f2 + b1507b6 commit b439674
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ extension PostbuildContext {
/// Note: The file has yaml extension, even it is in the json format
overlayHeadersPath = targetTempDir.appendingPathComponent("all-product-headers.yaml")
irrelevantDependenciesPaths = config.irrelevantDependenciesPaths
let publicHeadersPath: String = try env.readEnv(key: "PUBLIC_HEADERS_FOLDER_PATH")
if publicHeadersPath != "/usr/local/include" {
let publicHeadersPathEnv: String? = env.readEnv(key: "PUBLIC_HEADERS_FOLDER_PATH")
if let publicHeadersPath = publicHeadersPathEnv, publicHeadersPathEnv != "/usr/local/include" {
// '/usr/local/include' is a value of PUBLIC_HEADERS_FOLDER_PATH when no public headers are automatically
// generated and it is up to a project configuration to place it in a common location (e.g. static library)
publicHeadersFolderPath = builtProductsDir.appendingPathComponent(publicHeadersPath)
Expand Down
9 changes: 9 additions & 0 deletions Tests/XCRemoteCacheTests/Commands/PostbuildContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,13 @@ class PostbuildContextTests: FileXCTestCase {

XCTAssertEqual(context.publicHeadersFolderPath, "/MyBuiltProductsDir/MyModule.grameworks/Headers")
}

func testPublicHeaderFolderPathEnvIsOptional() throws {
var envs = Self.SampleEnvs
envs.removeValue(forKey: "PUBLIC_HEADERS_FOLDER_PATH")

let context = try PostbuildContext(config, env: envs)

XCTAssertNil(context.publicHeadersFolderPath)
}
}

0 comments on commit b439674

Please sign in to comment.