BuildTool: Fix xcodebuild: error: SDK macosx26 cannot be located.#1260
BuildTool: Fix xcodebuild: error: SDK macosx26 cannot be located.#1260joshtynjala wants to merge 1 commit intoHaxeFoundation:masterfrom
Conversation
tools/hxcpp/BuildTool.hx
Outdated
| var minor_best = Std.parseFloat(split_best[1]); | ||
| if (major_ver == major_best && Math.isNaN(minor_best)) | ||
| best = ver; | ||
| else if (major_ver > major_best || minor_ver > minor_best) |
There was a problem hiding this comment.
Couldn't these two branches here be combined?
There was a problem hiding this comment.
Technically, yes, but it felt like too much complexity for a single if condition. Separating them made them feel easier to understand.
There was a problem hiding this comment.
Wouldn't the logic be simpler if incomplete version numbers are just ignored altogether, since it will always lead to an invalid MACOSX_VER value?
.e.g
if (Math.isNan(major_ver) || Math.isNan(minor_ver))
continue;Also it seems the second condition would be more correct if it was major_ver > major_best || (major_ver == major_best && minor_ver > minor_best).
There was a problem hiding this comment.
Sure, that makes sense to me. I think maybe I was trying to support MacOSX26.sdk as a valid fallback if there's some strange situation where MacOSX26.0.sdk didn't exist. However, maybe that wouldn't ever happen.
My SDKs directory contains three entries: MacOSX.sdk MacOSX26.0.sdk MacOSX26.sdk The current SDK version detection in hxcpp is preferring MacOSX26.sdk over MacOSX26.0.sdk. This is causing MACOSX_VER to be set to 26. However, xcodebuild seems to want both major and minor parts of the version to be specified, so MACOSX_VER should be set to 26.0 instead. This change checks if the current best's minor version is parsed as NaN when the major versions match, which results in a real float value for the minor version to be preferred.
ceb6914 to
87013f2
Compare
My SDKs directory contains three entries:
The current SDK version detection in hxcpp is preferring MacOSX26.sdk over MacOSX26.0.sdk. This is causing
MACOSX_VERto be set to26. However, xcodebuild seems to want both major and minor parts of the version to be specified, soMACOSX_VERshould be set to26.0instead.This change checks if the current best's minor version is parsed as
NaNwhen the major versions match, which results in a real float value for the minor version to be preferred.