Commit 0c25b772 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add PRETTY_PRINT and nomap options

parent 726dbcd6
...@@ -3,6 +3,8 @@ module.exports = function(grunt) { ...@@ -3,6 +3,8 @@ module.exports = function(grunt) {
var revision="unknown", defaultConfig, packageFile; var revision="unknown", defaultConfig, packageFile;
var path = grunt.option('src') || './sdk_configs'; var path = grunt.option('src') || './sdk_configs';
var level = grunt.option('level') || 'ADVANCED'; var level = grunt.option('level') || 'ADVANCED';
var formatting = grunt.option('formatting') || '';
var nomap = grunt.option('nomap') || '';
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
...@@ -143,6 +145,25 @@ module.exports = function(grunt) { ...@@ -143,6 +145,25 @@ module.exports = function(grunt) {
packageFile['compile']['sdk']['dst'], packageFile['compile']['sdk']['dst'],
packageFile['compile']['defines']['dst'], packageFile['compile']['defines']['dst'],
map_record_file_path ]; map_record_file_path ];
var sdkOpt = {
compilation_level: compilation_level,
warning_level: 'QUIET',
externs: packageFile['compile']['sdk']['externs']/*,
create_source_map: map_file_path,
source_map_format: "V3"*/
};
var definesOpt = {
compilation_level: 'ADVANCED' === compilation_level ? 'SIMPLE' : compilation_level,
warning_level: 'QUIET'
};
if (formatting) {
definesOpt['formatting'] = sdkOpt['formatting'] = formatting;
}
if (!nomap) {
sdkOpt['variable_renaming_report'] = packageFile['compile']['sdk']['log'] + '/variable.map';
sdkOpt['property_renaming_report'] = packageFile['compile']['sdk']['log'] + '/property.map';
}
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON(defaultConfig), pkg: grunt.file.readJSON(defaultConfig),
'closure-compiler': { 'closure-compiler': {
...@@ -150,25 +171,14 @@ module.exports = function(grunt) { ...@@ -150,25 +171,14 @@ module.exports = function(grunt) {
files: { files: {
'<%= pkg.compile.sdk.dst %>': packageFile['compile']['sdk']['src'] '<%= pkg.compile.sdk.dst %>': packageFile['compile']['sdk']['src']
}, },
options: { options: sdkOpt
compilation_level: compilation_level,
warning_level: 'QUIET',
externs: packageFile['compile']['sdk']['externs'],
variable_renaming_report: packageFile['compile']['sdk']['log'] + '/variable.map',
property_renaming_report: packageFile['compile']['sdk']['log'] + '/property.map'/*,
create_source_map: map_file_path,
source_map_format: "V3"*/
}
}, },
defines: { defines: {
files: { files: {
'<%= pkg.compile.defines.dst %>': packageFile['compile']['defines']['src'] '<%= pkg.compile.defines.dst %>': packageFile['compile']['defines']['src']
}, },
options: { options: definesOpt
compilation_level: 'SIMPLE',
warning_level: 'QUIET'
} }
}
}, },
create_map_file: {}, create_map_file: {},
concat: concat_res, concat: concat_res,
......
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