Skip to content
Browse files

Closure Compiler: Fix All The things !

 - Adding some small fixes to pass compile step (mostly /** instead of
/*).
  - Adding some closure externs
  • Loading branch information...
1 parent 39d9491 commit 38dc1dc9fe3cbf0ef516588c7b336a82148f575d @grosbouddha grosbouddha committed Sep 28, 2013
View
20 Gruntfile.js
@@ -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
2 js/Events.js
@@ -1,5 +1,5 @@
// TODO(grosbouddha): put under pskl namespace.
-Events = {
+var Events = {
TOOL_SELECTED : "TOOL_SELECTED",
TOOL_RELEASED : "TOOL_RELEASED",
View
2 js/drawingtools/BaseTool.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.BaseTool
*
* @require pskl.utils
View
2 js/drawingtools/Circle.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.Circle
*
* @require pskl.utils
View
2 js/drawingtools/ColorPicker.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.ColorPicker
*
* @require pskl.utils
View
2 js/drawingtools/Eraser.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.Eraser
*
* @require Constants
View
2 js/drawingtools/Move.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.Move
*
* @require pskl.utils
View
2 js/drawingtools/PaintBucket.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.PaintBucket
*
* @require pskl.utils
View
2 js/drawingtools/Rectangle.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.Rectangle
*
* @require pskl.utils
View
2 js/drawingtools/SimplePen.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.SimplePen
*
* @require pskl.utils
View
2 js/drawingtools/Stroke.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.Stroke
*
* @require pskl.utils
View
2 js/drawingtools/selectiontools/BaseSelect.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.BaseSelect
*
* @require pskl.utils
View
2 js/drawingtools/selectiontools/RectangleSelect.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.RectangleSelect
*
* @require pskl.utils
View
2 js/drawingtools/selectiontools/ShapeSelect.js
@@ -1,4 +1,4 @@
-/*
+/**
* @provide pskl.drawingtools.ShapeSelect
*
* @require pskl.utils
View
4 js/utils/PixelUtils.js
@@ -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
2 js/utils/core.js
@@ -24,7 +24,7 @@ if (typeof Function.prototype.bind !== "function") {
};
}
-/*
+/**
* @provide pskl.utils
*
* @require Constants
View
4 piskel-boot.js
@@ -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 ++;
}
};
View
17 piskel-closure-externs.js
@@ -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;

0 comments on commit 38dc1dc

Please sign in to comment.
Something went wrong with that request. Please try again.