|
@@ -19,6 +19,9 @@ module.exports = function(grunt) {
|
|
|
verbose: true
|
|
|
},
|
|
|
helloWorld: {
|
|
|
+ options: {
|
|
|
+ verbose: true
|
|
|
+ },
|
|
|
src: ['projects/HelloWorld/st/HelloWorld.st'],
|
|
|
output_dir: 'projects/HelloWorld/js',
|
|
|
libraries: 'Canvas',
|
|
@@ -28,18 +31,14 @@ module.exports = function(grunt) {
|
|
|
amd_namespace: 'MyNamespace',
|
|
|
main_file: 'myMain.js',
|
|
|
output_suffix: 'mySuffix',
|
|
|
- library_suffix: '-0.9',
|
|
|
- options: {
|
|
|
- verbose: true
|
|
|
- }
|
|
|
+ library_suffix: '-0.9'
|
|
|
},
|
|
|
},
|
|
|
|
|
|
*/
|
|
|
grunt.registerMultiTask('amberc', 'Compile Smalltalk files with the amberc compiler', function() {
|
|
|
-
|
|
|
- this.requiresConfig('amberc.options.amber_dir');
|
|
|
- this.requiresConfig(['amberc', this.target, 'src']);
|
|
|
+
|
|
|
+ var done = this.async();
|
|
|
|
|
|
var options = this.options({
|
|
|
amber_dir: undefined,
|
|
@@ -47,14 +46,18 @@ module.exports = function(grunt) {
|
|
|
});
|
|
|
this.data.verbose = options.verbose;
|
|
|
|
|
|
-
|
|
|
- var done = this.async();
|
|
|
+
|
|
|
+ this.requiresConfig('amberc.options.amber_dir');
|
|
|
+
|
|
|
+ if (this.filesSrc.length === 0) {
|
|
|
+ grunt.fail.fatal('No source files to compile or link.');
|
|
|
+ }
|
|
|
|
|
|
|
|
|
var compiler = new amberc.Compiler(grunt.config('amberc.options.amber_dir'));
|
|
|
|
|
|
|
|
|
- var configuration = generateCompilerConfiguration(this.data, grunt.config('amberc.options.amber_dir'));
|
|
|
+ var configuration = generateCompilerConfiguration(this.data, this.filesSrc, grunt.config('amberc.options.amber_dir'));
|
|
|
|
|
|
|
|
|
var self = this;
|
|
@@ -65,7 +68,7 @@ module.exports = function(grunt) {
|
|
|
});
|
|
|
|
|
|
|
|
|
- function generateCompilerConfiguration(data, amber_dir) {
|
|
|
+ function generateCompilerConfiguration(data, sourceFiles, amber_dir) {
|
|
|
var configuration = amberc.createDefaults(amber_dir);
|
|
|
var parameters = [];
|
|
|
|
|
@@ -91,7 +94,6 @@ module.exports = function(grunt) {
|
|
|
configuration.loadsuffix = librarySuffix;
|
|
|
configuration.suffix_used = librarySuffix;
|
|
|
}
|
|
|
- var sourceFiles = data.src;
|
|
|
if (undefined !== sourceFiles) {
|
|
|
sourceFiles.forEach(function(currentItem){
|
|
|
var fileSuffix = path.extname(currentItem);
|