Skip to content

Commit

Permalink
Revert "Collect only selected Xcode as the user environment"
Browse files Browse the repository at this point in the history
This reverts commit 0cdee4c.
  • Loading branch information
terrakok committed Oct 10, 2023
1 parent 581e1d3 commit 98036af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class XcodeDiagnostic(private val system: System) : Diagnostic() {
result.addSuccess(
"${xcode.name} (${xcode.version})\nLocation: ${xcode.location}"
)
result.addEnvironment(EnvironmentPiece.Xcode(xcode.version))
}

val xcrun = system.execute("xcrun", "cc").output
Expand All @@ -45,16 +46,13 @@ class XcodeDiagnostic(private val system: System) : Diagnostic() {
if (xcodeInstallations.isNotEmpty()) {
val tools = system.execute("xcode-select", "-p").output
if (tools != null) {
val selectedXcode = xcodeInstallations.firstOrNull { tools.startsWith(it.location!!) }
if (selectedXcode == null) {
if (xcodeInstallations.none { tools.startsWith(it.location!!) }) {
result.addFailure(
"Current command line tools: $tools",
"You have to select command line tools bundled to Xcode",
"Command line tools can be configured in Xcode -> Settings -> Locations -> Locations"
)
} else {
//Only selected Xcode matters for environment checks
result.addEnvironment(EnvironmentPiece.Xcode(selectedXcode.version))
if (xcodeInstallations.size > 1) {
result.addSuccess("Current command line tools: $tools")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,19 @@ class XcodeDiagnosticTest {
"Xcode (11.1)",
"Location: /Applications/Xcode.app",
)
addEnvironment(
EnvironmentPiece.Xcode(Version("11.1"))
)
addSuccess(
"Xcode Beta (22.2)",
"Location: /Applications/XcodeBeta.app",
)
addEnvironment(
EnvironmentPiece.Xcode(Version("22.2"))
)
addSuccess(
"Current command line tools: /Applications/Xcode.app/Contents/Developer",
)
addEnvironment(
EnvironmentPiece.Xcode(Version("11.1"))
)
addInfo(
"Xcode JAVA_HOME: /Users/my/.sdkman/candidates/java/current",
"Xcode JAVA_HOME can be configured in Xcode -> Settings -> Locations -> Custom Paths"
Expand Down Expand Up @@ -208,6 +211,9 @@ class XcodeDiagnosticTest {
"Xcode (13.4.1)",
"Location: /Applications/Xcode.app",
)
addEnvironment(
EnvironmentPiece.Xcode(Version("13.4.1"))
)
addFailure(
"Current command line tools: $cltPath",
"You have to select command line tools bundled to Xcode",
Expand Down Expand Up @@ -240,6 +246,9 @@ class XcodeDiagnosticTest {
"Xcode (13.4.1)",
"Location: /Applications/Xcode.app",
)
addEnvironment(
EnvironmentPiece.Xcode(Version("13.4.1"))
)
addFailure(
"Command line tools are not configured",
"Command line tools can be configured in Xcode -> Settings -> Locations -> Locations"
Expand Down

0 comments on commit 98036af

Please sign in to comment.