| 
					
				 | 
			
			
				@@ -19,6 +19,9 @@ module.exports = function(grunt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          verbose: true                 // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        helloWorld: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         options: {                             // the 'options' object is optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           verbose: true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          src: ['projects/HelloWorld/st/HelloWorld.st'], // REQUIRED 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          output_dir: 'projects/HelloWorld/js',  // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          libraries: 'Canvas',                   // optional 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,18 +31,14 @@ module.exports = function(grunt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          amd_namespace: 'MyNamespace',          // optional (default: 'amber') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          main_file: 'myMain.js',                // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          output_suffix: 'mySuffix',             // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         library_suffix: '-0.9',                 // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         options: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           verbose: true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         library_suffix: '-0.9'                 // optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   grunt.registerMultiTask('amberc', 'Compile Smalltalk files with the amberc compiler', function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // mark required properties 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.requiresConfig('amberc.options.amber_dir'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.requiresConfig(['amberc', this.target, 'src']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // mark task as async task 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var done = this.async(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var options = this.options({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       amber_dir: undefined, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,14 +46,18 @@ module.exports = function(grunt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.data.verbose = options.verbose; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // mark task as async task 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    var done = this.async(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // mark required properties 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.requiresConfig('amberc.options.amber_dir'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // raise error on missing source files 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (this.filesSrc.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        grunt.fail.fatal('No source files to compile or link.'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // create and initialize amberc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var compiler = new amberc.Compiler(grunt.config('amberc.options.amber_dir')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // generate the amberc configuration out of the given target properties 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    var configuration = generateCompilerConfiguration(this.data, grunt.config('amberc.options.amber_dir')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var configuration = generateCompilerConfiguration(this.data, this.filesSrc, grunt.config('amberc.options.amber_dir')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // run the compiler and call the async callback once finished 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     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); 
			 |