Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fix broken external BuildLabel filename parsing (#257)
Browse files Browse the repository at this point in the history
External BuildLabels were keeping their // halfway through their path, leading to projects xcode would refuse to load.

As an example: @google_toolbox_for_mac//Foundation:BUILD was going to external//Foundation/BUILD, not external/Foundation/BUILD.
This lead the pbjproj to assign the file the path //Foundation/BUILD, which Xcode refuses to load, along with groups named '/' and the omission of other associated source files.
  • Loading branch information
cpsauer authored Sep 10, 2021
1 parent 09a015c commit 00a73c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TulsiGenerator/BuildLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public class BuildLabel: Comparable, Equatable, Hashable, CustomStringConvertibl
// Fix for external and local_repository, which may be referenced by Bazel via
// @repository//subpath while we internally refer to them via external/repository/subpath.
if package.starts(with: "@") {
package = "external/" + package.suffix(from: package.index(package.startIndex, offsetBy: 1))
package = "external/" +
package.suffix(from: package.index(package.startIndex, offsetBy: 1)) // Munch @ prefix
.replacingOccurrences(of: "//", with: "/") // Fixup //. Xcode can't handle paths like that.
}
return "\(package)/\(target)"
}()
Expand Down

0 comments on commit 00a73c9

Please sign in to comment.