diff --git a/corimf-build-wp8.js b/corimf-build-wp8.js index f39ceae..b531446 100644 --- a/corimf-build-wp8.js +++ b/corimf-build-wp8.js @@ -46,9 +46,10 @@ var WP8BuildSpecifics = function(DPO) { //build mobilespec in visual studio if (settings.MOBILESPEC) { - //register www files - addWWWForMobileSpec(DPO.MOBILESPEC_DIR, DPO.PROJECT_NAME+'.csproj'); - + var majorBranchNum = Number(settings.BRANCH.substring(0,3)); + if (majorBranchNum < 3.6) { + addWWWForMobileSpec(DPO.MOBILESPEC_DIR, DPO.PROJECT_NAME+'.csproj'); + } tests.reportStatus(shelljs.exec('msbuild' + ' ' + path.join(DPO.MOBILESPEC_DIR, DPO.PROJECT_NAME +'.sln') + ' ' +'/p:Configuration=Release', {silent:false}).code == 0); } diff --git a/corimf-build.js b/corimf-build.js index c0b2033..00e0d59 100644 --- a/corimf-build.js +++ b/corimf-build.js @@ -117,6 +117,10 @@ var RunPreliminaryTests = function(platformSpecificCode) { repos = settings.PLUGINS.concat(settings.PLATFORM_REPO); if (settings.PLUGMAN_REPO.length > 0) repos = repos.concat(settings.PLUGMAN_REPO); + // We will also need these platform-independent repos + repos = repos.concat(['cordova-mobile-spec']); + if (Number(settings.BRANCH.substring(0,3)) >= 3.6) + repos = repos.concat(['cordova-plugin-test-framework']); // If not building project only, git-archive the branch that is desired if(!settings.PROJECT_ONLY) { @@ -152,6 +156,7 @@ var RunPreliminaryTests = function(platformSpecificCode) { } } // If not building project only, make sure that the branch matches the latest tag in Git + // If not building project only, make sure that the branch matches the latest tag in Git else { for (var i = 0; i < repos.length; i++) { console.log(repos[i] + ': '); @@ -207,6 +212,7 @@ var BuildProject = function(platformSpecificCode) { var MOBILESPEC_DIR = 'mobilespec-' + platform + '-' + settings.NEW_TAG; var PROJECT_NAME = platform === "wp8" ? 'WPCordovaClassLib' : 'example'; var pathProject = pathCorimf + path.sep + PROJECT_DIR; + var pathMobileSpec = pathCorimf + path.sep + MOBILESPEC_DIR; var pathSnapshot = tmpDir + path.sep + SNAPSHOT_DIR; console.log('Checking that project ' + PROJECT_DIR + ' does not exist yet...'); @@ -232,6 +238,8 @@ var BuildProject = function(platformSpecificCode) { //build mobilespec if(settings.MOBILESPEC) { + var majorBranchNum = Number(settings.BRANCH.substring(0,3)); + var WWW_DIR; if(platform == "android") WWW_DIR = path.join('assets','www'); @@ -242,8 +250,58 @@ var BuildProject = function(platformSpecificCode) { console.log('Checking that project ' + MOBILESPEC_DIR + ' does not exist yet...'); reportStatus(!shelljs.test('-d', MOBILESPEC_DIR)); - shelljs.cp('-R', path.join(PROJECT_DIR,'*'), MOBILESPEC_DIR); - shelljs.cp('-Rf', path.join(process.cwd(),'cordova-mobile-spec','*'), path.join(MOBILESPEC_DIR, WWW_DIR)); + console.log('Creating a new ' + platform.toUpperCase() + ' Project...'); + cmd = execPath + ' ' + MOBILESPEC_DIR + ' ' + PROJECT_NAME + ' ' + PROJECT_NAME; + tests.reportStatus(shelljs.exec(cmd, {silent : false}).code == 0); + + console.log('Copying mobile-spec resources into project www...'); + var resourcesPath; + if (majorBranchNum >= 3.6) { + resourcesPath = path.join(tmpDir, 'cordova-mobile-spec', 'www', '*'); + } else { + resourcesPath = path.join(tmpDir, 'cordova-mobile-spec', '*'); + } + shelljs.cp("-rf", resourcesPath, path.join(MOBILESPEC_DIR, WWW_DIR)); + + // copy config.xml + shelljs.cp("-f", path.join(tmpDir, 'cordova-mobile-spec', "config.xml"), MOBILESPEC_DIR); + + console.log('Installing plugins into project...'); + var pathPlugman = path.join(pathCorimf, settings.PLUGMAN_REPO, 'main.js'); + var baseCommand = 'node ' + pathPlugman + ' --debug install --platform ' + platform + ' --project ' + pathMobileSpec + ' --plugin '; + + // console.log('Installing core plugins...'); + for (var i = 0; i < settings.PLUGINS.length; i++) { + var execCommand = baseCommand + tmpDir + path.sep + settings.PLUGINS[i]; + reportStatus((execOutput = shelljs.exec(execCommand, {silent:true})).code == 0, execOutput.output); + } + + if (majorBranchNum >= 3.0) { + // Install echo and whitelist plugins + console.log('Installing echo and whitelist...'); + + var execCommand = baseCommand + path.join(tmpDir, 'cordova-mobile-spec', 'cordova-plugin-whitelist'); + reportStatus((execOutput = shelljs.exec(execCommand, {silent:true})).code == 0, execOutput.output); + + execCommand = baseCommand + path.join(tmpDir, 'cordova-mobile-spec', 'cordova-plugin-echo'); + reportStatus((execOutput = shelljs.exec(execCommand, {silent:true})).code == 0, execOutput.output); + } + + if (majorBranchNum >= 3.6) { + // Install plugin-test-framework and the test plugins + console.log('Installing new-style plugin tests...'); + + var execCommand = baseCommand + tmpDir + path.sep + 'cordova-plugin-test-framework'; + shelljs.exec(execCommand, {silent:true}); + + for (var i = 0; i < settings.PLUGINS.length; i++) { + var potentialPlugin = path.join(settings.PLUGINS[i], 'tests'); + if (fs.existsSync(potentialPlugin)) { + var testsCommand = baseCommand + tmpDir + path.sep + potentialPlugin; + reportStatus(shelljs.exec(testsCommand, {silent:true}).code == 0); + } + } + } } //Execute platform specific code to populate SNAPSHOT_DIR, moving needed files & directories into SNAPSHOT_DIR diff --git a/corimf-settings-js.sample b/corimf-settings-js.sample index 88650f7..831b8a6 100644 --- a/corimf-settings-js.sample +++ b/corimf-settings-js.sample @@ -65,9 +65,9 @@ var PLATFORM_REPO = 'cordova-wp8', PLUGIN_COUNT = 18, - PLUGINS = ['cordova-plugin-battery-status', 'cordova-plugin-camera', 'cordova-plugin-console', 'cordova-plugin-contacts', 'cordova-plugin-device', 'cordova-plugin-device-motion', 'cordova-plugin-device-orientation', 'cordova-plugin-dialogs', 'cordova-plugin-file', 'cordova-plugin-file-transfer', 'cordova-plugin-geolocation', 'cordova-plugin-globalization', 'cordova-plugin-inappbrowser', 'cordova-plugin-media', 'cordova-plugin-media-capture', 'cordova-plugin-network-information', 'cordova-plugin-splashscreen', 'cordova-plugin-vibration'], + PLUGINS = ['cordova-plugin-battery-status', 'cordova-plugin-camera', 'cordova-plugin-console', 'cordova-plugin-contacts', 'cordova-plugin-device', 'cordova-plugin-device-motion', 'cordova-plugin-device-orientation', 'cordova-plugin-dialogs', 'cordova-plugin-file', 'cordova-plugin-file-transfer', 'cordova-plugin-geolocation', 'cordova-plugin-globalization', 'cordova-plugin-inappbrowser', 'cordova-plugin-media', 'cordova-plugin-media-capture', 'cordova-plugin-network-information', 'cordova-plugin-statusbar', 'cordova-plugin-splashscreen', 'cordova-plugin-vibration'], PLATFORM_REPOS = ['cordova-android', 'cordova-blackberry', 'cordova-ios', 'cordova-windows', 'cordova-wp8', 'cordova-js'], - OTHER_REPOS = ['cordova-blackberry-plugins', 'cordova-cli', 'cordova-plugman']; + OTHER_REPOS = ['cordova-blackberry-plugins', 'cordova-cli', 'cordova-plugman', 'cordova-mobile-spec', 'cordova-plugin-test-framework']; exports.PLATFORM_REPO = PLATFORM_REPO; exports.PROJECT_ONLY = PROJECT_ONLY;