Esempio n. 1
0
File: sdcc.js Progetto: qt-labs/qbs
function dumpDefaultPaths(compilerFilePath, architecture) {
    var args = [ "--print-search-dirs" ];

    var targetFlag = targetArchitectureFlag(architecture);
    if (targetFlag)
        args.push(targetFlag);

    var p = new Process();
    p.exec(compilerFilePath, args, true);
    var includePaths = [];
    var addIncludePaths = false;
    var lines = p.readStdOut().trim().split(/\r?\n/g);
    for (var i in lines) {
        var line = lines[i];
        if (line.startsWith("includedir:")) {
            addIncludePaths = true;
        } else if (line.startsWith("programs:")
                    || line.startsWith("datadir:")
                    || line.startsWith("libdir:")
                    || line.startsWith("libpath:")) {
            addIncludePaths = false;
        } else if (addIncludePaths) {
            includePaths.push(line);
        }
    }

    return {
        "includePaths": includePaths
    }
}
Esempio n. 2
0
File: utils.js Progetto: qt-labs/qbs
 BlackboxOutputArtifactTracker.prototype.artifacts = function (outputDirectory) {
     var process;
     var fakeOutputDirectory;
     try {
         fakeOutputDirectory = new TemporaryDir();
         if (!fakeOutputDirectory.isValid())
             throw "could not create temporary directory";
         process = new Process();
         if (this.commandEnvironmentFunction) {
             var env = this.commandEnvironmentFunction(fakeOutputDirectory.path());
             for (var key in env)
                 process.setEnv(key, env[key]);
         }
         process.exec(this.command, this.commandArgsFunction(fakeOutputDirectory.path()), true);
         var artifacts = [];
         if (this.fileTaggers) {
             var files = this.findFiles(fakeOutputDirectory.path());
             for (var i = 0; i < files.length; ++i)
                 artifacts.push(this.createArtifact(fakeOutputDirectory.path(), files[i]));
         }
         if (this.processStdOutFunction)
             artifacts = artifacts.concat(this.processStdOutFunction(process.readStdOut()));
         artifacts = this.fixArtifactPaths(artifacts, outputDirectory, fakeOutputDirectory.path());
         return artifacts;
     }
     finally {
         if (process)
             process.close();
         if (fakeOutputDirectory)
             fakeOutputDirectory.remove();
     }
 };
Esempio n. 3
0
File: ib.js Progetto: qt-labs/qbs
function ibtoolVersion(ibtool) {
    var process;
    var version;
    try {
        process = new Process();
        if (process.exec(ibtool, ["--version", "--output-format", "xml1"], true) !== 0)
            console.error(process.readStdErr());

        var propertyList = new PropertyList();
        try {
            propertyList.readFromString(process.readStdOut());

            var plist = propertyList.toObject();
            if (plist)
                plist = plist["com.apple.ibtool.version"];
            if (plist)
                version = plist["short-bundle-version"];
        } finally {
            propertyList.clear();
        }
    } finally {
        process.close();
    }
    return version;
}
Esempio n. 4
0
function createDebugKeyStoreCommandString(keytoolFilePath, keystoreFilePath) {
    var args = ["-genkey", "-keystore", keystoreFilePath, "-alias", "androiddebugkey",
                "-storepass", "android", "-keypass", "android", "-keyalg", "RSA",
                "-keysize", "2048", "-validity", "10000", "-dname",
                "CN=Android Debug,O=Android,C=US"];
    return Process.shellQuote(keytoolFilePath, args);
}
Esempio n. 5
0
File: sdcc.js Progetto: qt-labs/qbs
function dumpMacros(compilerFilePath, architecture) {
    var tempDir = new TemporaryDir();
    var fakeIn = new TextFile(tempDir.path() + "/empty-source.c", TextFile.WriteOnly);
    var args = [ fakeIn.filePath(), "-dM", "-E" ];

    var targetFlag = targetArchitectureFlag(architecture);
    if (targetFlag)
        args.push(targetFlag);

    var p = new Process();
    p.exec(compilerFilePath, args, true);
    var map = {};
    p.readStdOut().trim().split(/\r?\n/g).map(function (line) {
        var parts = line.split(" ", 3);
        map[parts[1]] = parts[2];
    });
    return map;
}
Esempio n. 6
0
function scanQrc(qrcFilePath) {
    var absInputDir = FileInfo.path(qrcFilePath);
    var result = [];
    var process = new Process();
    try {
        var rcc = FileInfo.joinPaths(product.Qt.core.binPath, 'rcc' + product.cpp.executableSuffix);
        var exitCode = process.exec(rcc, ["--list", qrcFilePath], true);
        for (;;) {
            var line = process.readLine();
            if (!line)
                break;
            line = line.trim();
            line = FileInfo.relativePath(absInputDir, line);
            result.push(line);
        }
    } finally {
        process.close();
    }
    return result;
}
Esempio n. 7
0
    PropertyList2.prototype.readFromFile = function (filePath) {
        var str;
        var process = new Process();
        try {
            if (process.exec("plutil", ["-convert", "json", "-o", "-", filePath], false) === 0) {
                str = process.readStdOut();
            } else {
                var tf = new TextFile(filePath);
                try {
                    str = tf.readAll();
                } finally {
                    tf.close();
                }
            }
        } finally {
            process.close();
        }

        if (str)
            this.obj = JSON.parse(str);
    };