Commit 4616b950 authored by Alexander.Trofimov's avatar Alexander.Trofimov

restore build_all

parent d0736383
module.exports = function(grunt) {
require('google-closure-compiler').grunt(grunt, ['-Xms2048m']);
var defaultConfig, packageFile;
var path = grunt.option('src') || './configs';
var defaultConfig, packageFile;
var path = grunt.option('src') || './configs';
var level = grunt.option('level') || 'ADVANCED';
var formatting = grunt.option('formatting') || '';
var formatting = grunt.option('formatting') || '';
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-replace');
......@@ -19,7 +19,7 @@ module.exports = function(grunt) {
else
grunt.log.error().writeln('Could not load config file'.red);
});
grunt.registerTask('build_webexcel_init', 'Initialize build WebExcel SDK.', function(){
defaultConfig = path + '/webexcel.json';
packageFile = require(defaultConfig);
......@@ -52,11 +52,11 @@ module.exports = function(grunt) {
});
grunt.registerTask('build_webword', ['build_webword_init', 'build_sdk']);
grunt.registerTask('build_webexcel', ['build_webexcel_init', 'build_sdk']);
grunt.registerTask('build_webpowerpoint', ['build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('build_all', ['build_webword_init', 'build_sdk', 'build_webexcel_init', 'build_sdk', 'build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('build_webexcel', ['build_webexcel_init', 'build_sdk']);
grunt.registerTask('build_webpowerpoint', ['build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('build_all', ['build_webword_init', 'build_sdk', 'build_webexcel_init', 'build_sdk', 'build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('concat_sdk_init', function() {
var sdkTmp = 'sdk-tmp.js', sdkAllTmp = 'sdk-all-tmp.js', sdkAllMinTmp = 'sdk-all-min-tmp.js';
var srcFilesMin = packageFile['compile']['sdk']['min'];
......@@ -67,31 +67,31 @@ module.exports = function(grunt) {
sdkOpt = {
banner: '(function(window, undefined) {',
footer: '})(window);'
};
};
}
if (grunt.option('mobile')) {
if (grunt.option('mobile')) {
srcFilesMin = packageFile['compile']['sdk']['mobile_banners']['min'].concat(srcFilesMin);
srcFilesAll = packageFile['compile']['sdk']['mobile_banners']['common'].concat(srcFilesAll);
var excludeFiles = packageFile['compile']['sdk']['exclude_mobile'];
srcFilesAll = srcFilesAll.filter(function(item) {
return -1 === excludeFiles.indexOf(item);
});
var mobileFiles = packageFile['compile']['sdk']['mobile'];
if(mobileFiles){
return -1 === excludeFiles.indexOf(item);
});
var mobileFiles = packageFile['compile']['sdk']['mobile'];
if(mobileFiles){
srcFilesAll = srcFilesAll.concat(mobileFiles);
}
}
if (!grunt.option('noprivate')) {
}
}
if (!grunt.option('noprivate')) {
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['private']);
}
if (grunt.option('desktop')) {
}
if (grunt.option('desktop')) {
srcFilesMin = srcFilesMin.concat(packageFile['compile']['sdk']['desktop']['min']);
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['desktop']['common']);
}
}
grunt.initConfig({
concat: {
sdkmin: {
......@@ -143,13 +143,13 @@ module.exports = function(grunt) {
}
grunt.initConfig({
'closure-compiler': {
sdk: {
'closure-compiler': {
sdk: {
options: sdkOpt,
dest: tmp_sdk_path,
src: [sdkTmp]
}
},
},
splitfile: {
sdk: {
options: {
......@@ -160,19 +160,19 @@ module.exports = function(grunt) {
src: tmp_sdk_path
}
},
concat: {
concat: {
sdkmin: {
src: ['license.js', sdkAllMinDst],
dest: sdkAllMinDst
},
sdk: {
sdk: {
src: ['license.js', sdkAllDst],
dest: sdkAllDst
}
}
},
clean: [
clean: [
sdkTmp,
tmp_sdk_path
tmp_sdk_path
],
replace: {
version: {
......@@ -185,12 +185,12 @@ module.exports = function(grunt) {
files: [
{ src: [sdkAllMinDst, sdkAllDst], dest: sdkDstFolder + '/' }
]
}
}
}
});
});
grunt.registerTask('concat_sdk', ['concat_sdk_init', 'concat', 'clean']);
grunt.registerTask('compile_sdk', ['concat_sdk', 'compile_sdk_init:' + level, 'closure-compiler', 'splitfile', 'concat', 'replace', 'clean']);
grunt.registerTask('default', ['build_webpowerpoint']);
grunt.registerTask('default', ['build_all']);
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment