Permalink
Browse files

Reworked build/dist strategy.

Now deployment includes both core and cluster operating mode boot packs.
  • Loading branch information...
marcominetti committed Sep 29, 2015
1 parent 1e8f2d0 commit 103662d79a0c643487b413a4fb5ac773b9acda0c
View
@@ -27,7 +27,6 @@
"linenums": false
},
"opts": {
- "destination": "./dist/docs/",
"encoding": "utf8",
"private": false,
"recurse": true,
View
@@ -232,7 +232,7 @@ bootstrap.post = async function() {
// preloading core bootstrap modules or boot pack
//TODO: support remote build store
- var boot_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/boot/core.server.js.boot');
+ var boot_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/core/boot/core.server.js.boot');
if (process.env.BUILD == null && native.fs.existsSync(boot_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : '')) === true){
console.log('preloading built-in core boot modules');
require(boot_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : ''));
@@ -282,7 +282,7 @@ bootstrap.post = async function() {
// loading core modules or core pack
//TODO: support remote build store
- var core_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/boot/core.server.js');
+ var core_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/core/boot/core.server.js');
if (process.env.BUILD == null && native.fs.existsSync(core_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : '')) === true){
console.log('loading built-in core modules');
require(core_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : ''));
@@ -393,7 +393,7 @@ bootstrap.post = async function() {
// preloading bootstrap modules or boot pack
//TODO: support remote build store
- var boot_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/boot/' + platform.cluster.worker.role + '.server.js.boot');
+ var boot_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/cluster/boot/' + platform.cluster.worker.role + '.server.js.boot');
if (process.env.BUILD == null && native.fs.existsSync(boot_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : '')) === true){
console.log('preloading built-in boot modules');
require(boot_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : ''));
@@ -448,7 +448,7 @@ bootstrap.post = async function() {
// loading modules or core pack
//TODO: support remote build store
- var core_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/boot/' + platform.cluster.worker.role + '.server.js');
+ var core_dist_path = native.path.join(platform.configuration.runtime.path.core,'dist/cluster/boot/' + platform.cluster.worker.role + '.server.js');
if (process.env.BUILD == null && native.fs.existsSync(core_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : '')) === true){
console.log('loading built-in %s core modules', platform.cluster.worker.role);
require(core_dist_path + ((platform.configuration.runtime.development === false) ? '.min' : ''));
@@ -44,12 +44,12 @@ global.main.commands['_.dist.cluster'] = function () {
var optimizer = args._[1] || args.optimizer || 'uglify';
if (fs.existsSync(path.join(global.main.path.core, '/build/pack/master.server.js')) === true) {
- if (fs.existsSync(path.join(global.main.path.core, '/dist/')) === true) {
- rmdirSync(path.join(global.main.path.core, '/dist/'));
+ if (fs.existsSync(path.join(global.main.path.core, '/dist/cluster/')) === true) {
+ rmdirSync(path.join(global.main.path.core, '/dist/cluster/'));
}
- fs.mkdirSync(path.join(global.main.path.core, '/dist/'));
- fs.mkdirSync(path.join(global.main.path.core, '/dist/docs/'));
- fs.mkdirSync(path.join(global.main.path.core, '/dist/boot/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/cluster/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/cluster/docs/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/cluster/boot/'));
var tasks = [];
@@ -63,6 +63,8 @@ global.main.commands['_.dist.cluster'] = function () {
global.main.path.core + '/build/pack/runtime.server.js',
'-c',
global.main.path.core + '/.jsdocrc',
+ '-d',
+ global.main.path.core + '/dist/cluster/docs/',
'--verbose'
], {
stdio: 'inherit'
@@ -84,7 +86,7 @@ global.main.commands['_.dist.cluster'] = function () {
'--js',
global.main.path.core + '/build/core/cluster/bootstrap.server.js.boot',
'--js_output_file',
- global.main.path.core + '/dist/boot/bootstrap.server.js.boot',
+ global.main.path.core + '/dist/cluster/boot/bootstrap.server.js.boot',
'--language_in',
'ECMASCRIPT5',
'--compilation_level',
@@ -99,11 +101,11 @@ global.main.commands['_.dist.cluster'] = function () {
global.main.path.core + '/node_modules/uglify-js/bin/uglifyjs',
global.main.path.core + '/build/core/cluster/bootstrap.server.js.boot',
'-o',
- global.main.path.core + '/dist/boot/bootstrap.server.js.boot',
+ global.main.path.core + '/dist/cluster/boot/bootstrap.server.js.boot',
//'--in-source-map',
//global.main.path.core + '/build/core/cluster/bootstrap.server.js.boot.map',
//'--source-map',
- //global.main.path.core + '/dist/boot/bootstrap.server.js.boot.map',
+ //global.main.path.core + '/dist/cluster/boot/bootstrap.server.js.boot.map',
'--acorn',
'-c',
//'-m',
@@ -136,7 +138,7 @@ global.main.commands['_.dist.cluster'] = function () {
'--js',
global.main.path.core + '/build/pack/' + file,
'--js_output_file',
- global.main.path.core + '/dist/boot/' + file + '.min',
+ global.main.path.core + '/dist/cluster/boot/' + file + '.min',
'--language_in',
'ECMASCRIPT5',
'--compilation_level',
@@ -151,11 +153,11 @@ global.main.commands['_.dist.cluster'] = function () {
global.main.path.core + '/node_modules/uglify-js/bin/uglifyjs',
global.main.path.core + '/build/pack/' + file,
'-o',
- global.main.path.core + '/dist/boot/' + file + '.min',
+ global.main.path.core + '/dist/cluster/boot/' + file + '.min',
//'--in-source-map',
//global.main.path.core + '/build/pack/' + file + '.map',
//'--source-map',
- //global.main.path.core + '/dist/boot/' + file + '.map',
+ //global.main.path.core + '/dist/cluster/boot/' + file + '.map',
'--acorn',
'-c',
//'-m',
@@ -173,9 +175,9 @@ global.main.commands['_.dist.cluster'] = function () {
callback(new Error('minification of core ' + file + ' failed'));
} else {
fs.copySync(global.main.path.core + '/build/pack/' + file,
- global.main.path.core + '/dist/boot/' + file);
+ global.main.path.core + '/dist/cluster/boot/' + file);
fs.copySync(global.main.path.core + '/build/pack/' + file + '.map',
- global.main.path.core + '/dist/boot/' + file + '.map');
+ global.main.path.core + '/dist/cluster/boot/' + file + '.map');
callback();
}
});
@@ -44,12 +44,12 @@ global.main.commands['_.dist.core'] = function () {
var optimizer = args._[1] || args.optimizer || 'uglify';
if (fs.existsSync(path.join(global.main.path.core, '/build/pack/core.server.js')) === true) {
- if (fs.existsSync(path.join(global.main.path.core, '/dist/')) === true) {
- rmdirSync(path.join(global.main.path.core, '/dist/'));
+ if (fs.existsSync(path.join(global.main.path.core, '/dist/core/')) === true) {
+ rmdirSync(path.join(global.main.path.core, '/dist/core/'));
}
- fs.mkdirSync(path.join(global.main.path.core, '/dist/'));
- fs.mkdirSync(path.join(global.main.path.core, '/dist/docs/'));
- fs.mkdirSync(path.join(global.main.path.core, '/dist/boot/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/core/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/core/docs/'));
+ fs.mkdirSync(path.join(global.main.path.core, '/dist/core/boot/'));
var tasks = [];
@@ -59,6 +59,8 @@ global.main.commands['_.dist.core'] = function () {
global.main.path.core + '/build/pack/core.server.js',
'-c',
global.main.path.core + '/.jsdocrc',
+ '-d',
+ global.main.path.core + '/dist/core/docs/',
'--verbose'
], {
stdio: 'inherit'
@@ -80,7 +82,7 @@ global.main.commands['_.dist.core'] = function () {
'--js',
global.main.path.core + '/build/core/bootstrap.server.js.boot',
'--js_output_file',
- global.main.path.core + '/dist/boot/bootstrap.server.js.boot',
+ global.main.path.core + '/dist/core/boot/bootstrap.server.js.boot',
'--language_in',
'ECMASCRIPT5',
'--compilation_level',
@@ -95,11 +97,11 @@ global.main.commands['_.dist.core'] = function () {
global.main.path.core + '/node_modules/uglify-js/bin/uglifyjs',
global.main.path.core + '/build/core/bootstrap.server.js.boot',
'-o',
- global.main.path.core + '/dist/boot/bootstrap.server.js.boot',
+ global.main.path.core + '/dist/core/boot/bootstrap.server.js.boot',
//'--in-source-map',
//global.main.path.core + '/build/core/bootstrap.server.js.boot.map',
//'--source-map',
- //global.main.path.core + '/dist/boot/bootstrap.server.js.boot.map',
+ //global.main.path.core + '/dist/core/boot/bootstrap.server.js.boot.map',
'--acorn',
'-c',
//'-m',
@@ -131,7 +133,7 @@ global.main.commands['_.dist.core'] = function () {
'--js',
global.main.path.core + '/build/pack/' + file,
'--js_output_file',
- global.main.path.core + '/dist/boot/' + file + '.min',
+ global.main.path.core + '/dist/core/boot/' + file + '.min',
'--language_in',
'ECMASCRIPT5',
'--compilation_level',
@@ -146,11 +148,11 @@ global.main.commands['_.dist.core'] = function () {
global.main.path.core + '/node_modules/uglify-js/bin/uglifyjs',
global.main.path.core + '/build/pack/' + file,
'-o',
- global.main.path.core + '/dist/boot/' + file + '.min',
+ global.main.path.core + '/dist/core/boot/' + file + '.min',
//'--in-source-map',
//global.main.path.core + '/build/pack/' + file + '.map',
//'--source-map',
- //global.main.path.core + '/dist/boot/' + file + '.map',
+ //global.main.path.core + '/dist/core/boot/' + file + '.map',
'--acorn',
'-c',
//'-m',
@@ -168,9 +170,9 @@ global.main.commands['_.dist.core'] = function () {
callback(new Error('minification of core ' + file + ' failed'));
} else {
fs.copySync(global.main.path.core + '/build/pack/' + file,
- global.main.path.core + '/dist/boot/' + file);
+ global.main.path.core + '/dist/core/boot/' + file);
fs.copySync(global.main.path.core + '/build/pack/' + file + '.map',
- global.main.path.core + '/dist/boot/' + file + '.map');
+ global.main.path.core + '/dist/core/boot/' + file + '.map');
callback();
}
});
@@ -83,7 +83,7 @@ global.main.commands['run.cluster'] = function(base){
native.compile.init();
// loading ljve application server
- var bootstrap_dist_path = path.join(global.main.path.core,'dist/boot/bootstrap.server.js.boot');
+ var bootstrap_dist_path = path.join(global.main.path.core,'dist/cluster/boot/bootstrap.server.js.boot');
if (process.env.BUILD == null && fs.existsSync(bootstrap_dist_path) === true) {
require(bootstrap_dist_path);
} else {
@@ -81,7 +81,7 @@ global.main.commands['run'] = function(base, callback){
native.compile.init();
// loading ljve application server
- var bootstrap_dist_path = path.join(global.main.path.core,'dist/boot/bootstrap.server.js.boot');
+ var bootstrap_dist_path = path.join(global.main.path.core,'dist/core/boot/bootstrap.server.js.boot');
if (process.env.BUILD == null && fs.existsSync(bootstrap_dist_path) === true) {
require(bootstrap_dist_path);
} else {
View
@@ -263,7 +263,7 @@ defineNative(native.monitor,'uv','event-loop-lag');
//native.sysconf = require('sysconfx-next');
defineNative(native,'sysconf','sysconfx-next');
if (process.platform === 'win32') {
-//native.perfcounter = require('cwinperfcounter-next');
+ //native.perfcounter = require('cwinperfcounter-next');
defineNative(native, 'perfcounter', 'cwinperfcounter-next');
}
//native.winston = require('winston');
@@ -612,23 +612,27 @@ native.compile.optional = [];
} catch(err){}*/
native.compile.basepath = native.path.join(global.main.path.root,'build');
native.compile.scope = {
-// order is important to make development branches run
-//? if (DIST) {
+ // order is important to make development branches run
+ //? if (DIST) {
'DIST': true,
-//? } else {
+ //? } else {
'DIST': false,
-//? }
+ //? }
'CLUSTER': false
};
native.compile.init = function(){
-//? if (!DIST) {
+ //? if (!DIST) {
// cleaning cache/build when building boot/core packs
if (process.env.BUILD === 'pack'){
if (native.cluster == null || (native.cluster != null && native.cluster.isMaster === true)) {
console.debug('cleaning for new build');
native.fs.removeSync(native.path.join(global.main.path.root,'/build/'));
native.fs.removeSync(native.path.join(global.main.path.root,'/cache/'));
- native.fs.removeSync(native.path.join(global.main.path.root,'/dist/'));
+ if (native.cluster == null) {
+ native.fs.removeSync(native.path.join(global.main.path.root,'/dist/core/'));
+ } else {
+ native.fs.removeSync(native.path.join(global.main.path.root,'/dist/cluster/'));
+ }
}
}
@@ -647,7 +651,7 @@ native.compile.init = function(){
native.fs.writeFileSync(scope_path, JSON.stringify(native.compile.scope));
}
}
-//? }
+ //? }
};
native.sleep = global.sleep = function (ms) {
View
No changes.

0 comments on commit 103662d

Please sign in to comment.