Skip to content

Commit

Permalink
Fix: Prefix header or bridging header has incorrect path when a proje…
Browse files Browse the repository at this point in the history
…ct contains `group_name`

* Note:
> Bug: the path relatives to xcode project instead of source path
  • Loading branch information
Vu Le Hoang committed Feb 23, 2022
1 parent 14ea8de commit cd6a5cb
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1628,9 +1628,10 @@ && shouldEmbedSwiftRuntimeInBundleTarget(bundle)
}

// -- configurations
String srcRoot = projectFilesystem.getRootPath().normalize().toString();
extraSettingsBuilder
.put("TARGET_NAME", buildTargetName)
.put("SRCROOT", pathRelativizer.outputPathToBuildTargetPath(buildTarget).toString());
.put("SRCROOT", srcRoot);
if ((productType == ProductTypes.UI_TEST || productType == ProductTypes.UNIT_TEST) && isFocusedOnTarget) {
if (bundleLoaderNode.isPresent()) {
BuildTarget testTarget = bundleLoaderNode.get().getBuildTarget();
Expand Down Expand Up @@ -1719,12 +1720,10 @@ && shouldEmbedSwiftRuntimeInBundleTarget(bundle)
extraSettingsBuilder.put("INFOPLIST_FILE", infoPlistPath.toString());
}
if (arg.getBridgingHeader().isPresent()) {
Path bridgingHeaderPath =
pathRelativizer.outputDirToRootRelative(
resolveSourcePath(arg.getBridgingHeader().get()).getPath());
String bridgingHeaderPath = resolveSourcePath(arg.getBridgingHeader().get()).toString();
extraSettingsBuilder.put(
"SWIFT_OBJC_BRIDGING_HEADER",
Joiner.on('/').join("$(SRCROOT)", bridgingHeaderPath.toString()));
Joiner.on('/').join("$(SRCROOT)", bridgingHeaderPath));
}

swiftVersion.ifPresent(s -> extraSettingsBuilder.put("SWIFT_VERSION", s));
Expand Down Expand Up @@ -1755,9 +1754,7 @@ && shouldEmbedSwiftRuntimeInBundleTarget(bundle)
getPrefixHeaderSourcePath(targetNode.getConstructorArg());
if (prefixHeaderOptional.isPresent()) {
RelPath prefixHeaderRelative = resolveSourcePath(prefixHeaderOptional.get());
Path prefixHeaderPath =
pathRelativizer.outputDirToRootRelative(prefixHeaderRelative.getPath());
extraSettingsBuilder.put("GCC_PREFIX_HEADER", prefixHeaderPath.toString());
extraSettingsBuilder.put("GCC_PREFIX_HEADER", Joiner.on('/').join("$(SRCROOT)", prefixHeaderRelative.toString()));
extraSettingsBuilder.put("GCC_PRECOMPILE_PREFIX_HEADER", "YES");
}

Expand Down

0 comments on commit cd6a5cb

Please sign in to comment.