mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merge pull request #127 from juliandescottes/closurecompiler
Basic wiring of Closure compiler
This commit is contained in:
commit
80b336aab5
5
.gitignore
vendored
5
.gitignore
vendored
@ -13,4 +13,7 @@ npm-debug.log
|
||||
*.stackdump
|
||||
|
||||
# builds
|
||||
build
|
||||
build
|
||||
|
||||
# Closure compiler generated JS binary.
|
||||
closure_compiled_binary.js
|
67
Gruntfile.js
67
Gruntfile.js
@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
var piskelScripts = require('./piskel-script-list.js').scripts;
|
||||
var getGhostConfig = function (delay) {
|
||||
return {
|
||||
@ -84,6 +83,61 @@ module.exports = function(grunt) {
|
||||
'build/piskel-packaged-min.js' : ['build/piskel-packaged.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
closureCompiler: {
|
||||
options: {
|
||||
// [REQUIRED] Path to closure compiler
|
||||
compilerFile: 'closure_compiler_20130823.jar',
|
||||
|
||||
// [OPTIONAL] set to true if you want to check if files were modified
|
||||
// before starting compilation (can save some time in large sourcebases)
|
||||
//checkModified: true,
|
||||
|
||||
// [OPTIONAL] Set Closure Compiler Directives here
|
||||
compilerOpts: {
|
||||
/**
|
||||
* Keys will be used as directives for the compiler
|
||||
* values can be strings or arrays.
|
||||
* If no value is required use null
|
||||
*/
|
||||
//compilation_level: 'ADVANCED_OPTIMIZATIONS',
|
||||
compilation_level: 'SIMPLE_OPTIMIZATIONS',
|
||||
externs: ['piskel-closure-externs.js'],
|
||||
// Inject some constants in JS code, could we use that for appengine wiring ?
|
||||
//define: ["'goog.DEBUG=false'"],
|
||||
warning_level: 'verbose',
|
||||
jscomp_off: ['checkTypes', 'fileoverviewTags'],
|
||||
summary_detail_level: 1,
|
||||
language_in: 'ECMASCRIPT3'
|
||||
//output_wrapper: '"(function(){%output%}).call(this);"'
|
||||
},
|
||||
execOpts: { // [OPTIONAL] Set exec method options
|
||||
maxBuffer: 999999 * 1024
|
||||
}
|
||||
|
||||
},
|
||||
compile: {
|
||||
|
||||
/**
|
||||
*[OPTIONAL] Here you can add new or override previous option of the Closure Compiler Directives.
|
||||
* IMPORTANT! The feature is enabled as a temporary solution to [#738](https://github.com/gruntjs/grunt/issues/738).
|
||||
* As soon as issue will be fixed this feature will be removed.
|
||||
*/
|
||||
TEMPcompilerOpts: {
|
||||
},
|
||||
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'
|
||||
],
|
||||
|
||||
// This generated JS binary is currently not used and even excluded from source control using .gitignore.
|
||||
dest: 'closure_compiled_binary.js'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -99,6 +153,7 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-closure-tools');
|
||||
grunt.loadNpmTasks('grunt-ghost');
|
||||
grunt.loadNpmTasks('grunt-leading-indent');
|
||||
|
||||
@ -106,15 +161,17 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']);
|
||||
|
||||
// Validate & Test
|
||||
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', '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 !!
|
||||
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']);
|
||||
grunt.registerTask('default', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'concat', 'compile', 'uglify']);
|
||||
|
||||
// Start webserver
|
||||
grunt.registerTask('serve', ['connect:serve']);
|
||||
|
||||
};
|
||||
|
BIN
closure_compiler_20130823.jar
Normal file
BIN
closure_compiler_20130823.jar
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
// TODO(grosbouddha): put under pskl namespace.
|
||||
Events = {
|
||||
var Events = {
|
||||
|
||||
TOOL_SELECTED : "TOOL_SELECTED",
|
||||
TOOL_RELEASED : "TOOL_RELEASED",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.BaseTool
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.Circle
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.ColorPicker
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.Eraser
|
||||
*
|
||||
* @require Constants
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.Move
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.PaintBucket
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.Rectangle
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.SimplePen
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.Stroke
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.BaseSelect
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.RectangleSelect
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.drawingtools.ShapeSelect
|
||||
*
|
||||
* @require pskl.utils
|
||||
|
@ -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);
|
||||
},
|
||||
}
|
||||
};
|
||||
})();
|
@ -24,7 +24,7 @@ if (typeof Function.prototype.bind !== "function") {
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @provide pskl.utils
|
||||
*
|
||||
* @require Constants
|
||||
|
@ -18,6 +18,7 @@
|
||||
"grunt-contrib-jshint": "0.5.4",
|
||||
"grunt-contrib-uglify": "0.2.2",
|
||||
"grunt-ghost": "1.0.12",
|
||||
"grunt-leading-indent" : "0.1.0"
|
||||
"grunt-leading-indent": "0.1.0",
|
||||
"grunt-closure-tools": "~0.8.3"
|
||||
}
|
||||
}
|
||||
|
@ -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
17
piskel-closure-externs.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user