You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/11/05 23:38:49 UTC
[1/8] git commit: improve checkout to support custom repos and
branches
Repository: cordova-medic
Updated Branches:
refs/heads/master eb41b0634 -> e1b6492ef
improve checkout to support custom repos and branches
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/997d05e8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/997d05e8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/997d05e8
Branch: refs/heads/master
Commit: 997d05e8e84f03aad85ba4a54fdc375be334554e
Parents: d5dc811
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 18:00:10 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:49 2014 +0400
----------------------------------------------------------------------
checkout.js | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/997d05e8/checkout.js
----------------------------------------------------------------------
diff --git a/checkout.js b/checkout.js
index 8fc2f9c..7aee228 100644
--- a/checkout.js
+++ b/checkout.js
@@ -13,6 +13,20 @@ function getDir(reponame) {
return path.basename(reponame,'.git');
}
+function hasRemote (remote) {
+ get_remote = shell.exec('git remote -v');
+ if (get_remote.code > 0) {
+ return false;
+ }
+ var remotes = get_remote.output.split('\n');
+ for (var i in remotes){
+ if (remotes[i].indexOf(remote) > -1){
+ return true;
+ }
+ }
+ return false;
+}
+
if(argv.cat) CAT=argv.cat;
if(argv.release) isRelease=true;
if(argv.path) jsonpath=argv.path;
@@ -21,16 +35,23 @@ if(argv.releasebranch) branch_release= argv.releasebranch;
var repos = JSON.parse(fs.readFileSync(jsonpath, 'utf8'));
repos.repos.forEach( function(repo) {
-// console.log('checking '+JSON.stringify(repo));
+ // console.log('checking '+JSON.stringify(repo));
if(repo.category == CAT) {
- var branch = repo.current;
- if(isRelease) branch = repo.release;
- if(branch =="RELEASE") branch = branch_release;
+ var branch = isRelease ? repo.release : repo.current;
+ branch = branch =="RELEASE" ? branch_release : branch;
var dir = getDir(repo.repo);
+ var remotename = path.basename(path.dirname(repo.repo));
if(fs.existsSync(dir) && fs.statSync(dir).isDirectory() ) {
shell.pushd(dir);
if(fs.existsSync('.git')) {
- var cmdout = shell.exec('git checkout '+branch);
+ // Check if remote from repos.json already added to local repo
+ if (!hasRemote(repo.repo)){
+ // If not, then add it, and checkout branch from there
+ console.log('Adding remote: ' + remotename + ' ' + repo.repo);
+ var remote_add = shell.exec('git remote add -f ' + remotename + ' ' + repo.repo + ' -t ' + branch);
+ }
+ console.log('Checking branch ' + branch);
+ var checkout = shell.exec('git checkout ' + branch);
}
shell.popd();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[5/8] git commit: windows universal apps support
Posted by sg...@apache.org.
windows universal apps support
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/fe88e35a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/fe88e35a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/fe88e35a
Branch: refs/heads/master
Commit: fe88e35aa2783a0734c321a7f87cdb4a4bb7902d
Parents: 1c0521e
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 18:02:57 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:51 2014 +0400
----------------------------------------------------------------------
build_windows8.js | 15 +-
config.json.sample-windows | 4 +-
cordova-plugin-medic/www/medic.js | 2 +-
src/build/makers/testRunner.js | 46 +++++
src/build/makers/windows8.js | 247 +++++++--------------------
src/build/makers/windows8/deploy.js | 57 -------
src/build/makers/wp8.js | 98 +++--------
src/build/makers/wp8/deploy.js | 26 ---
src/build/makers/wp8/devices.js | 0
src/utils/EnableDebuggingForPackage.ps1 | 83 +++++++++
src/utils/StoreAppLauncher.dll | Bin 5120 -> 0 bytes
src/utils/StoreAppLauncher.exe | Bin 5120 -> 0 bytes
writejson.js | 12 +-
13 files changed, 249 insertions(+), 341 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/build_windows8.js
----------------------------------------------------------------------
diff --git a/build_windows8.js b/build_windows8.js
index 658eb5f..a03ee6b 100644
--- a/build_windows8.js
+++ b/build_windows8.js
@@ -1,3 +1,4 @@
+var fs = require('fs');
var path = require ('path');
var shell = require('shelljs');
var buildinfo = require('./buildinfo');
@@ -18,15 +19,27 @@ var TEST_OK=true;
if(argv.branch) BRANCH=argv.branch;
var output_location = path.join(MSPEC_DIR,'platforms','windows8');
+// fixes tests crash when windows universal apps used to test
+if (!fs.existsSync(output_location)){
+ output_location = path.join(MSPEC_DIR,'platforms','windows');
+}
buildinfo('Windows8', BRANCH, function (error, sha ) {
+
+ function log(msg) {
+ console.log('[WINDOWS8] ' + msg + ' (sha: ' + sha + ')');
+ }
+
if(error) {
TEST_OK=false;
} else {
// timeout to execute tests, 10 min by default
var test_timeout = config.app.timeout ? config.app.timeout : 10 * 60;
+ log(argv);
+ var build_target = argv.phone ? "phone" : argv.store80 ? "store80" : "store";
+ log(build_target);
- windows8(output_location, sha, config.app.entry, config.couchdb.host, test_timeout).then(function() {
+ windows8(output_location, sha, config.app.entry, config.couchdb.host, test_timeout, build_target).then(function() {
console.log('Windows8 test execution completed');
}, function(err) {
TEST_OK=false;
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/config.json.sample-windows
----------------------------------------------------------------------
diff --git a/config.json.sample-windows b/config.json.sample-windows
index 4ffdef9..a5f7a14 100644
--- a/config.json.sample-windows
+++ b/config.json.sample-windows
@@ -6,8 +6,8 @@
"port":8088
},
"app":{
- "entry":"www/autotest/pages/all.html",
- "platforms":"windows8,wp8",
+ "entry":"autotest/pages/all.html",
+ "platforms":"windows8,wp8,android",
"release":"master",
"timeout": 600
},
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/cordova-plugin-medic/www/medic.js
----------------------------------------------------------------------
diff --git a/cordova-plugin-medic/www/medic.js b/cordova-plugin-medic/www/medic.js
index e4620c5..e16b011 100644
--- a/cordova-plugin-medic/www/medic.js
+++ b/cordova-plugin-medic/www/medic.js
@@ -40,7 +40,7 @@ function Medic() {
var cfg = JSON.parse(xhr.responseText);
medic_this.sha = cfg.sha;
medic_this.couchdb = cfg.couchdb;
- medic_this.couchdbext = cfg.couchdbext;
+ medic_this.couchdbext = cfg.couchdbext || medic_this.couchdb;
console.log('Loaded Medic Config: sha='+medic_this.sha+',couchdb='+medic_this.couchdb+',couchdbext='+medic_this.couchdbext);
}
xhr.send();
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/testRunner.js
----------------------------------------------------------------------
diff --git a/src/build/makers/testRunner.js b/src/build/makers/testRunner.js
new file mode 100644
index 0000000..237a22b
--- /dev/null
+++ b/src/build/makers/testRunner.js
@@ -0,0 +1,46 @@
+var shell = require('shelljs'),
+ couch = require('../../couchdb/interface'),
+ q = require('q');
+
+function query_for_sha(sha, callback) {
+ var view = 'sha?key="' + sha + '"';
+ // get build errors from couch for each repo
+ couch.mobilespec_results.query_view('results', view, function(error, result) {
+ if (error) {
+ console.error('query failed for mobilespec_results', error);
+ callback(true, error);
+ return;
+ }
+ callback(false, result);
+ });
+}
+
+function isTestsCompleted(sha, callback) {
+ query_for_sha(sha, function(isFailed, res) {
+ // return True if there is no error and there are test results in db for specified sha
+ callback(!isFailed && res.rows.length > 0);
+ });
+}
+
+function waitTestsCompleted(sha, timeoutMs) {
+ var defer = q.defer();
+ var startTime = Date.now(),
+ timeoutTime = startTime + timeoutMs,
+ checkInterval = 10 * 1000; // 10 secs
+
+ var testFinishedFn = setInterval(function(){
+
+ isTestsCompleted(sha, function(isSuccess) {
+ // if tests are finished or timeout
+ if (isSuccess || Date.now() > timeoutTime) {
+ clearInterval(testFinishedFn);
+ isSuccess ? defer.resolve() : defer.reject('timed out');
+ }
+ });
+ }, checkInterval);
+ return defer.promise;
+}
+
+module.exports = {
+ waitTestsCompleted:waitTestsCompleted
+}
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/windows8.js
----------------------------------------------------------------------
diff --git a/src/build/makers/windows8.js b/src/build/makers/windows8.js
index abd0042..0fe2553 100644
--- a/src/build/makers/windows8.js
+++ b/src/build/makers/windows8.js
@@ -1,59 +1,58 @@
var shell = require('shelljs'),
path = require('path'),
n = require('ncallbacks'),
- deploy = require('./windows8/deploy'),
fs = require('fs'),
mspec = require('./mobile_spec'),
couch = require('../../couchdb/interface'),
- q = require('q');
+ q = require('q'),
+ testRunner = require('./testRunner'),
+ util = require('util');
+module.exports = function(output, sha, entry_point, couchdb_host, test_timeout, build_target) {
-module.exports = function(output, sha, entry_point, couchdb_host, test_timeout, callback) {
-
- var packageName = 'org.apache.mobilespec';
- var packageInfo = {};
-
- function query_for_sha(sha, callback) {
-
- var view = 'sha?key="' + sha + '"';
- // get build errors from couch for each repo
- couch.mobilespec_results.query_view('results', view, function(error, result) {
- if (error) {
- console.error('query failed for mobilespec_results', error);
- callback(true, error);
- return;
- }
- callback(false, result);
- });
- }
-
- function isTestsCompleted(sha, callback) {
- query_for_sha(sha, function(isFailed, res) {
- // return True if there is no error and there are test results in db for specified sha
- callback(!isFailed && res.rows.length > 0);
- });
- }
-
- function waitTestsCompleted(sha, timeoutMs) {
- var defer = q.defer();
- var startTime = Date.now(),
- timeoutTime = startTime + timeoutMs,
- checkInterval = 10 * 1000; // 10 secs
-
- var testFinishedFn = setInterval(function(){
+ function run() {
+ var d = q.defer();
+ log('Running app...');
+ var cmd = (build_target == "store80" || build_target == "phone") ?
+ '..\\cordova-cli\\bin\\cordova.cmd run -- --' + build_target :
+ '..\\cordova-cli\\bin\\cordova.cmd run',
+ logFile = sha + '.log',
+ errFile = sha + '.err',
+ endFile = sha + '.end',
+ runner = 'run.bat';
+
+ // create commands that should be started from bat file:
+ // 1. cd to project folder
+ // 2. start 'cmd' defined earlier and redirect its stdout and stderr to files
+ // 3. print exit code of 'cmd' to 'endfile'
+ var runnerContent = util.format('cd /d "%s"\n%s 1>%s 2>%s & echo "%ERRORLEVEL%" >%s',
+ shell.pwd(), cmd, logFile, errFile, endFile);
+
+ fs.writeFileSync(runner, runnerContent, 'utf-8');
- isTestsCompleted(sha, function(isSuccess) {
- // if tests are finished or timeout
- if (isSuccess || Date.now() > timeoutTime) {
- clearInterval(testFinishedFn);
- isSuccess ? defer.resolve() : defer.reject('timed out');
+ // the following hack with explorer.exe usage is required to start the tool w/o Admin privileges;
+ // in other case there will be the 'app can't open while File Explorer is running with administrator privileges ...' error
+ shell.exec('explorer ' + runner, {async: false});
+
+ // Due to explorer, that don't redirects output of child cmd process
+ // and exits immediately after starting bat file we are waiting for
+ // special marker - 'endfile' - to be created when cordova run exits.
+ var waitForRunner = setInterval(function () {
+ if (fs.existsSync(endFile)){
+ clearInterval(waitForRunner);
+ log(fs.readFileSync(logFile));
+ // read 'cordova run' exit code from endfile, that was written by run.bat
+ var exitCode = parseInt(fs.readFileSync(endFile, 'utf-8'), 10);
+ if (exitCode > 0){
+ log(fs.readFileSync(errFile));
+ d.reject('Unable to run application. Exit code: ' + exitCode);
}
- });
- }, checkInterval);
- return defer.promise;
+ d.resolve();
+ }
+ }, 1000);
+ return d.promise;
}
-
function log(msg) {
console.log('[WINDOWS8] ' + msg + ' (sha: ' + sha + ')');
}
@@ -71,154 +70,40 @@ module.exports = function(output, sha, entry_point, couchdb_host, test_timeout,
mspec(mspec_out,sha,'',entry_point, function(err){
if(err) {
- throw new Error('Error thrown modifying Windows8 mobile spec application.');
- }
-
- log('Modifying Cordova windows8 application.');
- // add the sha to the junit reporter
- var tempJasmine = path.join(output, 'www', 'jasmine-jsreporter.js');
- if (fs.existsSync(tempJasmine)) {
- fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
+ throw new Error('Error while modifying Windows8 mobile spec application.');
}
- // modify start page
- var manifest = fs.readFileSync(path.join(output, 'package.appxmanifest')).toString().split('\n');
- for (var i in manifest) {
- if (manifest[i].indexOf('www/index.html') != -1) {
- log('Modifying start page to ' + entry_point);
- manifest[i] = manifest[i].replace('www/index.html', entry_point);
- break;
- }
- }
- // set permanent package name to prevent multiple installations
- for (var i in manifest) {
- if (manifest[i].indexOf('<Identity') != -1) {
- manifest[i] = manifest[i].replace(/Name=".+?"/gi, 'Name="'+packageName+'"');
- break;
- }
+ // specify couchdb server and sha for cordova medic plugin via medic.json
+ log('Write medic.json to autotest folder');
+ var medic_config='{"sha":"'+sha+'","couchdb":"'+couchdb_host+'"}';
+ fs.writeFileSync(path.join(output, '..', '..', 'www','autotest','pages', 'medic.json'),medic_config,'utf-8');
+
+ // patch WindowsStoreAppUtils script to allow app run w/out active desktop/remote session
+ if (build_target == "store80" || build_target == "store") {
+ log('Patching WindowsStoreAppUtils to allow app to be run in automated mode');
+ shell.cp('-f', path.join(output, '..', '..', '..','medic','src', 'utils', 'EnableDebuggingForPackage.ps1'),
+ path.join(output, 'cordova', 'lib'));
+ shell.sed('-i', /^\s*\$appActivator .*$/gim,
+ '$&\n' +
+ ' powershell ' + path.join(output, 'cordova', 'lib', 'EnableDebuggingForPackage.ps1') + ' $$ID\n' +
+ ' $Ole32 = Add-Type -MemberDefinition \'[DllImport("Ole32.dll")]public static extern int CoAllowSetForegroundWindow(IntPtr pUnk, IntPtr lpvReserved);\' -Name \'Ole32\' -Namespace \'Win32\' -PassThru\n' +
+ ' $Ole32::CoAllowSetForegroundWindow([System.Runtime.InteropServices.Marshal]::GetIUnknownForObject($appActivator), [System.IntPtr]::Zero)',
+ path.join(output, 'cordova', 'lib', 'WindowsStoreAppUtils.ps1'));
}
- manifest = manifest.join('\n');
-
- fs.writeFileSync(path.join(output, 'package.appxmanifest'), manifest);
-
- // make sure the couch db server is whitelisted
- var configFile = path.join(output, 'www', 'config.xml');
- fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(
- /<access origin="http:..audio.ibeat.org" *.>/gi,'<access origin="http://audio.ibeat.org" /><access origin="'+couchdb_host+'" />', 'utf-8'));
-
- // specify couchdb server and sha for cordova medic plugin
- var medicPluginCore = path.join(output, '..', '..', 'plugins', 'org.apache.cordova.core.medic', 'www', 'medic.js');
- var content = fs.readFileSync(medicPluginCore).toString();
- content = content.replace(
- /this\.couchdb = \'.*\'\;/, "this.couchdb = '" + couchdb_host + "';").replace(
- /this\.sha = \'.*\'\;/, "this.sha = '" + sha + "';"
- );
- fs.writeFileSync(medicPluginCore, content);
defer.resolve();
});
}
catch (e) {
defer.reject(e);
}
-
return defer.promise;
}
- function parsePackageInfo() {
- var d = q.defer();
- var cmd = 'powershell Get-AppxPackage ' + packageName;
- log(cmd);
- shell.exec(cmd, {silent:true, async:true}, function(code, output) {
- log(output);
- if (code > 0) {
- d.reject('getting package info failed with code ' + code);
- } else {
- output = output.split('\n');
- for (var i = 0; i < output.length; ++i) {
- if (output[i].indexOf(':') == -1) continue;
- var key = output[i].split(':')[0].trim();
- var value = output[i].split(':')[1].trim();
- while (output[i + 1] && output[i + 1].indexOf(':') == -1) value += output[++i].trim();
- packageInfo[key] = value;
- }
- d.resolve(packageInfo['PackageFullName']);
- }
- });
-
- return d.promise;
- }
-
- function removeInstalledPackage(fullName) {
- var d = q.defer();
- if (fullName) {
- log('Application with the same name is already installed, removing...');
- var cmd = 'powershell Remove-AppxPackage ' + fullName;
- log(cmd);
- shell.exec(cmd, {async:true, silent:true}, function(code, output) {
- log(output);
- if (code > 0) {
- d.reject('package removing failed with code ' + code);
- }
- else {
- d.resolve();
- }
- });
- }
- else {
- d.resolve();
- }
-
- return d.promise;
- }
-
- function getAppId() {
- var cmd = 'powershell (get-appxpackagemanifest (get-appxpackage ' + packageName +')).package.applications.application.id';
- var d = q.defer();
- log(cmd);
- shell.exec(cmd, {silent:true, async:true}, function(code, output) {
- log(output);
- if (code > 0) {
- d.reject('unable to get installed app id');
- } else {
- d.resolve(packageInfo['PackageFamilyName'] + '!' + output);
- }
- });
-
- return d.promise;
- }
-
- function runApp(appId) {
- var utilsDir = '\\..\\..\\..\\medic\\src\\utils';
- shell.cd(output + utilsDir);
- var d = q.defer();
- // the following hack with explorer.exe usage is required to start the tool w/o Admin privileges;
- // in other case there will be the 'app can't open while File Explorer is running with administrator privileges ...' error
-
- var runner = path.join(output, 'AppPackages', 'runLocal.bat'),
- storeAppLauncher = path.join(output, utilsDir, 'StoreAppLauncher.exe');
- fs.writeFileSync(runner, storeAppLauncher + ' ' + appId, 'utf-8');
-
-
- var cmd = 'explorer ' + runner;
- log(cmd);
- shell.exec(cmd, {silent:true,async:true}, function(code, output) {
- // TODO: even if the command succeeded, code is '1'. must be investigated
- // temporary added check for not empty output
- log(output);
- if (code > 0 && output != "") {
- d.reject('unable to run ' + appId);
- } else {
- d.resolve();
- }
- });
-
- return d.promise;
- }
-
- return prepareMobileSpec().then(parsePackageInfo).then(removeInstalledPackage).then(function() {
- return deploy(output, sha);
- }).then(parsePackageInfo).then(getAppId).then(runApp).then(function() {
- return waitTestsCompleted(sha, 1000 * test_timeout);
+ return prepareMobileSpec().then(function() {
+ shell.cd(path.join(output, '..', '..'));
+ return run();
+ }).then(function() {
+ return testRunner.waitTestsCompleted(sha, 1000 * test_timeout);
});
-}
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/windows8/deploy.js
----------------------------------------------------------------------
diff --git a/src/build/makers/windows8/deploy.js b/src/build/makers/windows8/deploy.js
deleted file mode 100644
index 37bcd0c..0000000
--- a/src/build/makers/windows8/deploy.js
+++ /dev/null
@@ -1,57 +0,0 @@
-var shell = require('shelljs'),
- q = require('q');
-
-
-
-module.exports = function deploy(path, sha) {
- function log(msg) {
- console.log('[WINDOWS8] [DEPLOY] ' + msg + ' (' + sha + ')');
- }
-
- function build() {
- var d = q.defer();
- log('compiling the app...');
- // 'restricted' is used to prevent powershell script (part of build.bat) which requires user interaction to run
- var cmd = 'powershell Set-ExecutionPolicy restricted && cordova\\build.bat';
- log(cmd);
- shell.exec(cmd, {silent:true, async:true}, function(code, output) {
- log(output);
- if (code > 0) {
- d.reject('build failed with code ' + code);
- } else {
- d.resolve();
- }
- });
- return d.promise;
- }
-
- function addAppDevPackage() {
- var d = q.defer();
- shell.cd('AppPackages');
- var packagesFolder = shell.ls('.');
- for (var i in packagesFolder) {
- // there are 2 items in AppPackages: folder with Add-AppDevPackage script and .appxupload file
- // find folder by extension: for some reasons shelljs 'test -d' returns false
- if (packagesFolder[i].indexOf('.appxupload') == -1) {
- shell.cd(packagesFolder[i]);
- break;
- }
- }
- shell.exec('powershell Set-ExecutionPolicy unrestricted', {silent:false, async:false}, null);
-
- var cmd = 'powershell "& \'' + shell.pwd() + '\\Add-AppDevPackage.ps1\' -Force"'; // full path is required
- log(cmd);
- shell.exec(cmd, {silent:false, async:true}, function(code, output) {
- log(output);
- if (code > 0) {
- d.reject('deploy failed with code ' + code);
- } else {
- d.resolve();
- }
- });
- return d.promise;
- }
-
- shell.cd(path);
- return build().then(addAppDevPackage);
-}
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/wp8.js
----------------------------------------------------------------------
diff --git a/src/build/makers/wp8.js b/src/build/makers/wp8.js
index d0cb349..fa0f583 100644
--- a/src/build/makers/wp8.js
+++ b/src/build/makers/wp8.js
@@ -1,61 +1,38 @@
var shell = require('shelljs'),
path = require('path'),
n = require('ncallbacks'),
- deploy = require('./wp8/deploy'),
- scan = require('./wp8/devices'),
fs = require('fs'),
mspec = require('./mobile_spec'),
couch = require('../../couchdb/interface'),
- q = require('q');
-
+ q = require('q'),
+ testRunner = require('./testRunner');
module.exports = function(output, sha, devices, entry_point, couchdb_host, test_timeout, callback) {
- function query_for_sha(sha, callback) {
-
- var view = 'sha?key="' + sha + '"';
- // get build errors from couch for each repo
- couch.mobilespec_results.query_view('results', view, function(error, result) {
- if (error) {
- console.error('query failed for mobilespec_results', error);
- callback(true, error);
- return;
- }
- callback(false, result);
- });
+ function log(msg) {
+ console.log('[WP8] ' + msg + ' (sha: ' + sha + ')');
}
- function isTestsCompleted(sha, callback) {
- query_for_sha(sha, function(isFailed, res) {
- // return True if there is no error and there are test results in db for specified sha
- callback(!isFailed && res.rows.length > 0);
+ function deploy(path, sha, devices) {
+ var cmd = 'cd ' + path + '\\..\\..\\ && node ..\\cordova-cli\\bin\\cordova run';
+ // run option: --device, --emulator, other
+ if (devices !== '') {
+ cmd += ' --' + devices;
+ }
+ cmd += ' wp8';
+ log ('starting deploy via command: ' + cmd);
+ var defer = q.defer();
+ shell.exec(cmd, {silent:true, async:true}, function(code, output) {
+ if (code > 0) {
+ defer.reject('deploy failed with code: ' + code);
+ }
+ else {
+ defer.resolve();
+ }
});
- }
-
- function waitTestsCompleted(sha, timeoutMs) {
- var defer = q.defer();
- var startTime = Date.now(),
- timeoutTime = startTime + timeoutMs,
- checkInterval = 10 * 1000; // 10 secs
-
- var testFinishedFn = setInterval(function(){
-
- isTestsCompleted(sha, function(isSuccess) {
- // if tests are finished or timeout
- if (isSuccess || Date.now() > timeoutTime) {
- clearInterval(testFinishedFn);
- isSuccess ? defer.resolve() : defer.reject('timed out');
- }
- });
- }, checkInterval);
return defer.promise;
}
-
- function log(msg) {
- console.log('[WP8] ' + msg + ' (sha: ' + sha + ')');
- }
-
function prepareMobileSpec() {
// make sure wp8 app got created first.
var defer = q.defer();
@@ -79,15 +56,6 @@ module.exports = function(output, sha, devices, entry_point, couchdb_host, test_
fs.writeFileSync(tempJasmine, "var library_sha = '" + sha + "';\n" + fs.readFileSync(tempJasmine, 'utf-8'), 'utf-8');
}
- // modify start page
- var mainPageLines = fs.readFileSync(path.join(output, 'MainPage.xaml.cs')).toString().split('\n');
- var index = 0;
- while (mainPageLines[index].indexOf('InitializeComponent();') == -1) ++index;
- ++index;
- if (mainPageLines[index].indexOf(entry_point) == -1)
- mainPageLines.splice(index, 0, ' this.CordovaView.StartPageUri = new Uri("'+ entry_point + '", UriKind.Relative);');
- fs.writeFileSync(path.join(output, 'MainPage.xaml.cs'), mainPageLines.join('\n'));
-
// set permanent guid to prevent multiple installations
var guid = '{8449DEEE-16EB-4A4A-AFCC-8446E8F06FF7}';
var appManifestXml = path.join(output, 'Properties', 'WMAppManifest.xml');
@@ -107,19 +75,11 @@ module.exports = function(output, sha, devices, entry_point, couchdb_host, test_
fs.writeFileSync(appManifestXml, xml.join('\n'));
- // make sure the couch db server is whitelisted
- var configFile = path.join(output, 'www', 'config.xml');
- fs.writeFileSync(configFile, fs.readFileSync(configFile, 'utf-8').replace(
- /<access origin="http:..audio.ibeat.org" *.>/gi,'<access origin="http://audio.ibeat.org" /><access origin="'+couchdb_host+'" />', 'utf-8'));
+ // specify couchdb server and sha for cordova medic plugin via medic.json
+ log('Write medic.json to autotest folder');
+ var medic_config='{"sha":"'+sha+'","couchdb":"'+couchdb_host+'"}';
+ fs.writeFileSync(path.join(output, '..', '..', 'www','autotest','pages', 'medic.json'),medic_config,'utf-8');
- // specify couchdb server and sha for cordova medic plugin
- var medicPluginCore = path.join(output, '..', '..', 'plugins', 'org.apache.cordova.core.medic', 'www', 'medic.js');
- var content = fs.readFileSync(medicPluginCore).toString();
- content = content.replace(
- /this\.couchdb = \'.*\'\;/, "this.couchdb = '" + couchdb_host + "';").replace(
- /this\.sha = \'.*\'\;/, "this.sha = '" + sha + "';"
- );
- fs.writeFileSync(medicPluginCore, content);
defer.resolve();
});
}
@@ -130,11 +90,9 @@ module.exports = function(output, sha, devices, entry_point, couchdb_host, test_
return defer.promise;
}
- return prepareMobileSpec().
- then(function() {
+ return prepareMobileSpec().then(function() {
return deploy(output, sha, devices);
- }).
- then(function() {
- return waitTestsCompleted(sha, 1000 * test_timeout);
+ }).then(function() {
+ return testRunner.waitTestsCompleted(sha, 1000 * test_timeout);
});
-}
+};
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/wp8/deploy.js
----------------------------------------------------------------------
diff --git a/src/build/makers/wp8/deploy.js b/src/build/makers/wp8/deploy.js
deleted file mode 100644
index cb06f48..0000000
--- a/src/build/makers/wp8/deploy.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var shell = require('shelljs'),
- q = require('q');
-
-module.exports = function deploy(path, sha, devices){
- function log(msg) {
- console.log('[WP8] [DEPLOY] ' + msg + ' (' + sha + ')');
- }
-
- var cmd = 'cd ' + path + '\\..\\..\\ && node ..\\cordova-cli\\bin\\cordova run';
- // run option: --device, --emulator, other
- if (devices !== '') {
- cmd += ' --' + devices;
- }
- cmd += ' wp8';
- log ('starting deploy via command: ' + cmd);
- var defer = q.defer();
- shell.exec(cmd, {silent:true, async:true}, function(code, output) {
- if (code > 0) {
- defer.reject('deploy failed with code: ' + code);
- }
- else {
- defer.resolve();
- }
- });
- return defer.promise;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/build/makers/wp8/devices.js
----------------------------------------------------------------------
diff --git a/src/build/makers/wp8/devices.js b/src/build/makers/wp8/devices.js
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/utils/EnableDebuggingForPackage.ps1
----------------------------------------------------------------------
diff --git a/src/utils/EnableDebuggingForPackage.ps1 b/src/utils/EnableDebuggingForPackage.ps1
new file mode 100644
index 0000000..15436bd
--- /dev/null
+++ b/src/utils/EnableDebuggingForPackage.ps1
@@ -0,0 +1,83 @@
+<#
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+#>
+
+param(
+ [Parameter(Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
+ [string] $ID <# package.appxmanifest//Identity@name #>
+)
+
+$code = @"
+using System;
+using System.Runtime.InteropServices;
+namespace PackageDebug
+{
+ public enum PACKAGE_EXECUTION_STATE
+ {
+ PES_UNKNOWN,
+ PES_RUNNING,
+ PES_SUSPENDING,
+ PES_SUSPENDED,
+ PES_TERMINATED
+ }
+
+ [ComImport, Guid("B1AEC16F-2383-4852-B0E9-8F0B1DC66B4D")]
+ public class PackageDebugSettings
+ {
+ }
+
+ [ComImport, Guid("F27C3930-8029-4AD1-94E3-3DBA417810C1"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IPackageDebugSettings
+ {
+ int EnableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, [MarshalAs(UnmanagedType.LPWStr)] string debuggerCommandLine, IntPtr environment);
+ int DisableDebugging([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int Suspend([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int Resume([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int TerminateAllProcesses([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int SetTargetSessionId(int sessionId);
+ int EnumerageBackgroundTasks([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+ out uint taskCount, out int intPtr, [Out] string[] array);
+ int ActivateBackgroundTask(IntPtr something);
+ int StartServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int StopServicing([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int StartSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName, uint sessionId);
+ int StopSessionRedirection([MarshalAs(UnmanagedType.LPWStr)] string packageFullName);
+ int GetPackageExecutionState([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+ out PACKAGE_EXECUTION_STATE packageExecutionState);
+ int RegisterForPackageStateChanges([MarshalAs(UnmanagedType.LPWStr)] string packageFullName,
+ IntPtr pPackageExecutionStateChangeNotification, out uint pdwCookie);
+ int UnregisterForPackageStateChanges(uint dwCookie);
+ }
+
+ public class DebugTool
+ {
+ public static void EnableDebug(String packageFullName)
+ {
+ // Set debug mode for App and activate installed application
+ var debugSettings = (IPackageDebugSettings)(new PackageDebugSettings());
+ debugSettings.EnableDebugging(packageFullName, null, (IntPtr)null);
+ }
+ }
+}
+"@
+
+Add-Type -TypeDefinition $code
+
+$packageFullName = $(Get-AppxPackage $ID).PackageFullName
+Write-Host "Setting debug mode for application:" $ID
+[PackageDebug.DebugTool]::EnableDebug($packageFullName) | Out-Null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/utils/StoreAppLauncher.dll
----------------------------------------------------------------------
diff --git a/src/utils/StoreAppLauncher.dll b/src/utils/StoreAppLauncher.dll
deleted file mode 100644
index 420c863..0000000
Binary files a/src/utils/StoreAppLauncher.dll and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/src/utils/StoreAppLauncher.exe
----------------------------------------------------------------------
diff --git a/src/utils/StoreAppLauncher.exe b/src/utils/StoreAppLauncher.exe
deleted file mode 100644
index 59fffad..0000000
Binary files a/src/utils/StoreAppLauncher.exe and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/fe88e35a/writejson.js
----------------------------------------------------------------------
diff --git a/writejson.js b/writejson.js
index ccb6d20..132e5a6 100644
--- a/writejson.js
+++ b/writejson.js
@@ -1,3 +1,5 @@
+/*jshint multistr: true */
+
var path = require ('path');
var shell = require('shelljs');
var fs = require('fs');
@@ -6,7 +8,7 @@ var argv = require('optimist').argv;
var TEST_DIR=process.cwd();
var MSPEC_DIR=path.join(TEST_DIR,'mobilespec');
var BRANCH="dev";
-// required on Windows to correcctly escape path delimiter character
+// required on Windows to correctly escape path delimiter character
var TEST_DIR_ESCAPED = TEST_DIR.split("\\").join("\\\\");
if(argv.branch) BRANCH=argv.branch;
@@ -40,11 +42,15 @@ fs.writeFileSync(path.join(MSPEC_DIR,'.cordova','config.json'),
"version": "'+BRANCH+'",\
"id": "cordova-windows-'+BRANCH+'"\
},\
+ "windows": {\
+ "uri": "'+TEST_DIR_ESCAPED+'/cordova-windows",\
+ "version": "'+BRANCH+'",\
+ "id": "cordova-windows-'+BRANCH+'"\
+ },\
"blackberry": {\
"uri": "'+TEST_DIR_ESCAPED+'/cordova-blackberry",\
"version": "'+BRANCH+'",\
"id": "cordova-blackberry-'+BRANCH+'"\
}\
}\
-}');
-
+}');
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/8] git commit: new script to write test configuration to config.xml
Posted by sg...@apache.org.
new script to write test configuration to config.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/36a79670
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/36a79670
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/36a79670
Branch: refs/heads/master
Commit: 36a7967059d76eabac504aedb7baa33930797d47
Parents: fe88e35
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 18:04:02 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:51 2014 +0400
----------------------------------------------------------------------
updateconfig.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/36a79670/updateconfig.js
----------------------------------------------------------------------
diff --git a/updateconfig.js b/updateconfig.js
new file mode 100644
index 0000000..c3d7661
--- /dev/null
+++ b/updateconfig.js
@@ -0,0 +1,50 @@
+// /usr/bin/env node
+
+var fs = require('fs'),
+ path = require('path'),
+ config = require('./config'),
+ argv = require('optimist').argv;
+
+//get parameters, that should been written to config.xml
+var entry_point = config.app.entry,
+ couch_host = config.couchdb.host;
+
+var configFile = path.join('mobilespec', 'config.xml');
+if (!fs.existsSync(configFile)){
+ console.log('Config.xml file doesn\'t exists');
+ process.exit(2);
+} else {
+ try {
+ var configContent = fs.readFileSync(configFile, 'utf-8');
+ // replace/add start page preference
+ // check if config.xml already contains <content /> element
+ console.log('Setting entry point to ' + entry_point + ' in config.xml');
+ if (configContent.match(/<content\s*src=".*"\s*\/>/gi)){
+ configContent = configContent.replace(
+ /<content\s*src=".*"\s*\/>/gi,
+ '<content src="' + entry_point + '" />');
+ } else {
+ // add entry point to config
+ configContent = configContent.split('</widget>').join('') +
+ ' <content src="' + entry_point + '"/>\n</widget>';
+ }
+
+ // Whitelists support on windows 8 is broken and cause build errors
+ if (argv.windows || argv.windows8){
+ console.warn('Current platform is windows. Removing all whitelist rules.');
+ configContent = configContent.replace(/\s*<access\s+origin=.*\/>/gim, '');
+ //cleanup doubled line ends
+ configContent = configContent.replace('\n\n', '\n');
+ } else {
+ // add whitelisting rule allow access to couch server
+ console.log('Adding whitelist rule for CouchDB host: ' + couch_host);
+ configContent = configContent.split('</widget>').join('') +
+ ' <access origin="' + couch_host + '" />\n</widget>';
+ }
+
+ fs.writeFileSync(configFile, configContent, 'utf-8');
+ } catch (e) {
+ console.log(e);
+ process.exit(2);
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/8] git commit: additional build configurations for windows
Posted by sg...@apache.org.
additional build configurations for windows
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/1c0521e6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/1c0521e6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/1c0521e6
Branch: refs/heads/master
Commit: 1c0521e60e4909755201c941baafdddafe7f6247
Parents: 997d05e
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 18:01:50 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:50 2014 +0400
----------------------------------------------------------------------
repos.json | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/1c0521e6/repos.json
----------------------------------------------------------------------
diff --git a/repos.json b/repos.json
index ce1045b..6df6f94 100644
--- a/repos.json
+++ b/repos.json
@@ -4,29 +4,35 @@
"title" : "Android Master Platform",
"categories" : ["ANDROID","CLI","PLUGMAN","COHO","MSPEC","TESTMASTER","JS"],
"branch" : "master",
- "builder": "Android_Master",
+ "builder": "Android",
"platform": "android"
},
{
"title" : "Android Master Plugins",
"categories" : ["PLUGIN"],
"branch" : "master",
- "builder": "Android_Master",
+ "builder": "Android",
"platform": "android"
- }
-,
+ },
+ {
+ "title" : "Android Build Windows",
+ "categories" : ["ANDROID","CLI"],
+ "branch" : "master",
+ "builder": "AndroidWin",
+ "platform": "android"
+ },
{
"title" : "IOS Master Platform",
"categories" : ["IOS","CLI","PLUGMAN","COHO","MSPEC","TESTMASTER","JS"],
"branch" : "master",
- "builder": "IOS_Master",
+ "builder": "IOS",
"platform": "ios"
},
{
"title" : "IOS Master Plugins",
"categories" : ["PLUGIN"],
"branch" : "master",
- "builder": "IOS_Master",
+ "builder": "IOS",
"platform": "ios"
}
,
@@ -34,14 +40,14 @@
"title" : "Windows Phone8 master",
"categories" : ["WP8"],
"branch" : "master",
- "builder": "WP8_Master",
+ "builder": ["WP8", "WP8_vs2012_win8"],
"platform": "wp8"
},
{
"title" : "Windows 8 master",
"categories" : ["WINDOWS8"],
"branch" : "master",
- "builder": "Windows8_Master",
+ "builder": ["Windows8", "Windows8_vs2012_win8"],
"platform": "windows8"
}
,
@@ -49,14 +55,14 @@
"title" : "BlackBerry Master Platform",
"categories" : ["BLACKBERRY","CLI","PLUGMAN","COHO","MSPEC","TESTMASTER","JS"],
"branch" : "master",
- "builder": "BlackBerry_Master",
+ "builder": "BlackBerry",
"platform": "blackberry"
},
{
"title" : "BlackBerry Master Plugins",
"categories" : ["PLUGIN"],
"branch" : "master",
- "builder": "BlackBerry_Master",
+ "builder": "BlackBerry",
"platform": "blackberry"
}
,
@@ -92,10 +98,10 @@
},
{
"title" : "TESTMASTER",
- "repo" : "https://git-wip-us.apache.org/repos/asf/cordova-medic.git",
+ "repo" : "http://github.com/msopentech/cordova-medic",
"category" : "TESTMASTER",
- "release" : "master",
- "current" : "master"
+ "release" : "windows-fixes",
+ "current" : "windows-fixes"
},{
"title" : "COHO",
"repo" : "https://git-wip-us.apache.org/repos/asf/cordova-coho.git",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[8/8] git commit: Windows: logic to specify target build version via
config
Posted by sg...@apache.org.
Windows: logic to specify target build version via config
As per cahnges in Windows Universal Apps logic:
* no --store80 switch anymore;
* target version is specified via config.xml:
<preference name="windows-target-version" value="VERSION" />
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/e1b6492e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/e1b6492e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/e1b6492e
Branch: refs/heads/master
Commit: e1b6492ef9ee0e4ee097cfa3a5d6a8b33a2ee027
Parents: 9382064
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 12 12:53:37 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:53 2014 +0400
----------------------------------------------------------------------
build_windows8.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/e1b6492e/build_windows8.js
----------------------------------------------------------------------
diff --git a/build_windows8.js b/build_windows8.js
index a03ee6b..b7bb821 100644
--- a/build_windows8.js
+++ b/build_windows8.js
@@ -30,6 +30,18 @@ buildinfo('Windows8', BRANCH, function (error, sha ) {
console.log('[WINDOWS8] ' + msg + ' (sha: ' + sha + ')');
}
+ function setTargetStoreVersion(version) {
+ log('setting target store version to ' + version);
+
+ var configPath = 'mobilespec/config.xml';
+ configContent = fs.readFileSync(configPath, "utf8");
+
+ var versionPreference = '<preference name="windows-target-version" value="' + version + '" />';
+ configContent = configContent.replace ('</widget>', versionPreference + '\r\n</widget>')
+
+ fs.writeFileSync(configPath, configContent, "utf8");
+ }
+
if(error) {
TEST_OK=false;
} else {
@@ -39,6 +51,14 @@ buildinfo('Windows8', BRANCH, function (error, sha ) {
var build_target = argv.phone ? "phone" : argv.store80 ? "store80" : "store";
log(build_target);
+ if (build_target == "store80") {
+ build_target == "store";
+ //setTargetStoreVersion('8.0'); // this value is used by default
+ } else if (build_target == "store") {
+ // store target configuration is specified via config.xml
+ setTargetStoreVersion('8.1');
+ }
+
windows8(output_location, sha, config.app.entry, config.couchdb.host, test_timeout, build_target).then(function() {
console.log('Windows8 test execution completed');
}, function(err) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/8] git commit: master.cfg: platform test steps via base class and
overrides
Posted by sg...@apache.org.
master.cfg: platform test steps via base class and overrides
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/d5dc8114
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/d5dc8114
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/d5dc8114
Branch: refs/heads/master
Commit: d5dc8114e13031e1f913083737360afe26e191e7
Parents: eb41b06
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 17:59:22 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:49 2014 +0400
----------------------------------------------------------------------
master.cfg | 621 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 337 insertions(+), 284 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/d5dc8114/master.cfg
----------------------------------------------------------------------
diff --git a/master.cfg b/master.cfg
index 5ac3f94..3862406 100644
--- a/master.cfg
+++ b/master.cfg
@@ -1,3 +1,4 @@
+#!/usr/bin/python
# -*- python -*-
# ex: set syntax=python:
@@ -18,51 +19,52 @@ c = BuildmasterConfig = {}
# Detect system we are running
import platform
log.msg("Platform is %s" % (platform.system(),))
-is_Windows=platform.system() == "Windows"
# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes.
from buildbot.changes.gitpoller import GitPoller
c['change_source'] = []
-import logging
import json
with open("../config.json") as f:
- json_config=json.load(f)
+ json_config = json.load(f)
with open("../repos.json") as f:
- json_repos=json.load(f)
-
-platform_list=json_config['app']['platforms']
-branch_release =str(json_config['app']['release'])
-
-build_android=('android' in platform_list)
-build_chrome=('chrome' in platform_list)
-build_ios=('ios' in platform_list)
-build_wp8=('wp8' in platform_list)
-build_windows8=('windows8' in platform_list)
-build_blackberry=('blackberry' in platform_list)
-if (build_wp8 or build_windows8) and not is_Windows :
- log.err("wp8 and windows8 builds are supported on Windows platform only")
-projectbranches=['master',branch_release]
-polltime=300
-stabletime=30
-mail_to=[]
-for mt in json_config['mail']['to'] :
- mail_to.append(str(mt))
-
-mail_from=str(json_config['mail']['from'])
-mail_pw=str(json_config['mail']['password'])
-mail_serverURL=str(json_config['mail']['serverURL'])
-
-def getBranches(tags) :
- result=[];
- for b in tags :
- if(b == 'RELEASE') :
- result.append(branch_release)
- else :
- result.append(str(b))
- return result
+ json_repos = json.load(f)
+
+platform_list = json_config['app']['platforms']
+branch_release = str(json_config['app']['release'])
+build_timeout = json_config['app']['timeout']
+
+build_android = ('android' in platform_list)
+build_chrome = ('chrome' in platform_list)
+build_ios = ('ios' in platform_list)
+build_wp8 = ('wp8' in platform_list)
+build_windows8 = ('windows8' in platform_list)
+build_blackberry = ('blackberry' in platform_list)
+projectbranches = ['master', branch_release]
+polltime = 300
+stabletime = 30
+# GitPoller on Windows fails if gitbin location is not provided.
+# Set git location if running medic master on Windows
+git_bin = "" #"c:\Program Files (x86)\Git\cmd\git.exe"
+mail_to = []
+for mt in json_config['mail']['to']:
+ mail_to.append(str(mt))
+
+mail_from = str(json_config['mail']['from'])
+mail_pw = str(json_config['mail']['password'])
+mail_serverURL = str(json_config['mail']['serverURL'])
+
+
+def getBranches(tags):
+ result = []
+ for b in tags:
+ if(b == 'RELEASE'):
+ result.append(branch_release)
+ else:
+ result.append(str(b))
+ return result
####### BUILDSLAVES
@@ -73,11 +75,12 @@ from buildbot.buildslave import BuildSlave
from buildbot.changes import pb
c['slaves'] = [
- BuildSlave("ios-slave", "pass",max_builds=1),
- BuildSlave("android-slave", "pass",max_builds=1),
- BuildSlave("windows-slave", "pass",max_builds=2),
- BuildSlave("blackberry-slave", "pass",max_builds=1),
- BuildSlave("common-slave","pass",max_builds=3)
+ BuildSlave("ios-slave", "pass", max_builds=1),
+ BuildSlave("android-slave", "pass", max_builds=1),
+ BuildSlave("windows-slave", "pass", max_builds=2),
+ BuildSlave("win8-slave", "pass", max_builds=2),
+ BuildSlave("blackberry-slave", "pass", max_builds=1),
+ BuildSlave("common-slave", "pass", max_builds=3)
]
# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
@@ -85,41 +88,43 @@ c['slaves'] = [
# --master option)
c['slavePortnum'] = 9889
-repos={}
-branches={}
+repos = {}
+branches = {}
-for jrepo in json_repos['repos'] :
- cat = str(jrepo['category'])
- title = str(jrepo["title"])
- repo_url=str(jrepo['repo'])
- if cat == "PLUGIN" :
- c['change_source'].append(GitPoller(repo_url, project=cat,category=cat, branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
- elif not (cat == "PLATFORM") :
- repos[title] = repo_url
- branches[title] = str(jrepo['current'])
- c['change_source'].append(GitPoller(repo_url, project=cat,category=cat, branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
+# periodically fetches from a remote git repository and processes any changes
+def listen_for_source_change(repo_url, project, category, branches):
+ if (git_bin == ""):
+ c['change_source'].append(
+ GitPoller(repo_url, project=project, category=category, branches=branches, pollinterval=polltime))
+ else:
+ c['change_source'].append(
+ GitPoller(repo_url, gitbin=git_bin, project=project, category=category, branches=branches, pollinterval=polltime))
- else :
- repos[title] = repo_url
- branches[title] = str(jrepo['current'])
- if(build_android and title=="ANDROID") :
- c['change_source'].append(GitPoller(repo_url,project=title,category='PLATFORM', branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
+for jrepo in json_repos['repos']:
+ cat = str(jrepo['category'])
+ title = str(jrepo["title"])
+ repo_url = str(jrepo['repo'])
+ if cat == "PLUGIN":
+ listen_for_source_change(repo_url, cat, cat, getBranches([jrepo['release'], jrepo['current']]))
- if(build_ios and title=="IOS") :
- c['change_source'].append(GitPoller(repo_url,project=title,category='PLATFORM', branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
+ elif not (cat == "PLATFORM"):
+ repos[title] = repo_url
+ branches[title] = str(jrepo['current'])
+ listen_for_source_change(repo_url, cat, cat, getBranches([jrepo['release'], jrepo['current']]))
- if(build_wp8 and title=="WP8") :
- c['change_source'].append(GitPoller(repo_url,project=title,category='PLATFORM', branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
+ else:
+ repos[title] = repo_url
+ branches[title] = str(jrepo['current'])
+ if (build_android and title == "ANDROID"
+ or build_ios and title == "IOS"
+ or build_wp8 and title == "WP8"
+ or build_windows8 and title == "WINDOWS8"
+ or build_blackberry and title == "BLACKBERRY"):
- if(build_windows8 and title=="WINDOWS8") :
- c['change_source'].append(GitPoller(repo_url,project=title,category='PLATFORM', branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
+ listen_for_source_change(repo_url, title, 'PLATFORM', getBranches([jrepo['release'], jrepo['current']]))
- if(build_blackberry and title=="BLACKBERRY") :
- c['change_source'].append(GitPoller(repo_url,project=title,category='PLATFORM', branches=getBranches([jrepo['release'],jrepo['current']]), pollinterval=polltime))
-
-
-c['change_source'].append(pb.PBChangeSource(port=9999,user='Cordova',passwd='Cordova'))
+c['change_source'].append(pb.PBChangeSource(port=9999, user='Cordova', passwd='Cordova'))
####### SCHEDULERS
@@ -130,22 +135,26 @@ from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.changes import filter
-force_builders=[]
-
+builders = []
+force_builders = []
c['schedulers'] = []
-for test in json_repos['tests'] :
- if test["platform"] in platform_list :
- c['schedulers'].append(SingleBranchScheduler(
- name=str(test["title"]),
- change_filter=filter.ChangeFilter(branch=test["branch"],project=test["categories"]),
- treeStableTimer=stabletime,
- builderNames=[str(test["builder"])]))
- force_builders.append(str(test["builder"]))
+for test in json_repos['tests']:
+ if test["platform"] in platform_list:
+ if type(test["builder"]) == list:
+ builders = [str(b) for b in test["builder"]]
+ else:
+ builders = [str(test["builder"])]
+
+ force_builders.extend(builders)
-c['schedulers'].append(ForceScheduler(
- name="force",
- builderNames=force_builders))
+ c['schedulers'].append(SingleBranchScheduler(
+ name=str(test["title"]),
+ change_filter=filter.ChangeFilter(branch=test["branch"], project=test["categories"]),
+ treeStableTimer=stabletime,
+ builderNames=builders))
+
+c['schedulers'].append(ForceScheduler(name="force", builderNames=force_builders))
####### BUILDERS
@@ -155,212 +164,262 @@ c['schedulers'].append(ForceScheduler(
# only take place on one slave.
from buildbot.process.factory import BuildFactory
-from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
+from buildbot.steps.transfer import FileDownload
from buildbot.config import BuilderConfig
cli_steps = [
- ShellCommand(command=["rm","-rf","cordova-*"],workdir='build',haltOnFailure=False,description='Cordova Clean', descriptionDone='Cordova Clean'),
- ShellCommand(command=["git","clone",repos['CLI'],"cordova-cli"],workdir='build',haltOnFailure=True,description='Get CLI',descriptionDone='Get CLI'),
- ShellCommand(command=["mkdir","node_modules"],workdir='build/cordova-cli',haltOnFailure=True,description='prepare cordova-lib',descriptionDone='Prepare cordova-lib'),
- ShellCommand(command=["git","clone -b",branches['CORDOVA-LIB'],repos['CORDOVA-LIB'],"cordova-lib"],workdir='build',haltOnFailure=True,description='Update Cordova-lib',descriptionDone='Update Cordova-lib'),
- ShellCommand(command=["node", "-e", "require('fs').symlinkSync('../../cordova-lib/cordova-lib', 'cordova-lib', 'dir')"], workdir='build/cordova-cli/node_modules',haltOnFailure=False,description='Cordova-lib link', descriptionDone='Cordova-lib link'),
- ShellCommand(command=["npm","install","--production"], workdir='build/cordova-cli/node_modules/cordova-lib',haltOnFailure=True,description='Install Cordova-lib',descriptionDone='Install Cordova-lib'),
- ShellCommand(command=["rm","-f", "npm-shrinkwrap.json"],workdir='build/cordova-cli',haltOnFailure=False,description='Remove CLI SW',descriptionDone='Remove CLI SW'),
- ShellCommand(command=["npm","install"],workdir='build/cordova-cli',haltOnFailure=True,description='Install CLI',descriptionDone='Install CLI'),
- ShellCommand(command=["npm","test"], workdir='build/cordova-cli',haltOnFailure=True,description='Test CLI',descriptionDone='Test CLI'),
+ ShellCommand(command=["git", "clone", "-b", branches['CLI'], repos['CLI'], "cordova-cli"], workdir='build', haltOnFailure=True, description='Get CLI'),
+ ShellCommand(command=["mkdir", "node_modules"], workdir='build/cordova-cli', haltOnFailure=True, description='Prepare cordova-lib'),
+ ShellCommand(command=["git", "clone", "-b", branches['CORDOVA-LIB'], repos['CORDOVA-LIB'], "cordova-lib"], workdir='build', haltOnFailure=True, description='Update cordova-lib'),
+ ShellCommand(command=["node", "-e", "require('fs').symlinkSync('../../cordova-lib/cordova-lib', 'cordova-lib', 'dir')"], workdir='build/cordova-cli/node_modules', haltOnFailure=False, description='Link cordova-lib'),
+ ShellCommand(command=["npm", "install", "--production"], workdir='build/cordova-cli/node_modules/cordova-lib', haltOnFailure=True, description='Install cordova-lib'),
+ ShellCommand(command=["rm", "-f", "npm-shrinkwrap.json"], workdir='build/cordova-cli', haltOnFailure=False, description='Remove CLI SW'),
+ ShellCommand(command=["npm", "install"], workdir='build/cordova-cli', haltOnFailure=True, description='Install CLI'),
+ ShellCommand(command=["npm", "test"], workdir='build/cordova-cli', haltOnFailure=True, description='Test CLI'),
]
plugman_steps = [
- ShellCommand(command=["rm","-rf","cordova-*"],workdir='build',haltOnFailure=False,description='Cordova Clean', descriptionDone='Cordova Clean'),
- ShellCommand(command=["git","clone",repos['PLUGMAN'],"cordova-plugman"],workdir='build',haltOnFailure=True,description='Get Plugman',descriptionDone='Get Plugman'),
- ShellCommand(command=["npm","install"], workdir='build/cordova-plugman',haltOnFailure=True,description='Install Plugman',descriptionDone='Install Plugman'),
- ShellCommand(command=["npm","test"], workdir='build/cordova-plugman',haltOnFailure=True,description='Test Plugman',descriptionDone='Test Plugman'),
+ ShellCommand(command=["rm", "-rf", "cordova-*"], workdir='build', haltOnFailure=False, description='Cordova Clean'),
+ ShellCommand(command=["git", "clone", repos['PLUGMAN'], "cordova-plugman"], workdir='build', haltOnFailure=True, description='Get Plugman'),
+ ShellCommand(command=["npm", "install"], workdir='build/cordova-plugman', haltOnFailure=True, description='Install Plugman'),
+ ShellCommand(command=["npm", "test"], workdir='build/cordova-plugman', haltOnFailure=True, description='Test Plugman'),
]
-# The steps that are required for any platform just to get tools and source in place
-common_steps_1 = [
- ShellCommand(command=["rm","-rf","medic"],workdir='build',haltOnFailure=False,description='Medic Clean',descriptionDone='Medic Clean'),
- ShellCommand(command=["rm","-rf","cordova-coho"],workdir='build',haltOnFailure=False,description='COHO Clean', descriptionDone='COHO Clean'),
- ShellCommand(command=["rm","-rf","mobilespec"],workdir='build',haltOnFailure=False,description='Mobilespec Clean',descriptionDone='Mobilespec Clean'),
- ShellCommand(command=["rm","-rf","cordova-lib"],workdir='build',haltOnFailure=False,description='Cordova-lib Clean',descriptionDone='Cordova-lib Clean'),
- ShellCommand(command=["rm","-rf","cordova-cli/node_modules"],workdir='build',haltOnFailure=False,description='CLI node_modules Clean',descriptionDone='CLI node_modules Clean'),
- ShellCommand(command=["git","clone","-b",branches['TESTMASTER'],repos['TESTMASTER'],"medic"],workdir='build',haltOnFailure=True, description='Get Medic', descriptionDone='Get Medic'),
- # --production switch is used to speed up installation + fruitstrap dev dependency is not supported on Windows
- ShellCommand(command=["npm","install","--production"], workdir='build/medic',haltOnFailure=True,description='Install Medic',descriptionDone='Install Medic'),
- ShellCommand(command=["cp","../../../../config.json","./config.json"], workdir='build/medic',haltOnFailure=True,description='Copy Config',descriptionDone='Copy Config'),
- ShellCommand(command=["git","clone",repos['COHO']],workdir='build',haltOnFailure=True,description='Get COHO',descriptionDone='Get COHO'),
- ShellCommand(command=["npm","install", "--production"],workdir='build/cordova-coho',haltOnFailure=True,description='Install COHO', descriptionDone='Install COHO'),
-]
+c['builders'] = []
-# The steps for any platform before platform add
-common_steps_mobilespec_1 = [
- ShellCommand(command=["mkdir","node_modules"],workdir='build/cordova-cli',haltOnFailure=True,description='prepare cordova-lib',descriptionDone='Prepare cordova-lib'),
- ShellCommand(command=["git","clone","-b",branches['CORDOVA-LIB'],repos['CORDOVA-LIB'],"cordova-lib"],workdir='build',haltOnFailure=True,description='Update Cordova-lib',descriptionDone='Update Cordova-lib'),
- ShellCommand(command=["node", "-e", "require('fs').symlinkSync('../../cordova-lib/cordova-lib', 'cordova-lib', 'dir')"], workdir='build/cordova-cli/node_modules',haltOnFailure=False,description='Cordova-lib link', descriptionDone='Cordova-lib link'),
- ShellCommand(command=["npm","install","--production"], workdir='build/cordova-cli/node_modules/cordova-lib',haltOnFailure=True,description='Install Cordova-lib',descriptionDone='Install Cordova-lib'),
- ShellCommand(command=["rm","-f", "npm-shrinkwrap.json"],workdir='build/cordova-cli',haltOnFailure=False,description='Remove CLI SW',descriptionDone='Remove CLI SW'),
- ShellCommand(command=["sed","-e","s/cordova-lib\": \"0./cordova-lib\": \">=0./","-ibak","package.json"],workdir='build/cordova-cli',haltOnFailure=True,description='Edit json',descriptionDone='Edit json'),
- ShellCommand(command=["npm","install","--production"],workdir='build/cordova-cli',haltOnFailure=True,description='Install CLI',descriptionDone='Install CLI'),
- ShellCommand(command=["node", "cordova-cli/bin/cordova","create","mobilespec","org.apache.mobilespec","mobilespec"],workdir='build',haltOnFailure=True, description='CLI Create', descriptionDone='CLI Create')
-]
-# The steps for any platform after platform add
-common_steps_mobilespec_2 = [
- ShellCommand(command=["node", "../cordova-cli/bin/cordova","plugin","add","../cordova-mobile-spec/dependencies-plugin","--searchpath",".." ],workdir='build/mobilespec',haltOnFailure=True,description='Plugin add',descriptionDone='Plugin add'),
- ShellCommand(command=["node", "../cordova-cli/bin/cordova", "plugin", "add", "../medic/cordova-plugin-medic"],workdir='build/mobilespec',haltOnFailure=True,description='Medic plugin add',descriptionDone='Medic plugin add'),
- ShellCommand(command=["rm","-rf","mobilespec/www"],workdir='build',haltOnFailure=False,description='Remove www',descriptionDone='Remove www'),
- ShellCommand(command=["node", "-e", "require('fs').symlinkSync('../cordova-mobile-spec/www','www','dir')"], workdir='build/mobilespec',haltOnFailure=True,description='Link www', descriptionDone='Link www'),
- ShellCommand(command=["node", "../cordova-cli/bin/cordova","prepare"],workdir='build/mobilespec',haltOnFailure=True,description='CLI Prepare',descriptionDone='CLI Prepare')
-]
+class PlatformTestBase(object):
+ def __init__(self, platform):
+ self.platform = platform
+
+ def init_workspace_steps(self):
+ return [
+ ShellCommand(command=["rm", "-rf", "~/.cordova/" + self.platform], workdir='build', haltOnFailure=False, description='Remove cache'),
+ ShellCommand(command=["node", "-e", "require('child_process').exec('rm -rf medic mobilespec/www mobilespec cordova-*')"], workdir='build', haltOnFailure=False, description='Clean workdir'),
+ ShellCommand(command=["git", "clone", "-b", branches['TESTMASTER'], repos['TESTMASTER'], "medic"], workdir='build', haltOnFailure=True, description='Get Medic'),
+ # --production switch is used to speed up installation + fruitstrap dev dependency is not supported on Windows
+ ShellCommand(command=["npm", "install", "--production"], workdir='build/medic', haltOnFailure=True, description='Install Medic'),
+ FileDownload(mastersrc="../config.json", slavedest="medic/config.json", haltOnFailure=True),
+ FileDownload(mastersrc="../repos.json", slavedest="medic/repos.json", haltOnFailure=True),
+ ShellCommand(command=["git", "clone", repos['COHO']], workdir='build', haltOnFailure=True, description='Get COHO'),
+ ShellCommand(command=["npm", "install", "--production"], workdir='build/cordova-coho', haltOnFailure=True, description='Install COHO'),
+ ]
+
+ def repos_clone_steps(self):
+ platform = self.platform
+ # required by coho tools to correctly resolve repo location
+ if platform == "blackberry10":
+ platform = "blackberry"
+ if platform == "windows8":
+ platform = "windows"
+ return [
+ ShellCommand(command=["./cordova-coho/coho", "repo-clone", "-r", "plugins", "-r", "mobile-spec", "-r", platform, "-r", "js"], workdir='build', haltOnFailure=True, description='COHO Clone'),
+ ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=PLUGIN", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout Plugins'),
+ ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=PLATFORM", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout Platform'),
+ ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=JS", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout JS')
+ ]
+
+ def create_app_steps(self):
+ return [
+ ShellCommand(command=["node", "cordova-cli/bin/cordova", "create", "mobilespec", "org.apache.mobilespec", "mobilespec"], workdir='build', haltOnFailure=True, description='CLI Create'),
+ ShellCommand(command=["node", "medic/writejson.js", "--branch=master"], workdir='build', haltOnFailure=True, description='Write json')
+ ]
+
+ def platform_add_steps(self):
+ return [ShellCommand(command=["../cordova-cli/bin/cordova", "platform", "add", self.platform], workdir='build/mobilespec', haltOnFailure=True, description='Platform Add')]
+
+ def build_cordovajs_steps(self):
+ return [
+ ShellCommand(command=["npm", "install"], workdir='build/cordova-js', description='Install Grunt'),
+ ShellCommand(command=["grunt"], workdir='build/cordova-js', description='Grunt')
+ ]
+
+ def prepare_mobilespec_steps(self):
+ return [
+ ShellCommand(command=["node", "../cordova-cli/bin/cordova", "plugin", "add", "../cordova-mobile-spec/dependencies-plugin", "--searchpath", ".."], workdir='build/mobilespec', haltOnFailure=True, description='Plugin add'),
+ ShellCommand(command=["node", "../cordova-cli/bin/cordova", "plugin", "add", "../medic/cordova-plugin-medic"], workdir='build/mobilespec', haltOnFailure=True, description='Medic plugin add'),
+ ShellCommand(command=["rm", "-rf", "mobilespec/www"], workdir='build', haltOnFailure=False, description='Remove www'),
+ ShellCommand(command=["node", "-e", "require('fs').symlinkSync('../cordova-mobile-spec/www','www','dir')"], workdir='build/mobilespec', haltOnFailure=True, description='Link www'),
+ # added to handle the moved config.xml (up one directory)
+ ShellCommand(command=["cp", "cordova-mobile-spec/config.xml", "mobilespec/config.xml"], workdir='build', haltOnFailure=False, description='Copy config'),
+ ShellCommand(command=["node", "medic/updateconfig.js", "--" + self.platform], workdir='build', haltOnFailure=True, description='Update config'),
+ ShellCommand(command=["node", "../cordova-cli/bin/cordova", "prepare"], workdir='build/mobilespec', haltOnFailure=True, description='CLI Prepare')
+ ]
+
+ def copy_cordovajs_steps(self):
+ return [ShellCommand(command=["cp", "-f", "cordova-js/pkg/cordova." + self.platform + ".js", "mobilespec/platforms/" + self.platform + "/platform_www/cordova.js"], workdir='build', haltOnFailure=True, description='Copy JS')]
+
+ def deploy_steps(self):
+ return [ShellCommand(command=["node", "medic/build_" + self.platform + ".js"], workdir='build', timeout=build_timeout, description='Deploy', name='Deploy')]
+
+ def build_platform_step(self):
+ return [ShellCommand(command=["../cordova-cli/bin/cordova", "build", self.platform], workdir='build/mobilespec', timeout=build_timeout, description='Build', name='Build')]
+
+ def get_all_steps(self):
+ steps = []
+ steps.extend(self.init_workspace_steps())
+ steps.extend(self.repos_clone_steps())
+ steps.extend(cli_steps)
+ steps.extend(self.create_app_steps())
+ steps.extend(self.platform_add_steps())
+ steps.extend(self.build_cordovajs_steps())
+ steps.extend(self.prepare_mobilespec_steps())
+ steps.extend(self.copy_cordovajs_steps())
+ steps.extend(self.deploy_steps())
+ return steps
+
+ def get_build_steps(self):
+ steps = []
+ steps.extend(self.init_workspace_steps())
+ steps.extend(self.repos_clone_steps())
+ steps.extend(cli_steps)
+ steps.extend(self.create_app_steps())
+ steps.extend(self.platform_add_steps())
+ steps.extend(self.build_platform_step())
+ return steps
+
+
+class PlatformTest_iOS(PlatformTestBase):
+ def __init__(self):
+ super(PlatformTest_iOS, self).__init__('ios')
+
+
+class PlatformTest_Android(PlatformTestBase):
+ def __init__(self):
+ super(PlatformTest_Android, self).__init__('android')
+
+
+class PlatformTest_WP8(PlatformTestBase):
+
+ def __init__(self):
+ super(PlatformTest_WP8, self).__init__('wp8')
+ # override cordova.js copy step since grunt builds it as cordova.windowsphone.js, not cordova.wp8.js
+
+ def copy_cordovajs_steps(self):
+ return [ShellCommand(command=["cp", "-f", "cordova-js/pkg/cordova.windowsphone.js", "mobilespec/platforms/" + self.platform + "/platform_www/cordova.js"], workdir='build', haltOnFailure=True, description='Copy JS')]
+
+ def repos_clone_steps(self):
+ steps = super(PlatformTest_WP8, self).repos_clone_steps()
+ # pach cordova-wp8 template to prevent app to lock the screen. In other case we won't be able to re-install the app next time.
+ steps.extend([ShellCommand(command=["node", "medic\src\utils\patch_wp8_template.js"], workdir='build', haltOnFailure=True, description='Patch WP8 template')])
+ return steps
+
+
+class PlatformTest_Windows8(PlatformTestBase):
+
+ def __init__(self):
+ super(PlatformTest_Windows8, self).__init__('windows8')
+
+ def copy_cordovajs_steps(self):
+ copy_cmd = "var fs=require('fs');"
+ copy_cmd += "var platform=fs.existsSync('mobilespec/platforms/windows8')?'windows8':'windows';"
+ copy_cmd += "fs.createReadStream('cordova-js/pkg/cordova.'+platform+'.js').pipe(fs.createWriteStream('mobilespec/platforms/'+platform+'/platform_www/cordova.js'));"
+ return [ShellCommand(command=["node", "-e", copy_cmd], workdir='build', haltOnFailure=False, description='Copy JS to Windows platform')]
+
+ def deploy_steps(self):
+ return [
+ ShellCommand(command=["node", "medic/build_" + self.platform + ".js", "--store80"],
+ workdir='build', timeout=build_timeout,
+ description='Deploy Store80 project',
+ name='Deploy Store80 project'),
+ ShellCommand(command=["node", "medic/build_" + self.platform + ".js", "--store"],
+ workdir='build', timeout=build_timeout,
+ description='Deploy Store project',
+ name='Deploy Store project'),
+ ShellCommand(command=["node", "medic/build_" + self.platform + ".js", "--phone"],
+ workdir='build', timeout=build_timeout,
+ description='Deploy Phone project',
+ name='Deploy Phone project'),
+ ]
+
+
+class PlatformTest_Blackberry(PlatformTestBase):
+
+ def __init__(self):
+ super(PlatformTest_Blackberry, self).__init__('blackberry10')
+
+ def prepare_mobilespec_steps(self):
+ steps = super(PlatformTest_Blackberry, self).prepare_mobilespec_steps()
+ steps.extend([ShellCommand(command=["node", "../cordova-cli/bin/cordova", "plugin", "rm", "org.apache.cordova.core.medic"], workdir='build/mobilespec', haltOnFailure=True, description='Medic plugin rm')])
+ return steps
+
+ def deploy_steps(self):
+ steps = [ShellCommand(command=["cp", "platforms/blackberry10/www/config.xml", "./config.xml"], workdir='build/mobilespec', haltOnFailure=True, description='Plugin add')]
+ steps.extend(super(PlatformTest_Blackberry, self).deploy_steps())
+ return steps
+
+if(build_ios):
+ factory_IOS_master = BuildFactory()
+ factory_IOS_master.addSteps(PlatformTest_iOS().get_all_steps())
+ c['builders'].append(BuilderConfig(name="IOS", slavenames=["ios-slave"], factory=factory_IOS_master))
-# The steps to build just the js
-common_steps_js = [
- ShellCommand(command=["npm","install"], workdir='build/cordova-js',description='Install Grunt',descriptionDone='Install Grunt'),
- ShellCommand(command=["grunt"], workdir='build/cordova-js',description='Grunt', descriptionDone='Grunt')
-]
+if(build_android):
+ factory_Android_master = BuildFactory()
+ factory_Android_master.addSteps(PlatformTest_Android().get_all_steps())
+ c['builders'].append(BuilderConfig(name="Android", slavenames=["android-slave"], factory=factory_Android_master))
-c['builders'] = []
+ factory_Android_build_only = BuildFactory()
+ factory_Android_build_only.addSteps(PlatformTest_Android().get_build_steps())
+ c['builders'].append(BuilderConfig(name="AndroidWin", slavenames=["windows-slave"], factory=factory_Android_build_only))
-if(build_ios) :
- factory_IOS_master = BuildFactory()
- factory_IOS_master.addStep(ShellCommand(command=["rm","-rf","~/.cordova/lib/ios"],workdir='build',haltOnFailure=False,description='Remove cache',descriptionDone='Remove cache'))
- factory_IOS_master.addSteps(common_steps_1)
- factory_IOS_master.addStep(ShellCommand(command=["./cordova-coho/coho","repo-clone","-r","plugins","-r","mobile-spec","-r","ios","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Clone', descriptionDone='COHO Clone'))
- factory_IOS_master.addStep(ShellCommand(command=["./cordova-coho/coho","repo-update","-r","plugins","-r","mobile-spec","-r","ios","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Update', descriptionDone='COHO Update'))
- factory_IOS_master.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLUGIN","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Plugins->master',descriptionDone='Plugins->master'))
- factory_IOS_master.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLATFORM","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Platform->master',descriptionDone='Platform->master'))
- factory_IOS_master.addSteps(common_steps_mobilespec_1)
- factory_IOS_master.addStep(ShellCommand(command=["node","medic/writejson.js","--branch=master"],workdir='build',haltOnFailure=True, description='Write json',descriptionDone='Write json'))
- factory_IOS_master.addStep(ShellCommand(command=["../cordova-cli/bin/cordova","platform","add","ios"],workdir='build/mobilespec',haltOnFailure=True, description='Platform Add',descriptionDone='Platform Add'))
- factory_IOS_master.addSteps(common_steps_js)
- factory_IOS_master.addSteps(common_steps_mobilespec_2)
- factory_IOS_master.addStep(ShellCommand(command=["cp","-f","cordova-js/pkg/cordova.ios.js","mobilespec/platforms/ios/platform_www/cordova.js"],workdir='build',haltOnFailure=True,description='Copy JS',descriptionDone='Copy JS'))
- factory_IOS_master.addStep(ShellCommand(command=["node", "medic/build_ios.js"], workdir='build', timeout=600,description='Deploy IOS',descriptionDone='Deploy IOS',name='Deploy IOS'))
- c['builders'].append(BuilderConfig(name="IOS_Master",slavenames=["ios-slave"],factory=factory_IOS_master))
-
-if(build_android) :
- factory_Android_master = BuildFactory()
- factory_Android_master.addStep(ShellCommand(command=["rm","-rf","~/.cordova/lib/android"],workdir='build',haltOnFailure=False,description='Remove cache',descriptionDone='Remove cache'))
- factory_Android_master.addSteps(common_steps_1)
- factory_Android_master.addStep(ShellCommand(command=["./cordova-coho/coho","repo-clone","-r","plugins","-r","mobile-spec","-r","android","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Clone', descriptionDone='COHO Clone'))
- factory_Android_master.addStep(ShellCommand(command=["./cordova-coho/coho","repo-update","-r","plugins","-r","mobile-spec","-r","android","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Update', descriptionDone='COHO Update'))
- factory_Android_master.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLUGIN","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Plugins->master',descriptionDone='Plugins->master'))
- factory_Android_master.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLATFORM","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Platform->master',descriptionDone='Platform->master'))
-# factory_Android_master.addStep(ShellCommand(command=[shellCmd,shellRunParam,'[ -f "package.json" ] && npm install'],workdir='build/cordova-android/bin',haltOnFailure=True,description='NPM Install', descriptionDone='NPM Install'))
- factory_Android_master.addSteps(common_steps_mobilespec_1)
- factory_Android_master.addStep(ShellCommand(command=["node","medic/writejson.js","--branch=master"],workdir='build',haltOnFailure=True, description='Write json',descriptionDone='Write json'))
- factory_Android_master.addStep(ShellCommand(command=["../cordova-cli/bin/cordova","platform","add","android"],workdir='build/mobilespec',haltOnFailure=True, description='Platform Add',descriptionDone='Platform Add'))
- factory_Android_master.addSteps(common_steps_js)
- factory_Android_master.addSteps(common_steps_mobilespec_2)
- factory_Android_master.addStep(ShellCommand(command=["cp","-f","cordova-js/pkg/cordova.android.js","mobilespec/platforms/android/platform_www/cordova.js"],workdir='build',haltOnFailure=True,description='Copy JS',descriptionDone='Copy JS'))
- factory_Android_master.addStep(ShellCommand(command=["node", "medic/build_android.js"], workdir='build', timeout=600,description='Deploy Android',descriptionDone='Deploy Android',name='Deploy Android'))
- c['builders'].append(BuilderConfig(name="Android_Master",slavenames=["android-slave"],factory=factory_Android_master))
-
-if(build_wp8) :
+if(build_wp8):
factory_wp8 = BuildFactory()
- factory_wp8.addStep(ShellCommand(command=["rm","-rf","%userprofile%/.cordova/lib/wp"],workdir='build',haltOnFailure=False,description='Remove cache',descriptionDone='Remove cache'))
- factory_wp8.addSteps(common_steps_1)
- factory_wp8.addStep(ShellCommand(command=["node","./cordova-coho/coho","repo-clone","-r","plugins","-r","mobile-spec","-r","wp8","-r","js"],workdir='build',haltOnFailure=True,description='COHO Clone', descriptionDone='COHO Clone'))
- factory_wp8.addStep(ShellCommand(command=["node","./cordova-coho/coho","repo-update","-r","plugins","-r","mobile-spec","-r","wp8","-r","js"],workdir='build',haltOnFailure=True,description='COHO Update', descriptionDone='COHO Update'))
- # TODO find the way to specify cli branch to clone for COHO, currently use step below
- factory_wp8.addStep(ShellCommand(command=["git","clone","-b",branches['CLI'],repos['CLI'],"cordova-cli"],workdir='build',haltOnFailure=True, description='Get CLI', descriptionDone='Get CLI'))
- factory_wp8.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLUGIN","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Plugins->master',descriptionDone='Plugins->master'))
- factory_wp8.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLATFORM","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Platform->master',descriptionDone='Platform->master'))
- # pach cordova-wp8 template to prevent app to lock the screen. In other case we won't be able to re-install the app next time.
- factory_wp8.addStep(ShellCommand(command=["node","medic\src\utils\patch_wp8_template.js"],workdir='build',haltOnFailure=True, description='Patch WP8 template',descriptionDone='Patch WP8 template'))
- factory_wp8.addSteps(common_steps_mobilespec_1)
- factory_wp8.addStep(ShellCommand(command=["node","medic/writejson.js","--branch=master"],workdir='build',haltOnFailure=True, description='Write json',descriptionDone='Write json'))
- factory_wp8.addStep(ShellCommand(command=["node","../cordova-cli/bin/cordova","platform","add","wp8"],workdir='build/mobilespec',haltOnFailure=True, description='Platform Add',descriptionDone='Platform Add'))
- factory_wp8.addSteps(common_steps_js)
- factory_wp8.addSteps(common_steps_mobilespec_2)
- factory_wp8.addStep(ShellCommand(command=["cp","-f","cordova-js/pkg/cordova.windowsphone.js","mobilespec/platforms/wp8/platform_www/cordova.js"],workdir='build',haltOnFailure=True,description='Copy JS',descriptionDone='Copy JS'))
- factory_wp8.addStep(ShellCommand(command=["node", "medic/build_wp8.js"], workdir='build', timeout=600,description='Deploy WP8',descriptionDone='Deploy WP8',name='Deploy WP8'))
-
- c['builders'].append(BuilderConfig(name="WP8_Master",slavenames=["windows-slave"], factory=factory_wp8))
-
-if(build_windows8) :
+ factory_wp8.addSteps(PlatformTest_WP8().get_all_steps())
+ c['builders'].append(BuilderConfig(name="WP8", slavenames=["windows-slave"], factory=factory_wp8))
+ c['builders'].append(BuilderConfig(name="WP8_vs2012_win8", slavenames=["win8-slave"], factory=factory_wp8))
+
+if(build_windows8):
factory_windows8 = BuildFactory()
- factory_windows8.addStep(ShellCommand(command=["rm","-rf","%userprofile%/.cordova/lib/windows8"],workdir='build',haltOnFailure=False,description='Remove cache',descriptionDone='Remove cache'))
- factory_windows8.addSteps(common_steps_1)
- factory_windows8.addStep(ShellCommand(command=["node","./cordova-coho/coho","repo-clone","-r","plugins","-r","mobile-spec","-r","windows","-r","js"],workdir='build',haltOnFailure=True,description='COHO Clone', descriptionDone='COHO Clone'))
- factory_windows8.addStep(ShellCommand(command=["node","./cordova-coho/coho","repo-update","-r","plugins","-r","mobile-spec","-r","windows","-r","js"],workdir='build',haltOnFailure=True,description='COHO Update', descriptionDone='COHO Update'))
- # TODO find the way to specify cli branch to clone for COHO, currently use step below
- factory_windows8.addStep(ShellCommand(command=["git","clone","-b",branches['CLI'],repos['CLI'],"cordova-cli"],workdir='build',haltOnFailure=True, description='Get CLI', descriptionDone='Get CLI'))
- factory_windows8.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLUGIN","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Plugins->master',descriptionDone='Plugins->master'))
- factory_windows8.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLATFORM","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Platform->master',descriptionDone='Platform->master'))
- factory_windows8.addSteps(common_steps_mobilespec_1)
- factory_windows8.addStep(ShellCommand(command=["node","medic/writejson.js","--branch=master"],workdir='build',haltOnFailure=True, description='Write json',descriptionDone='Write json'))
- factory_windows8.addStep(ShellCommand(command=["node","../cordova-cli/bin/cordova","platform","add","windows8"],workdir='build/mobilespec',haltOnFailure=True, description='Platform Add',descriptionDone='Platform Add'))
- factory_windows8.addSteps(common_steps_js)
- factory_windows8.addSteps(common_steps_mobilespec_2)
- factory_windows8.addStep(ShellCommand(command=["cp","-f","cordova-js/pkg/cordova.windows8.js","mobilespec/platforms/windows8/platform_www/cordova.js"],workdir='build',haltOnFailure=True,description='Copy JS',descriptionDone='Copy JS'))
- factory_windows8.addStep(ShellCommand(command=["node", "medic/build_windows8.js"], workdir='build', timeout=600,description='Deploy Windows 8',descriptionDone='Deploy Windows8',name='Deploy Windows 8'))
-
- c['builders'].append(BuilderConfig(name="Windows8_Master",slavenames=["windows-slave"], factory=factory_windows8))
-
-if(build_blackberry) :
+ factory_windows8.addSteps(PlatformTest_Windows8().get_all_steps())
+ c['builders'].append(BuilderConfig(name="Windows8", slavenames=["windows-slave"], factory=factory_windows8))
+ c['builders'].append(BuilderConfig(name="Windows8_vs2012_win8", slavenames=["win8-slave"], factory=factory_windows8))
+
+if(build_blackberry):
factory_BlackBerry = BuildFactory()
- factory_BlackBerry.addStep(ShellCommand(command=["rm","-rf","~/.cordova/lib/blackberry10"],workdir='build',haltOnFailure=False,description='Remove cache',descriptionDone='Remove cache'))
- factory_BlackBerry.addSteps(common_steps_1)
- factory_BlackBerry.addStep(ShellCommand(command=["./cordova-coho/coho","repo-clone","-r plugins","-r","mobile-spec","-r","blackberry","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Clone', descriptionDone='COHO Clone'))
- factory_BlackBerry.addStep(ShellCommand(command=["./cordova-coho/coho","repo-update","-r plugins","-r","mobile-spec","-r","blackberry","-r","cli","-r","js"],workdir='build',haltOnFailure=True,description='COHO Update', descriptionDone='COHO Update'))
- factory_BlackBerry.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLUGIN","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Plugins->dev',descriptionDone='Plugins->dev'))
- factory_BlackBerry.addStep(ShellCommand(command=["node","medic/checkout.js","--path=../../../repos.json","--cat=PLATFORM","--releasebranch="+branch_release],workdir='build',haltOnFailure=False,description='Platform->master',descriptionDone='Platform->master'))
- factory_BlackBerry.addSteps(common_steps_mobilespec_1)
- factory_BlackBerry.addStep(ShellCommand(command=["node","medic/writejson.js","--branch=master"],workdir='build',haltOnFailure=True, description='Write json',descriptionDone='Write json'))
- factory_BlackBerry.addStep(ShellCommand(command=["../cordova-cli/bin/cordova","platform","add","blackberry10"],workdir='build/mobilespec',haltOnFailure=True, description='Platform Add',descriptionDone='Platform Add'))
- factory_BlackBerry.addSteps(common_steps_js)
- factory_BlackBerry.addSteps(common_steps_mobilespec_2)
- factory_BlackBerry.addSteps(ShellCommand(command=["node", "../cordova-cli/bin/cordova", "plugin", "rm", "org.apache.cordova.core.medic"],workdir='build/mobilespec',haltOnFailure=True,description='Medic plugin add',descriptionDone='Medic plugin removed')),
- factory_BlackBerry.addStep(ShellCommand(command=["cp", "-f", "cordova-js/pkg/cordova.blackberry10.js", "mobilespec/platforms/blackberry10/platform_www/cordova.js"],workdir='build',haltOnFailure=True,description='Copy JS',descriptionDone='Copy JS'))
- factory_BlackBerry.addStep(ShellCommand(command=["cp", "platforms/blackberry10/www/config.xml", "./config.xml"],workdir='build/mobilespec',haltOnFailure=True,description='Plugin add',descriptionDone='Replace config.xml'))
- factory_BlackBerry.addStep(ShellCommand(command=["node", "medic/build_blackberry10.js"], workdir='build', timeout=600,description='Deploy BlackBerry',descriptionDone='Deploy BlackBerry',name='Deploy BlackBerry10'))
- c['builders'].append(BuilderConfig(name="BlackBerry_Master",slavenames=["blackberry-slave"],factory=factory_BlackBerry))
-
-
-# TODO. temporary disable separate cli and plugman tests on Windows
-if not is_Windows :
- factory_cli = BuildFactory()
- factory_cli.addSteps(cli_steps)
- c['builders'].append(BuilderConfig(name="Tools_CLI",slavenames=["common-slave"],factory=factory_cli))
+ factory_BlackBerry.addSteps(PlatformTest_Blackberry().get_all_steps())
+ c['builders'].append(BuilderConfig(name="BlackBerry", slavenames=["blackberry-slave"], factory=factory_BlackBerry))
+
+# TODO switch on
+# factory_cli = BuildFactory()
+# factory_cli.addStep(ShellCommand(command=["rm","-rf","cordova-*"],workdir='build',haltOnFailure=False,description='Cordova Clean'))
+# factory_cli.addSteps(cli_steps)
+# c['builders'].append(BuilderConfig(name="Tools_CLI",slavenames=["common-slave"],factory=factory_cli))
# factory_plugman = BuildFactory()
# factory_plugman.addSteps(plugman_steps)
# c['builders'].append(BuilderConfig(name="Tools_Plugman",slavenames=["common-slave"],factory=factory_plugman))
-if build_chrome :
+if build_chrome:
factory_chrome_desktop = BuildFactory()
- factory_chrome_desktop.addStep(ShellCommand(command=["rm","-rf","medic"],workdir='build',haltOnFailure=False,description='Medic Clean',descriptionDone='Medic Clean'))
- factory_chrome_desktop.addStep(ShellCommand(command=["git","clone","-b",branches['TESTMASTER'],repos['TESTMASTER'],"medic"],workdir='build',haltOnFailure=True, description='Get Medic', descriptionDone='Get Medic'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["rm", "-rf", "medic"], workdir='build', haltOnFailure=False, description='Medic Clean', descriptionDone='Medic Clean'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["git", "clone", "-b", branches['TESTMASTER'], repos['TESTMASTER'], "medic"], workdir='build', haltOnFailure=True, description='Get Medic', descriptionDone='Get Medic'))
# --production switch is used to speed up installation + fruitstrap dev dependency is not supported on Windows
- factory_chrome_desktop.addStep(ShellCommand(command=["npm","install","--production"], workdir='build/medic',haltOnFailure=True,description='Install Medic',descriptionDone='Install Medic'))
- factory_chrome_desktop.addStep(ShellCommand(command=["rm","-rf","mobile-chrome-apps"],workdir='build',haltOnFailure=True, description='Clean Chromespec',descriptionDone='Clean Chromespec'))
- factory_chrome_desktop.addStep(ShellCommand(command=["git","clone",repos['CCA']],workdir='build',haltOnFailure=True, description='Fetch Chromespec',descriptionDone='Fetch Chromespec'))
- factory_chrome_desktop.addStep(ShellCommand(command=["npm","install"],workdir='build/medic/runner',haltOnFailure=True, description='Install Runner',descriptionDone='Install Runner'))
- factory_chrome_desktop.addStep(ShellCommand(command=["node","medic/runner/testrunner.js","--cmd=medic/runner/runchrome.sh","--path=mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests","--args=mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests"],workdir='build',haltOnFailure=True, description='Run Chrome',descriptionDone='Run Chrome'))
- c['builders'].append(BuilderConfig(name="ZChrome_Desktop",slavenames=["common-slave"], factory=factory_chrome_desktop))
+ factory_chrome_desktop.addStep(ShellCommand(command=["npm", "install", "--production"], workdir='build/medic', haltOnFailure=True, description='Install Medic', descriptionDone='Install Medic'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["rm", "-rf", "mobile-chrome-apps"], workdir='build', haltOnFailure=True, description='Clean Chromespec', descriptionDone='Clean Chromespec'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["git", "clone", repos['CCA']], workdir='build', haltOnFailure=True, description='Fetch Chromespec', descriptionDone='Fetch Chromespec'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["npm", "install"], workdir='build/medic/runner', haltOnFailure=True, description='Install Runner', descriptionDone='Install Runner'))
+ factory_chrome_desktop.addStep(ShellCommand(command=["node", "medic/runner/testrunner.js", "--cmd=medic/runner/runchrome.sh", "--path=mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests", "--args=mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests"], workdir='build', haltOnFailure=True, description='Run Chrome', descriptionDone='Run Chrome'))
+ c['builders'].append(BuilderConfig(name="ZChrome_Desktop", slavenames=["common-slave"], factory=factory_chrome_desktop))
factory_chrome_mobile = BuildFactory()
- factory_chrome_mobile.addStep(ShellCommand(command=["rm","-rf","medic"],workdir='build',haltOnFailure=False,description='Medic Clean',descriptionDone='Medic Clean'))
- factory_chrome_mobile.addStep(ShellCommand(command=["git","clone","-b",branches['TESTMASTER'],repos['TESTMASTER'],"medic"],workdir='build',haltOnFailure=True, description='Get Medic', descriptionDone='Get Medic'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["rm", "-rf", "medic"], workdir='build', haltOnFailure=False, description='Medic Clean', descriptionDone='Medic Clean'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["git", "clone", "-b", branches['TESTMASTER'], repos['TESTMASTER'], "medic"], workdir='build', haltOnFailure=True, description='Get Medic', descriptionDone='Get Medic'))
# --production switch is used to speed up installation + fruitstrap dev dependency is not supported on Windows
- factory_chrome_mobile.addStep(ShellCommand(command=["npm","install","--production"], workdir='build/medic',haltOnFailure=True,description='Install Medic',descriptionDone='Install Medic'))
- factory_chrome_mobile.addStep(ShellCommand(command=["npm","install"],workdir='build/medic/runner',haltOnFailure=True, description='Install Runner',descriptionDone='Install Runner'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["npm", "install", "--production"], workdir='build/medic', haltOnFailure=True, description='Install Medic', descriptionDone='Install Medic'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["npm", "install"], workdir='build/medic/runner', haltOnFailure=True, description='Install Runner', descriptionDone='Install Runner'))
- factory_chrome_mobile.addStep(ShellCommand(command=["rm","-rf","mobile-chrome-apps"],workdir='build',haltOnFailure=True, description='Clean cca',descriptionDone='Clean cca'))
- factory_chrome_mobile.addStep(ShellCommand(command=["git","clone","--recurse-submodules",repos['CCA']],workdir='build',haltOnFailure=True, description='Fetch cca',descriptionDone='Fetch cca'))
- factory_chrome_mobile.addStep(ShellCommand(command=["npm","install"],workdir='build/mobile-chrome-apps',haltOnFailure=True, description='Install cca',descriptionDone='Install cca'))
- factory_chrome_mobile.addStep(ShellCommand(command=["rm","-rf","ccatest"],workdir='build',haltOnFailure=True, description='Clean ccatest',descriptionDone='Clean ccatest'))
- factory_chrome_mobile.addStep(ShellCommand(command=["mobile-chrome-apps/src/cca.js","create","ccatest","--copy-from","mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests"],workdir='build',haltOnFailure=True, description='cca create',descriptionDone='cca create'))
-
- factory_chrome_mobile.addStep(ShellCommand(command=["node","../medic/runner/testrunner.js","--ip=192.168.1.122","--port=6800","--cmd=../medic/runner/runcca.sh","--path=www","--args=android"],workdir='build/ccatest',timeout=300,haltOnFailure=True, description='Run Mobile',descriptionDone='Run Mobile'))
- c['builders'].append(BuilderConfig(name="ZChrome_Mobile",slavenames=["android-slave"], factory=factory_chrome_mobile))
+ factory_chrome_mobile.addStep(ShellCommand(command=["rm", "-rf", "mobile-chrome-apps"], workdir='build', haltOnFailure=True, description='Clean cca', descriptionDone='Clean cca'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["git", "clone", "--recurse-submodules", repos['CCA']], workdir='build', haltOnFailure=True, description='Fetch cca', descriptionDone='Fetch cca'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["npm", "install"], workdir='build/mobile-chrome-apps', haltOnFailure=True, description='Install cca', descriptionDone='Install cca'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["rm", "-rf", "ccatest"], workdir='build', haltOnFailure=True, description='Clean ccatest', descriptionDone='Clean ccatest'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["mobile-chrome-apps/src/cca.js", "create", "ccatest", "--copy-from", "mobile-chrome-apps/chrome-cordova/chrome-apps-api-tests"], workdir='build', haltOnFailure=True, description='cca create', descriptionDone='cca create'))
+ factory_chrome_mobile.addStep(ShellCommand(command=["node", "../medic/runner/testrunner.js", "--ip=192.168.1.122", "--port=6800", "--cmd=../medic/runner/runcca.sh", "--path=www", "--args=android"], workdir='build/ccatest', timeout=300, haltOnFailure=True, description='Run Mobile', descriptionDone='Run Mobile'))
+ c['builders'].append(BuilderConfig(name="ZChrome_Mobile", slavenames=["android-slave"], factory=factory_chrome_mobile))
####### STATUS TARGETS
-
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
@@ -369,37 +428,31 @@ c['status'] = []
from buildbot.status import html
from buildbot.status.web import authz, auth
-from buildbot.status import mail
-from buildbot.status.builder import Results
from buildbot.status.mail import MailNotifier
-authz_cfg=authz.Authz(
- # change any of these to True to enable; see the manual for more
- # options
- auth=auth.BasicAuth([("Cordova","Cordova")]),
- gracefulShutdown = False,
- forceBuild = True, # 'auth', # use this to test your slave once it is set up
- forceAllBuilds = False,
- pingBuilder = False,
- stopBuild = False,
- stopAllBuilds = False,
- cancelPendingBuild = False,
-)
-c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
-
-
-mn1 = MailNotifier(
- fromaddr=mail_from,
- sendToInterestedUsers=False,
- mode=('change',),
- extraRecipients=mail_to,
- relayhost='smtp.gmail.com',
- smtpPort=587,
- useTls=True,
- smtpUser=mail_from,
- smtpPassword=mail_pw,
-)
+# change any of these to True to enable; see the manual for more options
+authz_cfg = authz.Authz(auth=auth.BasicAuth([("Cordova", "Cordova")]),
+ gracefulShutdown=False,
+ forceBuild=True, # 'auth', # use this to test your slave once it is set up
+ forceAllBuilds=False,
+ pingBuilder=False,
+ stopBuild=False,
+ stopAllBuilds=False,
+ cancelPendingBuild=False,
+ )
+
+mn1 = MailNotifier(fromaddr=mail_from,
+ sendToInterestedUsers=False,
+ mode=('change',),
+ extraRecipients=mail_to,
+ relayhost='smtp.gmail.com',
+ smtpPort=587,
+ useTls=True,
+ smtpUser=mail_from,
+ smtpPassword=mail_pw,
+ )
+c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
c['status'].append(mn1)
####### PROJECT IDENTITY
@@ -424,5 +477,5 @@ c['buildbotURL'] = mail_serverURL
c['db'] = {
# This specifies what database buildbot uses to store its state. You can leave
# this at its default for all but the largest installations.
- 'db_url' : "sqlite:///state.sqlite",
+ 'db_url': "sqlite:///state.sqlite",
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[7/8] git commit: Added back logic to update cordova repos instead of
re-cloning them
Posted by sg...@apache.org.
Added back logic to update cordova repos instead of re-cloning them
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/93820649
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/93820649
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/93820649
Branch: refs/heads/master
Commit: 93820649a50c35d75cf9d2bcda8690296c10a767
Parents: 613e421
Author: sgrebnov <v-...@microsoft.com>
Authored: Wed Aug 6 15:52:28 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:53 2014 +0400
----------------------------------------------------------------------
master.cfg | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/93820649/master.cfg
----------------------------------------------------------------------
diff --git a/master.cfg b/master.cfg
index 3862406..df0830f 100644
--- a/master.cfg
+++ b/master.cfg
@@ -196,7 +196,7 @@ class PlatformTestBase(object):
def init_workspace_steps(self):
return [
ShellCommand(command=["rm", "-rf", "~/.cordova/" + self.platform], workdir='build', haltOnFailure=False, description='Remove cache'),
- ShellCommand(command=["node", "-e", "require('child_process').exec('rm -rf medic mobilespec/www mobilespec cordova-*')"], workdir='build', haltOnFailure=False, description='Clean workdir'),
+ ShellCommand(command=["rm", "-rf", "medic", "mobilespec", "cordova-mobile-spec", "cordova-coho", "cordova-cli", "cordova-lib"], workdir='build', haltOnFailure=False, description='Clean workdir'),
ShellCommand(command=["git", "clone", "-b", branches['TESTMASTER'], repos['TESTMASTER'], "medic"], workdir='build', haltOnFailure=True, description='Get Medic'),
# --production switch is used to speed up installation + fruitstrap dev dependency is not supported on Windows
ShellCommand(command=["npm", "install", "--production"], workdir='build/medic', haltOnFailure=True, description='Install Medic'),
@@ -215,6 +215,7 @@ class PlatformTestBase(object):
platform = "windows"
return [
ShellCommand(command=["./cordova-coho/coho", "repo-clone", "-r", "plugins", "-r", "mobile-spec", "-r", platform, "-r", "js"], workdir='build', haltOnFailure=True, description='COHO Clone'),
+ ShellCommand(command=["./cordova-coho/coho", "repo-update", "-r", "plugins", "-r", "mobile-spec", "-r", platform, "-r", "js"], workdir='build', haltOnFailure=True, description='COHO Update'),
ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=PLUGIN", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout Plugins'),
ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=PLATFORM", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout Platform'),
ShellCommand(command=["node", "medic/checkout.js", "--path=medic/repos.json", "--cat=JS", "--releasebranch=" + branch_release], workdir='build', haltOnFailure=False, description='Checkout JS')
@@ -380,11 +381,12 @@ if(build_blackberry):
factory_BlackBerry.addSteps(PlatformTest_Blackberry().get_all_steps())
c['builders'].append(BuilderConfig(name="BlackBerry", slavenames=["blackberry-slave"], factory=factory_BlackBerry))
-# TODO switch on
-# factory_cli = BuildFactory()
-# factory_cli.addStep(ShellCommand(command=["rm","-rf","cordova-*"],workdir='build',haltOnFailure=False,description='Cordova Clean'))
-# factory_cli.addSteps(cli_steps)
-# c['builders'].append(BuilderConfig(name="Tools_CLI",slavenames=["common-slave"],factory=factory_cli))
+# TODO. temporary disable separate cli and plugman tests on Windows
+if not platform.system() == "Windows" :
+ factory_cli = BuildFactory()
+ factory_cli.addStep(ShellCommand(command=["rm","-rf","cordova-*"],workdir='build',haltOnFailure=False,description='Cordova Clean'))
+ factory_cli.addSteps(cli_steps)
+ c['builders'].append(BuilderConfig(name="Tools_CLI",slavenames=["common-slave"],factory=factory_cli))
# factory_plugman = BuildFactory()
# factory_plugman.addSteps(plugman_steps)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[6/8] git commit: Updates README with actual configuration and notes.
(+1 squashed commits)
Posted by sg...@apache.org.
Updates README with actual configuration and notes. (+1 squashed commits)
Squashed commits:
[c9d38ac] updates documentation
Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/613e4214
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/613e4214
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/613e4214
Branch: refs/heads/master
Commit: 613e42149e378e1133c63514fd8bf2222991dac7
Parents: 36a7967
Author: sgrebnov <v-...@microsoft.com>
Authored: Tue Aug 5 18:05:51 2014 +0400
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Wed Oct 1 12:07:52 2014 +0400
----------------------------------------------------------------------
README.md | 67 ++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 46 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/613e4214/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index dde9925..d73f9bd 100644
--- a/README.md
+++ b/README.md
@@ -7,29 +7,51 @@ Medic using BuildBot
- On Mac
- iOS
- Android
-- On Windows
+- On Windows
+ - Android
- Windows Phone 8
- - Windows 8
+ - Windows Universal Apps (Windows 8.0, Windows 8.1, Windows Phone 8.1)
#Installation
##Select target OS
Install on a Mac or Windows depending on target test platform(s)
+##Install prerequisites
+medic requires grunt-cli npm package to be installed globally. You can install it by typing `npm install -g grunt-cli` in console.
+
+**Note:** this requires admin privileges on Mac OS.
+
## Setup CouchDB
-1. Get and install [couchdb] (http://couchdb.apache.org/) 1.3.1
+1. Get and install [couchdb](http://couchdb.apache.org/) 1.3.1
2. Edit the local.ini to accept request from external host
`bind_address = 0.0.0.0`
+
+ Also you may need to add appropriate firewall rules for port 5984.
+
+ To test access to CouchDB portal try to open \<CouchDB host IP\>:5984 from browser
-3. Create the following three databases:
+3. Create the following three databases (functionality for creating of them should be available on \<CouchDB host IP\>:5984/_utils/):
- build_errors
- mobilespec_results
- test_details
-4. Set up a wireless access point so that the devices being tested can access the couchDB
+4. Add new document to `mobilespec_results` table with the following contents:
+ ```
+ {
+ "_id": "_design/results",
+ "views": {
+ "sha": {
+ "map": "function(doc){emit(doc.sha, {\"total\":doc.mobilespec.total,\"passed\":(doc.mobilespec.total - doc.mobilespec.failed),\"version\":doc.version,\"model\":doc.model,\"fails\":doc.mobilespec.failures});}"
+ }
+ }
+ }
+ ```
+
+5. Set up a wireless access point so that the devices being tested can access the couchDB
## Install BuildBot
-1. Get [buildbot] (http://buildbot.net) version 0.8.8
+1. Get [buildbot](http://buildbot.net) version 0.8.8
2. Install buildbot using the buildbot install/tutorial instructions
http://docs.buildbot.net/latest/manual/installation.html
@@ -51,6 +73,11 @@ Install on a Mac or Windows depending on target test platform(s)
- On Windows
- config.json.sample-windows - copy to the buildbot base directory, then edit for local ip
+7. Update config.json
+ - Replace `http://localcouchdb:5984` with CouchDB host address
+
+ **Note:** couchdb host must be specified via ip address due to windows platform restrictions.
+
#Running the System
- start the master with ~buildbot start master
- start the slaves with:
@@ -74,9 +101,6 @@ Install on a Mac or Windows depending on target test platform(s)
- new platforms, test procedures, build steps, etc require edits to master.cfg and repos.json which should still be global (all platforms)
- whenever config.json, repos.json or master.cfg changes, you need to restart the master (not slaves)
-**Note:** if you install the master on a separate machine from the slave(s), the config.json must be on both machines.
-The slaves expect to find the file in the buildbot root and require the ios key information, couchdb IP and the start page.
-
#Overview
Buildbot polls all the repositories every few minutes to look for changes. Whenever a change is detected, those changes trigger one or more build requests.
@@ -89,7 +113,7 @@ At the start of each test run, the collection of components (git repositories) a
The DB ref from this document is used as the SHA for the test and is what is recorded in mobilespec_results or build_errors
The various test runners are configured to report a fail/pass by device and the buildbot display will report FAIL if any test on any device fails.
-every command has a link to its output o the main display. When a mobile spec test completes, there is a link to the test result written to the output log.
+every command has a link to its output on the main display. When a mobile spec test completes, there is a link to the test result written to the output log.
#Current Test Configuration
- All slaves (Android, iOS, Windows) are configured to only run a single test at a time.
@@ -99,37 +123,38 @@ every command has a link to its output o the main display. When a mobile spec te
- Android tests:
- platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in)
- platform and mobilspec 3.0.x branch with the cordova-js embedded in the cordova-android repo, plugins from master
+ - There are additional builder (AndroidWin), which perform builds of mobilespec application for Android in Windows environment.
- iOS tests:
- platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in)
- platform and mobilspec 3.0.x branch with the cordova-js embedded in the cordova-ios repo, plugins from master
- Windows Phone8 tests:
- - platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in)
+ - platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in).
+ - There are two separate builders, which performs builds in different environments (VS2012 + MSBuild 4.0 / VS2013 + MSBuild 12.0)
- Windows8 tests:
- platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in)
- Tests are executed on Local Machine, no support to run tests on connected device.
+- Windows Universal platform tests:
+ - platform, mobilespec, js, and plugins from master branch (cordova-js is built and copied in)
+ - Tests are executed on Local Machine, mobilespec app for --phone target is launched on emulator. Running mobilespec app on attached devices not supported yet.
+ - There are two separate builders, which performs builds in different environments (VS2012 + MSBuild 4.0 / VS2013 + MSBuild 12.0)
+
The tests use COHO and CLI for as much as possible to ensure that the developer tool chain is working.
#Configuration Files
-master.cfg: The main configuration file for buildbot. It is a python script and defines the triggers, builders and status display.
+**master.cfg:** The main configuration file for buildbot. It is a python script and defines the triggers, builders and status display.
It uses both config.json and repos.json to determine which platforms and versions to test.
-config.json:
-Used by the buildbot master script and by some of the medic command-line tools.
+**config.json:** Used by the buildbot master script and by some of the medic command-line tools.
It defines the platforms to test, the current release version, the couchdb url, and the ios keychain.
The release version specified here is used anywhere the keyword "RELEASE" is used in a test definition.
-
-repos.json:
-Contains the definitions for the tests (schedulers) and the various repositories in the project.
+**repos.json:** Contains the definitions for the tests (schedulers) and the various repositories in the project.
Tests define the components and branches that should trigger a test run.
This requires multiple triggers for each test path since a build might use tools from master, platforms from release and plugins from dev.
For each repo there is a release branch (most recent supported release) and a current branch (tip-of-tree).
-The branches are used by the python script in conjunction with the tests to set up the trggers.
-
-
-
+The branches are used by the python script in conjunction with the tests to set up the trggers.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org