MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
514 stars 81 forks source link

Set `explicitFileType` for bazel and bzl extensions #2928

Closed andre-alves closed 5 months ago

andre-alves commented 5 months ago

BUILD.bazel and .bzl files are not being recognized as a text.script.python in Xcode when using the incremental generator.

Replacing lastKnownFileType with explicitFileType for these extensions fixed the issue.

Before After
image image
brentleyjones commented 5 months ago

Similar to @mattrobmattrob's question, maybe we change it up a bit:

let impliedExtension = ext ?? Xcode.impliedExtension(basename: name)
let fileTypeType = calculateFileTypeType(basename: name, extension: impliedExtension)
let fileType = Xcode.pbxProjEscapedFileType(extension: impliedExtension) ?? "file"

Xcode.impliedExtension would turn BUILD and Podfile into bazel and rb. calculateFileTypeType would turn bazel and bzl extensions or Podfile basename into "explicitFileType" otherwise "implicitFileType".

Thoughts?