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
* values can be strings or arrays.
* 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',
//externs: ['path/to/file.js', '/source/**/*.js'],
externs: ['piskel-closure-externs.js'],
define: ["'goog.DEBUG=false'"],
warning_level: 'verbose',
jscomp_off: ['checkTypes', 'fileoverviewTags'],
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
/**
@ -138,6 +134,10 @@ module.exports = function(grunt) {
//src: 'path/to/file.js',
src: [
'js/**/*.js',
//'!js/lib/**/*.js',
'!js/lib/bootstrap/**/*.js',
'!js/lib/jsColor_1_4_0/**/*.js',
'!js/lib/gif/**/*.js',
'piskel-boot.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']);
// 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).
grunt.registerTask('compile', ['closureCompiler:compile']);
// 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
grunt.registerTask('serve', ['connect:serve']);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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