Closure Compiler: Fix All The things !

- Adding some small fixes to pass compile step (mostly /** instead of
/*).
  - Adding some closure externs
This commit is contained in:
Vince
2013-09-28 21:10:12 +02:00
parent 39d9491aff
commit 38dc1dc9fe
18 changed files with 45 additions and 28 deletions

View File

@ -99,20 +99,16 @@ module.exports = function(grunt) {
* Keys will be used as directives for the compiler * Keys will be used as directives for the compiler
* values can be strings or arrays. * values can be strings or arrays.
* If no value is required use null * If no value is required use null
*
* The directive 'externs' is treated as a special case
* allowing a grunt file syntax (<config:...>, *)
*
* Following are some directive samples...
*/ */
//compilation_level: 'ADVANCED_OPTIMIZATIONS', //compilation_level: 'ADVANCED_OPTIMIZATIONS',
compilation_level: 'SIMPLE_OPTIMIZATIONS', compilation_level: 'SIMPLE_OPTIMIZATIONS',
//externs: ['path/to/file.js', '/source/**/*.js'], externs: ['piskel-closure-externs.js'],
define: ["'goog.DEBUG=false'"], define: ["'goog.DEBUG=false'"],
warning_level: 'verbose', warning_level: 'verbose',
jscomp_off: ['checkTypes', 'fileoverviewTags'], jscomp_off: ['checkTypes', 'fileoverviewTags'],
summary_detail_level: 1, summary_detail_level: 1,
output_wrapper: '"(function(){%output%}).call(this);"' language_in: 'ECMASCRIPT3'
//output_wrapper: '"(function(){%output%}).call(this);"'
}, },
execOpts: { // [OPTIONAL] Set exec method options execOpts: { // [OPTIONAL] Set exec method options
/** /**
@ -138,6 +134,10 @@ module.exports = function(grunt) {
//src: 'path/to/file.js', //src: 'path/to/file.js',
src: [ src: [
'js/**/*.js', 'js/**/*.js',
//'!js/lib/**/*.js',
'!js/lib/bootstrap/**/*.js',
'!js/lib/jsColor_1_4_0/**/*.js',
'!js/lib/gif/**/*.js',
'piskel-boot.js', 'piskel-boot.js',
'piskel-script-list.js' 'piskel-script-list.js'
] ]
@ -171,13 +171,13 @@ module.exports = function(grunt) {
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'compile', 'connect:test', 'ghost:default']); grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'compile', 'connect:test', 'ghost:default']);
// Validate & Test (faster version) will NOT work on travis !! // Validate & Test (faster version) will NOT work on travis !!
grunt.registerTask('precommit', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect:test', 'ghost:local']); grunt.registerTask('precommit', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'compile', 'connect:test', 'ghost:local']);
// Compile JS code (eg verify JSDoc annotation and types, no actual minified code generated). // Compile JS code (eg verify JSDoc annotation and types, no actual minified code generated).
grunt.registerTask('compile', ['closureCompiler:compile']); grunt.registerTask('compile', ['closureCompiler:compile']);
// Validate & Build // Validate & Build
grunt.registerTask('default', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'concat', 'uglify', 'compile']); grunt.registerTask('default', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'concat', 'compile', 'uglify']);
// Start webserver // Start webserver
grunt.registerTask('serve', ['connect:serve']); grunt.registerTask('serve', ['connect:serve']);

View File

@ -1,5 +1,5 @@
// TODO(grosbouddha): put under pskl namespace. // TODO(grosbouddha): put under pskl namespace.
Events = { var Events = {
TOOL_SELECTED : "TOOL_SELECTED", TOOL_SELECTED : "TOOL_SELECTED",
TOOL_RELEASED : "TOOL_RELEASED", TOOL_RELEASED : "TOOL_RELEASED",

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.BaseTool * @provide pskl.drawingtools.BaseTool
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.Circle * @provide pskl.drawingtools.Circle
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.ColorPicker * @provide pskl.drawingtools.ColorPicker
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.Eraser * @provide pskl.drawingtools.Eraser
* *
* @require Constants * @require Constants

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.Move * @provide pskl.drawingtools.Move
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.PaintBucket * @provide pskl.drawingtools.PaintBucket
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.Rectangle * @provide pskl.drawingtools.Rectangle
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.SimplePen * @provide pskl.drawingtools.SimplePen
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.Stroke * @provide pskl.drawingtools.Stroke
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.BaseSelect * @provide pskl.drawingtools.BaseSelect
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.RectangleSelect * @provide pskl.drawingtools.RectangleSelect
* *
* @require pskl.utils * @require pskl.utils

View File

@ -1,4 +1,4 @@
/* /**
* @provide pskl.drawingtools.ShapeSelect * @provide pskl.drawingtools.ShapeSelect
* *
* @require pskl.utils * @require pskl.utils

View File

@ -44,7 +44,7 @@
x0 : Math.min(x0, x1), x0 : Math.min(x0, x1),
y0 : Math.min(y0, y1), y0 : Math.min(y0, y1),
x1 : Math.max(x0, x1), x1 : Math.max(x0, x1),
y1 : Math.max(y0, y1), y1 : Math.max(y0, y1)
}; };
}, },
@ -172,6 +172,6 @@
widthBoundDpi = Math.floor(width / pictureWidth); widthBoundDpi = Math.floor(width / pictureWidth);
return Math.min(heightBoundDpi, widthBoundDpi); return Math.min(heightBoundDpi, widthBoundDpi);
}, }
}; };
})(); })();

View File

@ -24,7 +24,7 @@ if (typeof Function.prototype.bind !== "function") {
}; };
} }
/* /**
* @provide pskl.utils * @provide pskl.utils
* *
* @require Constants * @require Constants

View File

@ -11,14 +11,14 @@
window.exports = {}; window.exports = {};
var scriptIndex = 0; var scriptIndex = 0;
window.loadNextScript = function () { window.loadNextScript = function () {
if (scriptIndex == exports.scripts.length) { if (scriptIndex == window.exports.scripts.length) {
pskl.app.init(); pskl.app.init();
// cleanup // cleanup
delete window.exports; delete window.exports;
delete window.loadDebugScripts; delete window.loadDebugScripts;
delete window.done; delete window.done;
} else { } else {
loadScript(exports.scripts[scriptIndex], "loadNextScript()"); loadScript(window.exports.scripts[scriptIndex], "loadNextScript()");
scriptIndex ++; scriptIndex ++;
} }
}; };

17
piskel-closure-externs.js Normal file
View File

@ -0,0 +1,17 @@
/**
* @fileoverview Externs for Piskel
*
* @externs
*/
// Piskel externs.
var exports;
var $;
var console;
var pskl;
// Piskel libs externs.
var define;
var jQuery;
var getComputedStyle;
var URL;