Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: test/mac/type_envvars/test_check_sdkroot.sh

Issue 82763006: Fix gyptest-type-envvars.py for Xcode 5.0.0 (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Improve comment of xcodeversion fn and add space around | Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/mac/type_envvars/test_check_sdkroot.sh
diff --git a/test/mac/type_envvars/test_check_sdkroot.sh b/test/mac/type_envvars/test_check_sdkroot.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1297dbeff11bbbeea9296d24621d529d1823f3bc
--- /dev/null
+++ b/test/mac/type_envvars/test_check_sdkroot.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# Copyright (c) 2014 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+
+# `xcodebuild -version` output looks like
+# Xcode 4.6.3
+# Build version 4H1503
+# or like
+# Xcode 4.2
+# Build version 4C199
+# or like
+# Xcode 3.2.6
+# Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
+# BuildVersion: 10M2518
+# Convert that to '0463', '0420' and '0326' respectively.
+function xcodeversion() {
+ xcodebuild -version | awk '/Xcode ([0-9]+\.[0-9]+(\.[0-9]+)?)/ {
+ version = $2
+ gsub(/\./, "", version)
+ if (length(version) < 3) {
+ version = version "0"
+ }
+ if (length(version) < 4) {
+ version = "0" version
+ }
+ }
+ END { print version }'
+}
+
+# Returns true if |string1| is smaller than |string2|.
+# This function assumes that both strings represent Xcode version numbers
+# as returned by |xcodeversion|.
+function smaller() {
+ local min="$(echo -ne "${1}\n${2}\n" | sort -n | head -n1)"
+ test "${min}" != "${2}"
+}
+
+if [[ "$(xcodeversion)" < "0500" ]]; then
+ # Xcode version is older than 5.0, check that SDKROOT is set but empty.
+ [[ -z "${SDKROOT}" && -z "${SDKROOT-_}" ]]
+else
+ # Xcode version is newer than 5.0, check that SDKROOT is set.
+ [[ "${SDKROOT}" == "$(xcodebuild -version -sdk '' Path)" ]]
+fi
« no previous file with comments | « test/mac/type_envvars/test_bundle_shared_library.sh ('k') | test/mac/type_envvars/test_nonbundle_executable.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698