|  | @@ -41,17 +41,17 @@ module.exports = function(grunt) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // mark task as async task
 | 
	
		
			
				|  |  |      var done = this.async();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // create and initialize amberc
 | 
	
		
			
				|  |  |      var compiler = new amberc.Compiler(grunt.config('amberc._config.amber_dir'), grunt.config('amberc._config.closure_jar'));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // generate the amberc parameter string out of the given target properties
 | 
	
		
			
				|  |  | -    var parameters = generateParameterArray(this.data);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +    // generate the amberc configuration out of the given target properties
 | 
	
		
			
				|  |  | +    var configuration = generateCompilerConfiguration(this.data, grunt.config('amberc._config.amber_dir'));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // run the compiler
 | 
	
		
			
				|  |  |      // change back to the old working directory and call the async callback once finished
 | 
	
		
			
				|  |  |      var self = this;
 | 
	
		
			
				|  |  | -    compiler.main(parameters, function(){
 | 
	
		
			
				|  |  | +    compiler.main(configuration, function(){
 | 
	
		
			
				|  |  |        if (undefined !== self.data.target_dir) {
 | 
	
		
			
				|  |  |          var absolute_target_dir = path.join(current_dir, self.data.target_dir);
 | 
	
		
			
				|  |  |          replaceFileSuffix_moveToTargetDir(self.data.src, absolute_target_dir);
 | 
	
	
		
			
				|  | @@ -70,51 +70,58 @@ module.exports = function(grunt) {
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  function generateParameterArray(data) {
 | 
	
		
			
				|  |  | +  function generateCompilerConfiguration(data, amber_dir) {
 | 
	
		
			
				|  |  | +    var configuration = amberc.createDefaults(amber_dir);
 | 
	
		
			
				|  |  |      var parameters = [];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      var libraries = data.libraries;
 | 
	
		
			
				|  |  |      if (undefined !== libraries) {
 | 
	
		
			
				|  |  | -      parameters.push('-l');
 | 
	
		
			
				|  |  | -      parameters.push(libraries.join(','));
 | 
	
		
			
				|  |  | +      configuration.load = libraries;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var initFile = data.init;
 | 
	
		
			
				|  |  |      if (undefined !== initFile) {
 | 
	
		
			
				|  |  | -      parameters.push('-i');
 | 
	
		
			
				|  |  | -      parameters.push(initFile);
 | 
	
		
			
				|  |  | +      configuration.init = initFile;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var mainClass = data.main_class;
 | 
	
		
			
				|  |  |      if (undefined !== mainClass) {
 | 
	
		
			
				|  |  | -      parameters.push('-m');
 | 
	
		
			
				|  |  | -      parameters.push(mainClass);
 | 
	
		
			
				|  |  | +      configuration.main = mainClass;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var mainFile = data.main_file;
 | 
	
		
			
				|  |  |      if (undefined !== initFile) {
 | 
	
		
			
				|  |  | -      parameters.push('-M');
 | 
	
		
			
				|  |  | -      parameters.push(mainFile);
 | 
	
		
			
				|  |  | +      configuration.mainfile = mainFile;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      if (true === data.deploy) {
 | 
	
		
			
				|  |  | -      parameters.push('-d');
 | 
	
		
			
				|  |  | +      configuration.deploy = true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var outputSuffix = data.output_suffix;
 | 
	
		
			
				|  |  |      if (undefined !== outputSuffix) {
 | 
	
		
			
				|  |  | -      parameters.push('-s');
 | 
	
		
			
				|  |  | -      parameters.push(outputSuffix);
 | 
	
		
			
				|  |  | +      configuration.suffix = outputSuffix;
 | 
	
		
			
				|  |  | +      configuration.suffix_used = outputSuffix;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var librarySuffix = data.library_suffix;
 | 
	
		
			
				|  |  |      if (undefined !== librarySuffix) {
 | 
	
		
			
				|  |  | -      parameters.push('-S');
 | 
	
		
			
				|  |  | -      parameters.push(librarySuffix);
 | 
	
		
			
				|  |  | +      configuration.loadsuffix = librarySuffix;
 | 
	
		
			
				|  |  | +      configuration.suffix_used = librarySuffix;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      var sourceFiles = data.src;
 | 
	
		
			
				|  |  |      if (undefined !== sourceFiles) {
 | 
	
		
			
				|  |  | -      parameters.push.apply(parameters, sourceFiles);
 | 
	
		
			
				|  |  | +      sourceFiles.forEach(function(currentItem){
 | 
	
		
			
				|  |  | +        var fileSuffix = path.extname(currentItem);
 | 
	
		
			
				|  |  | +        switch (fileSuffix) {
 | 
	
		
			
				|  |  | +          case '.st':
 | 
	
		
			
				|  |  | +            configuration.stFiles.push(currentItem);
 | 
	
		
			
				|  |  | +          break;
 | 
	
		
			
				|  |  | +          case '.js':
 | 
	
		
			
				|  |  | +            configuration.jsFiles.push(currentItem);
 | 
	
		
			
				|  |  | +          break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    var outpuName = data.output_name;
 | 
	
		
			
				|  |  | -    if (undefined !== outpuName) {
 | 
	
		
			
				|  |  | -      parameters.push(outpuName);
 | 
	
		
			
				|  |  | +    var outputName = data.output_name;
 | 
	
		
			
				|  |  | +    if (undefined !== outputName) {
 | 
	
		
			
				|  |  | +      configuration.program = outputName;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    return parameters;
 | 
	
		
			
				|  |  | +    return configuration;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |