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

restore build_all

parent d0736383
module.exports = function(grunt) { module.exports = function(grunt) {
require('google-closure-compiler').grunt(grunt, ['-Xms2048m']); require('google-closure-compiler').grunt(grunt, ['-Xms2048m']);
var defaultConfig, packageFile; var defaultConfig, packageFile;
var path = grunt.option('src') || './configs'; var path = grunt.option('src') || './configs';
var level = grunt.option('level') || 'ADVANCED'; 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-clean');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-replace'); grunt.loadNpmTasks('grunt-replace');
...@@ -19,7 +19,7 @@ module.exports = function(grunt) { ...@@ -19,7 +19,7 @@ module.exports = function(grunt) {
else else
grunt.log.error().writeln('Could not load config file'.red); grunt.log.error().writeln('Could not load config file'.red);
}); });
grunt.registerTask('build_webexcel_init', 'Initialize build WebExcel SDK.', function(){ grunt.registerTask('build_webexcel_init', 'Initialize build WebExcel SDK.', function(){
defaultConfig = path + '/webexcel.json'; defaultConfig = path + '/webexcel.json';
packageFile = require(defaultConfig); packageFile = require(defaultConfig);
...@@ -52,11 +52,11 @@ module.exports = function(grunt) { ...@@ -52,11 +52,11 @@ module.exports = function(grunt) {
}); });
grunt.registerTask('build_webword', ['build_webword_init', 'build_sdk']); grunt.registerTask('build_webword', ['build_webword_init', 'build_sdk']);
grunt.registerTask('build_webexcel', ['build_webexcel_init', 'build_sdk']); grunt.registerTask('build_webexcel', ['build_webexcel_init', 'build_sdk']);
grunt.registerTask('build_webpowerpoint', ['build_webpowerpoint_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_all', ['build_webword_init', 'build_sdk', 'build_webexcel_init', 'build_sdk', 'build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('concat_sdk_init', function() { grunt.registerTask('concat_sdk_init', function() {
var sdkTmp = 'sdk-tmp.js', sdkAllTmp = 'sdk-all-tmp.js', sdkAllMinTmp = 'sdk-all-min-tmp.js'; var sdkTmp = 'sdk-tmp.js', sdkAllTmp = 'sdk-all-tmp.js', sdkAllMinTmp = 'sdk-all-min-tmp.js';
var srcFilesMin = packageFile['compile']['sdk']['min']; var srcFilesMin = packageFile['compile']['sdk']['min'];
...@@ -67,31 +67,31 @@ module.exports = function(grunt) { ...@@ -67,31 +67,31 @@ module.exports = function(grunt) {
sdkOpt = { sdkOpt = {
banner: '(function(window, undefined) {', banner: '(function(window, undefined) {',
footer: '})(window);' footer: '})(window);'
}; };
} }
if (grunt.option('mobile')) { if (grunt.option('mobile')) {
srcFilesMin = packageFile['compile']['sdk']['mobile_banners']['min'].concat(srcFilesMin); srcFilesMin = packageFile['compile']['sdk']['mobile_banners']['min'].concat(srcFilesMin);
srcFilesAll = packageFile['compile']['sdk']['mobile_banners']['common'].concat(srcFilesAll); srcFilesAll = packageFile['compile']['sdk']['mobile_banners']['common'].concat(srcFilesAll);
var excludeFiles = packageFile['compile']['sdk']['exclude_mobile']; var excludeFiles = packageFile['compile']['sdk']['exclude_mobile'];
srcFilesAll = srcFilesAll.filter(function(item) { srcFilesAll = srcFilesAll.filter(function(item) {
return -1 === excludeFiles.indexOf(item); return -1 === excludeFiles.indexOf(item);
}); });
var mobileFiles = packageFile['compile']['sdk']['mobile']; var mobileFiles = packageFile['compile']['sdk']['mobile'];
if(mobileFiles){ if(mobileFiles){
srcFilesAll = srcFilesAll.concat(mobileFiles); srcFilesAll = srcFilesAll.concat(mobileFiles);
} }
} }
if (!grunt.option('noprivate')) { if (!grunt.option('noprivate')) {
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['private']); srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['private']);
} }
if (grunt.option('desktop')) { if (grunt.option('desktop')) {
srcFilesMin = srcFilesMin.concat(packageFile['compile']['sdk']['desktop']['min']); srcFilesMin = srcFilesMin.concat(packageFile['compile']['sdk']['desktop']['min']);
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['desktop']['common']); srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['desktop']['common']);
} }
grunt.initConfig({ grunt.initConfig({
concat: { concat: {
sdkmin: { sdkmin: {
...@@ -143,13 +143,13 @@ module.exports = function(grunt) { ...@@ -143,13 +143,13 @@ module.exports = function(grunt) {
} }
grunt.initConfig({ grunt.initConfig({
'closure-compiler': { 'closure-compiler': {
sdk: { sdk: {
options: sdkOpt, options: sdkOpt,
dest: tmp_sdk_path, dest: tmp_sdk_path,
src: [sdkTmp] src: [sdkTmp]
} }
}, },
splitfile: { splitfile: {
sdk: { sdk: {
options: { options: {
...@@ -160,19 +160,19 @@ module.exports = function(grunt) { ...@@ -160,19 +160,19 @@ module.exports = function(grunt) {
src: tmp_sdk_path src: tmp_sdk_path
} }
}, },
concat: { concat: {
sdkmin: { sdkmin: {
src: ['license.js', sdkAllMinDst], src: ['license.js', sdkAllMinDst],
dest: sdkAllMinDst dest: sdkAllMinDst
}, },
sdk: { sdk: {
src: ['license.js', sdkAllDst], src: ['license.js', sdkAllDst],
dest: sdkAllDst dest: sdkAllDst
} }
}, },
clean: [ clean: [
sdkTmp, sdkTmp,
tmp_sdk_path tmp_sdk_path
], ],
replace: { replace: {
version: { version: {
...@@ -185,12 +185,12 @@ module.exports = function(grunt) { ...@@ -185,12 +185,12 @@ module.exports = function(grunt) {
files: [ files: [
{ src: [sdkAllMinDst, sdkAllDst], dest: sdkDstFolder + '/' } { src: [sdkAllMinDst, sdkAllDst], dest: sdkDstFolder + '/' }
] ]
}
} }
}
}); });
}); });
grunt.registerTask('concat_sdk', ['concat_sdk_init', 'concat', 'clean']); 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('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