Remove Jake

This commit is contained in:
Axel Isouard 2017-02-11 10:26:26 +01:00
parent 25345ad1a7
commit 28034f95c8
No known key found for this signature in database
GPG key ID: 4E64BB3EAAF31C29
6 changed files with 1 additions and 238 deletions

View file

@ -1,4 +0,0 @@
'use strict';
desc('Default task');
task('default', ['fetch:precompiled'], function () {});

View file

@ -1,86 +0,0 @@
'use strict';
var os = require('os');
var fs = require('fs-extra');
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
namespace('build', function () {
task('generate', {async: true}, function () {
var opts = 'use_gold=false is_debug=false rtc_include_tests=false';
var pathSep = (os.platform() === 'win32') ? '\\' : '/';
var envSep = (os.platform() === 'win32') ? ';' : ':';
if (os.platform() === 'win32') {
process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = 0;
process.env.PATH = process.cwd() + '/Dependencies/depot_tools;' + process.env.PATH;
process.env.PATH = process.cwd() + '/Dependencies/depot_tools/python276_bin;' + process.env.PATH;
} else {
process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH;
}
console.log('Generating WebRTC build files...' + 'gn gen out/Default --args=\'' + opts + '\'');
process.chdir('src');
exec('gn gen out/Default --args="' + opts + '"', function (error, stdout, stderr) {
complete();
});
});
task('ninja', ['build:generate'], {async: true}, function () {
var packages = 'libjingle_peerconnection field_trial_default metrics_default';
console.log('Building WebRTC...');
jake.exec('ninja -C out/Default ' + packages, { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('merge', ['build:ninja'], {async: true}, function () {
var prefix = os.platform() !== 'win32' ? 'lib' : '';
var suffix = os.platform() === 'win32' ? '.lib' : '.a';
var path = '../lib/' + prefix + 'webrtc' + suffix;
console.log('Merging libraries...');
if (!fs.existsSync('../lib')) {
fs.mkdir('../lib');
}
if (os.platform() === 'win32') {
var output = execSync('python chromium/src/build/vs_toolchain.py get_toolchain_dir', { encoding: 'utf-8' });
var matches = output.match(/vs_path = \"(.*)\"/);
console.log(matches);
process.env.PATH = matches[1] + '\\VC\\bin' + ';' + process.env.PATH;
}
jake.exec('python webrtc/build/merge_libs.py out/Default ' + path, { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('include', ['build:merge'], function () {
var fileList = new jake.FileList();
var files;
console.log('Copying include files...');
if (!fs.existsSync('../include')) {
fs.mkdir('../include');
}
fileList.include('webrtc/**/*.h');
files = fileList.toArray();
for (var file in files) {
fs.copySync(files[file], '../include/' + files[file]);
}
});
task('default', [
'generate',
'ninja',
'merge',
'include'
], function () {});
});

View file

@ -1,22 +0,0 @@
'use strict';
var os = require('os');
var pkg = require('../package.json');
function getPackageName() {
var version = pkg.version;
var platform = os.platform();
var arch = os.arch();
var nodever = process.version;
var suffix = (platform === 'win32') ? '.zip' : '.tar.gz';
return pkg.config.filename
.replace('{VERSION}', version)
.replace('{PLATFORM}', platform)
.replace('{ARCH}', arch)
.replace('{NODEVER}', nodever) + suffix;
}
module.exports = {
getPackageName: getPackageName
};

View file

@ -1,109 +0,0 @@
'use strict';
var download = require('download');
var fs = require('fs');
var getPackageName = require('./common').getPackageName;
var os = require('os');
var pkg = require('../package.json');
var WebRTCUrl = pkg.config.webrtc.url;
var WebRTCRev = pkg.config.webrtc.revision;
var ChromiumUrl = pkg.config.chromium.url;
namespace('fetch', function () {
task('precompiled', ['download'], function () {
});
task('download', {async: true}, function () {
var url = pkg.config.url + '/' + pkg.version + '/' + getPackageName();
console.log('Downloading', url);
download(url, '.')
.then(function () {
var task = jake.Task['fetch:extract'];
task.addListener('complete', function () {
console.log('Done');
complete();
});
task.invoke();
})
.catch(function (err) {
var task = jake.Task['fetch:source'];
console.log('Failed, building libwebrtc from source.');
task.addListener('complete', function () {
complete();
});
task.invoke();
});
});
task('extract', {async: true}, function () {
var packageName = getPackageName();
console.log('Extracting', packageName);
jake.exec('tar xf ' + packageName, { printStdout: true, printStderr: true }, function () {
fs.unlinkSync(packageName);
complete();
});
});
task('submodules', {async: true}, function () {
console.log('Updating submodules...');
jake.exec(['git submodule init', 'git submodule update'], {printStdout: true}, function () {
complete();
});
});
task('configure', ['fetch:submodules'], {async: true}, function () {
var pathSep = (os.platform() === 'win32') ? '\\' : '/';
var envSep = (os.platform() === 'win32') ? ';' : ':';
if (os.platform() === 'win32') {
process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = 0;
}
console.log('Configuring gclient to fetch WebRTC code');
process.env.PATH = process.cwd() + pathSep + 'Dependencies' + pathSep + 'depot_tools' + envSep + process.env.PATH;
jake.exec('gclient config --name src ' + WebRTCUrl, { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('sync', ['fetch:configure'], {async: true}, function () {
console.log('Retrieving WebRTC source code');
jake.exec('gclient sync --revision ' + WebRTCRev + ' -n -D', { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('chromium', ['fetch:sync'], {async: true}, function () {
console.log('Retrieving Chromium dependencies');
jake.exec('git clone ' + ChromiumUrl + ' src/chromium/src', { breakOnError: false, printStdout: true, printStderr: true }, function () {
complete();
});
});
task('clang', ['fetch:chromium'], {async: true}, function () {
console.log('Updating clang');
jake.exec('python src/chromium/src/tools/clang/scripts/update.py', { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('links', ['fetch:clang'], {async: true}, function () {
console.log('Creating symbolic links');
jake.exec('python src/setup_links.py', { printStdout: true, printStderr: true }, function () {
complete();
});
});
task('source', [
'links',
'build:default'
], function () {
});
});

View file

@ -1,15 +0,0 @@
'use strict';
var os = require('os');
var getPackageName = require('./common').getPackageName;
task('package', {async: true}, function () {
var packageName = getPackageName();
console.log('Creating ' + packageName + '...');
if (os.platform() !== 'win32') {
jake.exec('tar cfz ' + packageName + ' include lib', function () {
complete();
});
}
});

View file

@ -8,7 +8,7 @@
"url": "https://github.com/aisouard/libwebrtc/releases/download" "url": "https://github.com/aisouard/libwebrtc/releases/download"
}, },
"scripts": { "scripts": {
"install": "jake", "install": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": { "repository": {
@ -20,7 +20,6 @@
"dependencies": { "dependencies": {
"download": "^5.0.2", "download": "^5.0.2",
"fs-extra": "^0.30.0", "fs-extra": "^0.30.0",
"jake": "^8.0.14",
"npm": "^3.10.8" "npm": "^3.10.8"
} }
} }