aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs
blob: fbab6d0b11dc2eac84e1367148739f75391b0dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Project {
    property var sdks: {}

    Product {
        Depends { name: "xcode" }

        consoleApplication: {
            console.info("Developer directory: " + xcode.developerPath);
            console.info("SDK: " + xcode.sdk);
            console.info("Target devices: " + xcode.targetDevices.join(", "));
            console.info("SDK name: " + xcode.sdkName);
            console.info("SDK version: " + xcode.sdkVersion);
            console.info("Latest SDK name: " + xcode.latestSdkName);
            console.info("Latest SDK version: " + xcode.latestSdkVersion);
            console.info("Available SDK names: " + xcode.availableSdkNames.join(", "));
            console.info("Available SDK versions: " + xcode.availableSdkVersions.join(", "));

            var targetOsToKey = function(targetOS) {
                if (targetOS.contains("ios"))
                    return "iphoneos";
                if (targetOS.contains("ios-simulator"))
                    return "iphonesimulator";
                if (targetOS.contains("macos"))
                    return "macosx";
                if (targetOS.contains("tvos"))
                    return "appletvos";
                if (targetOS.contains("tvos-simulator"))
                    return "appletvsimulator";
                if (targetOS.contains("watchos"))
                    return "watchos";
                if (targetOS.contains("watchos-simulator"))
                    return "watchossimulator";
                throw "Unsupported OS" + targetOS;
            }

            var actualList = project.sdks[targetOsToKey(qbs.targetOS)];
            console.info("Actual SDK list: " + actualList.join(", "));

            var msg = "Unexpected SDK list [" + xcode.availableSdkVersions.join(", ") + "]";
            var testArraysEqual = function(a, b) {
                if (!a || !b || a.length !== b.length) {
                    throw msg;
                }

                for (var i = 0; i < a.length; ++i) {
                    if (a[i] !== b[i]) {
                        throw msg;
                    }
                }
            }

            testArraysEqual(actualList, xcode.availableSdkVersions);
        }
    }
}