Changeset 49

Show
Ignore:
Timestamp:
06/24/08 15:39:16 (7 months ago)
Author:
mb0
Message:

NEW - # 62: add compiler output to console
http://axdt.org/ticket/62

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • axdt/trunk/org.axdt.flex3sdk/META-INF/MANIFEST.MF

    r47 r49  
    99 org.axdt.as3, 
    1010 org.eclipse.core.resources, 
    11  org.eclipse.imp.runtime 
     11 org.eclipse.imp.runtime, 
     12 org.eclipse.ui.console, 
     13 org.eclipse.ui 
    1214Eclipse-LazyStart: true 
    1315Bundle-ClassPath: flexsdk/lib/asc.jar, 
  • axdt/trunk/org.axdt.flex3sdk/src/org/axdt/flex3sdk/Flex3Compiler.java

    r47 r49  
    88import org.axdt.as3.compiler.AS3CompilerTarget; 
    99import org.axdt.as3.compiler.IAS3Compiler; 
     10import org.axdt.as3.imp.preferences.AS3PreferencesConstants; 
    1011import org.eclipse.core.runtime.IProgressMonitor; 
    1112import org.eclipse.core.runtime.Path; 
    1213import org.eclipse.core.runtime.SubProgressMonitor; 
     14import org.eclipse.imp.preferences.PreferencesService; 
    1315 
    1416import flex2.tools.oem.Application; 
    1517import flex2.tools.oem.Configuration; 
    16 import flex2.tools.oem.Logger; 
    17 import flex2.tools.oem.Message; 
    1818import flex2.tools.oem.ProgressMeter; 
    1919 
    20 public class Flex3Compiler implements Logger, IAS3Compiler { 
     20public class Flex3Compiler implements IAS3Compiler { 
    2121 
    2222        public Flex3Compiler() { 
     
    3030                        app = createApplication(target); 
    3131                        app.getConfiguration().optimize(true); 
    32                         app.setLogger(this); 
    3332                        target.setContext(app); 
    3433                } 
     
    3736                        parentFile.mkdir(); 
    3837                } 
     38                long status = 0; 
     39                Flex3Console logger = Flex3Console.getDefault(); 
     40                app.setLogger(logger); 
    3941                app.setProgressMeter(new ProgressMonitor(monitor,target.getDeployName())); 
    40                 long status = app.build(true); 
     42                logger.append("compiling "+ target.getDeployFile().lastSegment()); 
     43                status = app.build(true); 
    4144                app.setProgressMeter(null); 
    42                 return status != 0; 
     45                return status > 0; 
    4346        } 
    4447         
    45  
    4648        private Application createApplication(AS3CompilerTarget target) throws FileNotFoundException { 
    4749                Application app = new Application(target.getFile()); 
     
    4951                app.setOutput(file); 
    5052                Configuration config = app.getDefaultConfiguration(); 
    51                 Path path = new Path("flexsdk/frameworks/flex-config.xml"); 
    52                 URL configURL = Flex3SDKPlugin.getBundleURL(path); 
    53                 File confFile = new File(configURL.getPath()); 
    54                 config.setConfiguration(confFile); 
     53                config.setConfiguration(getConfigFile(target)); 
    5554                File[] sourcePaths = target.getSourcePaths(); 
    5655                config.addSourcePath(sourcePaths); 
     
    6059        } 
    6160 
    62         public void log(Message msg, int arg1, String arg2) { 
    63 //              if (!msg.getLevel().equals(Message.INFO)) 
    64                         AS3Plugin.getInstance().writeInfoMsg(msg.toString()); 
     61        private File getConfigFile(AS3CompilerTarget target) { 
     62                PreferencesService preferences = AS3Plugin.getPreferencesService(); 
     63                boolean usedefault = preferences.getBooleanPreference(target.getProject(), AS3PreferencesConstants.P_USEDEFAULTFLEXCONFIG); 
     64                String spath = null; 
     65                if (!usedefault) { 
     66                        spath = preferences.getStringPreference(target.getProject(), AS3PreferencesConstants.P_FLEXCONFIG); 
     67                } else { 
     68                        Path path = new Path("flexsdk/frameworks/flex-config.xml"); 
     69                        URL configURL = Flex3SDKPlugin.getBundleURL(path); 
     70                        spath = configURL.getPath(); 
     71                } 
     72                return new File(spath); 
    6573        } 
    66          
     74 
    6775        public static class ProgressMonitor extends SubProgressMonitor implements ProgressMeter { 
    6876