function BuildFromProject()

in BuildTools/djsbuildfile.js [36:70]


function BuildFromProject(path, outBasePath) {
    // Read the csproj.
    WScript.Echo("Reading project " + path);
    var xml = new ActiveXObject("Msxml2.DOMDocument.6.0");
    xml.load(path);
    xml.setProperty("SelectionNamespaces", "xmlns:msb='http://schemas.microsoft.com/developer/msbuild/2003'");
    xml.setProperty("SelectionLanguage", "XPath");

    var files = xml.selectNodes("//msb:ItemGroup/*[not(self::msb:Reference)]/@Include");
    var fileIncludes = {};
    var i, len, filePath;

    // Get file dependencies.
    for (i = 0, len = files.length; i < len; i++) {
        filePath = PathCombine(PathGetDirectory(path), files[i].value);
        if (FileExists(filePath)) {
            var includes = GetFileIncludes(filePath);
            var j, includeLen;
            for (j = 0, includeLen = includes.length; j < includeLen; j++) {
                fileIncludes[includes[j]] = {};
            }
        } else if (!FolderExists(filePath)) {
            throw { message: "path doesn't exist " + filePath };
        }
    }

    // Build the files that are not in the dependency list.
    for (i = 0, len = files.length; i < len; i++) {
        filePath = PathCombine(PathGetDirectory(path), files[i].value);
        var outputPath = PathCombine(outBasePath, files[i].value);
        if (!fileIncludes[filePath] && !FolderExists(filePath)) {
            BuildFile(filePath, outputPath);
        }
    }
}