Changeset 1187

Show
Ignore:
Timestamp:
06/10/08 06:00:42 (3 months ago)
Author:
fraserofthenight
Message:

The builder UI is in a non-working state. Hopefully, it will soon support multiple compiler types.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/descent.building/plugin.xml

    r1174 r1187  
    33<plugin> 
    44   <extension-point id="dBuilders" name="%dBuilders" schema="schema/dBuilders.exsd"/> 
     5   <extension-point id="compilerInterfaces" name="%compilerInterfaces" schema="schema/compilerInterfaces.exsd"/> 
    56 
    67   <extension 
     
    113114      </launchMode> 
    114115   </extension> 
     116   <extension 
     117         point="descent.building.compilerInterfaces"> 
     118      <compilerInterface 
     119            class="descent.internal.building.compiler.DmdCompilerInterface" 
     120            id="descent.building.compiler.DmdCompilerInterface" 
     121            vmInstallType="descent.internal.debug.ui.launcher.DmdCompilerType"> 
     122      </compilerInterface> 
     123      <compilerInterface 
     124            class="descent.internal.building.compiler.GdcCompilerInterface" 
     125            id="descent.building.compiler.GdcCompilerInterface" 
     126            vmInstallType="descent.internal.debug.ui.launcher.GdcCompilerType"> 
     127      </compilerInterface> 
     128   </extension> 
    115129 
    116130</plugin> 
  • trunk/descent.building/src/descent/building/BuilderRegistry.java

    r1174 r1187  
    1717 * @author Robert Fraser 
    1818 */ 
    19 public class BuilderRegistry 
     19public final class BuilderRegistry 
    2020{ 
    21     private class DBuilderType implements IDBuilderType 
     21    private static final class DBuilderType implements IDBuilderType 
    2222    { 
    2323        // Attributes defined in the schema 
  • trunk/descent.building/src/descent/building/IDBuilderType.java

    r1174 r1187  
    55/** 
    66 * Defines an interface for getting info about a builder type registered with 
    7  * the plugin. 
     7 * the plugin. This is not intended to be subclasses outside the building 
     8 * framework (you should instead create classes of type {@link IDBuilder}. 
    89 *  
    910 * @author Robert Fraser 
  • trunk/descent.building/src/descent/building/compiler/BooleanOption.java

    r1180 r1187  
    11package descent.building.compiler; 
    22 
    3 public final class BooleanOption extends CompilerOption 
     3public abstract class BooleanOption extends CompilerOption 
    44{ 
    55    private final String onText; 
     
    77     
    88    public BooleanOption(String attributeId, boolean defaultValue, 
    9             String label, String groupLabel, String onText, String offText, 
    10             String helpText) 
     9            String label, String groupLabel, String onText, String offText) 
    1110    { 
    12         super(attributeId, defaultValue ? "true" : "false", label, groupLabel, helpText); 
     11        super(attributeId, defaultValue ? "true" : "false", label, groupLabel); 
    1312        this.onText = onText; 
    1413        this.offText = offText; 
  • trunk/descent.building/src/descent/building/compiler/CompilerOption.java

    r1180 r1187  
    77    private final String label; 
    88    private final String groupLabel; 
    9     private final String helpText; 
    109     
    1110    public CompilerOption(String attributeId, String defaultValue, String label, 
    12             String groupLabel, String helpText
     11            String groupLabel
    1312    { 
    1413        this.attributeId = attributeId; 
     
    1615        this.label = label; 
    1716        this.groupLabel = groupLabel; 
    18         this.helpText = helpText; 
    1917    } 
    2018     
     
    3937    } 
    4038     
    41     public final String getHelpText() 
     39    public String getHelpText() 
    4240    { 
    43         return helpText
     41        return "No description is available for this option."
    4442    } 
    4543} 
  • trunk/descent.building/src/descent/building/compiler/EnumOption.java

    r1184 r1187  
    11package descent.building.compiler; 
    22 
    3 public final class EnumOption extends CompilerOption 
     3public abstract class EnumOption extends CompilerOption 
    44{ 
    55    private final String[] optionValues; 
     
    99    public EnumOption(String attributeId, String defaultValue, 
    1010            String label, String groupLabel, String[] optionValues, 
    11             String[] optionEditLabels, String helpText
     11            String[] optionEditLabels
    1212    { 
    1313        this(attributeId, defaultValue, label, groupLabel,  
    14                 optionValues, optionEditLabels, null, helpText); 
     14                optionValues, optionEditLabels, null); 
    1515    } 
    1616     
    1717    public EnumOption(String attributeId, String defaultValue, 
    1818            String label, String groupLabel, String[] optionValues, 
    19             String[] optionEditLabels, String[] optionViewLabels, 
    20             String helpText) 
     19            String[] optionEditLabels, String[] optionViewLabels) 
    2120    { 
    22         super(attributeId, defaultValue, label, groupLabel, helpText); 
     21        super(attributeId, defaultValue, label, groupLabel); 
    2322        this.optionValues = optionValues; 
    2423        this.optionEditLabels = optionEditLabels; 
  • trunk/descent.building/src/descent/building/compiler/StringOption.java

    r1183 r1187  
    11package descent.building.compiler; 
    22 
    3 public class StringOption extends CompilerOption implements IValidatableOption 
     3public abstract class StringOption extends CompilerOption implements IValidatableOption 
    44{ 
    55    public StringOption(String attributeId, String defaultValue, 
    6             String label, String groupLabel, String helpText
     6            String label, String groupLabel
    77    { 
    8         super(attributeId, defaultValue, label, groupLabel, helpText); 
     8        super(attributeId, defaultValue, label, groupLabel); 
    99    } 
    10      
     10 
    1111    public String isValid(String value) 
    1212    { 
  • trunk/descent.building/src/descent/internal/building/BuilderUtil.java

    r1184 r1187  
    2222    public static final String EXTENSION_STATIC_LIBRARY; 
    2323    public static final String EXTENSION_DYNAMIC_LIBRARY; 
     24    public static final String EXTENSION_DDL; 
    2425    public static final String EXTENSION_OBJECT_FILE; 
    2526     
     
    3334            EXTENSION_STATIC_LIBRARY = ".lib"; 
    3435            EXTENSION_DYNAMIC_LIBRARY = ".dll"; 
     36            EXTENSION_DDL = ".ddl"; 
    3537            EXTENSION_OBJECT_FILE = ".obj"; 
    3638        } 
     
    4042            EXTENSION_STATIC_LIBRARY = ".a"; 
    4143            EXTENSION_DYNAMIC_LIBRARY = ".so"; 
     44            EXTENSION_DDL = ".ddl"; 
    4245            EXTENSION_OBJECT_FILE = ".o"; 
    4346        } 
  • trunk/descent.building/src/descent/internal/building/BuildingPlugin.java

    r1186 r1187  
    2828     */ 
    2929    public static final String ID_EXTENSION_POINT_D_BUILDERS = "dBuilders"; 
     30     
     31    /** 
     32     * Identifier for the 'compilerInterfaces' extension point 
     33     */ 
     34    public static final String ID_EXTENSION_POINT_COMPILER_INTERFACES = "compilerInterfaces"; 
    3035     
    3136    /** 
  • trunk/descent.building/src/descent/internal/building/compiler/DmdCompilerInterface.java

    r1184 r1187  
    1010import descent.building.compiler.CompilerOption; 
    1111import descent.building.compiler.ICompileCommand; 
    12 import descent.building.compiler.ICompilerInterface; 
    1312import descent.building.compiler.ILinkCommand; 
    1413import descent.building.compiler.IResponseInterpreter; 
    1514import descent.building.compiler.BuildResponse; 
    16 import descent.internal.building.compiler.ui.GdcUIOptions; 
    1715 
    1816import static descent.internal.building.compiler.ui.DmdUIOptions.*; 
    1917 
    20 public class DmdCompilerInterface implements ICompilerInterface 
     18public final class DmdCompilerInterface extends DmdfeCompilerInterface 
    2119{ 
    2220    protected static final boolean DEBUG = true; 
     
    260258    // UI Options 
    261259     
    262     private static final CompilerOption[] uiOptions; 
    263      
    264     static 
     260    private CompilerOption[] uiOptions; 
     261     
     262    public synchronized final CompilerOption[] getOptions() 
     263    { 
     264        if(null == uiOptions) 
     265            initializeUIOptions(); 
     266        return uiOptions; 
     267    } 
     268     
     269    private final void initializeUIOptions() 
    265270    { 
    266271        List<CompilerOption> options = new ArrayList<CompilerOption>(); 
     
    273278        options.add(OPTION_INSTRUMENT_FOR_PROFILE); 
    274279         
    275         // Optimization 
     280        // Generated code 
    276281        options.add(OPTION_OPTIMIZE_CODE); 
    277282        options.add(OPTION_INLINE_CODE); 
     
    282287        options.add(OPTION_SHOW_WARNINGS); 
    283288         
    284         // TODO testing 
    285         options.add(GdcUIOptions.OPTION_EMIT_TEMPLATES); 
    286          
    287289        uiOptions = options.toArray(new CompilerOption[options.size()]); 
    288290    } 
     
    294296     * @see descent.launching.compiler.ICompilerInterface#createCompileCommand() 
    295297     */ 
    296     public ICompileCommand createCompileCommand() 
     298    public final ICompileCommand createCompileCommand() 
    297299    { 
    298300        return new DmdCompileCommand(); 
     
    302304     * @see descent.launching.compiler.ICompilerInterface#createLinkCommand() 
    303305     */ 
    304     public ILinkCommand createLinkCommand() 
     306    public final ILinkCommand createLinkCommand() 
    305307    { 
    306308        return new DmdLinkCommand(); 
     
    310312     * @see descent.launching.compiler.ICompilerInterface#createCompileResponseInterpreter() 
    311313     */ 
    312     public IResponseInterpreter createCompileResponseInterpreter() 
     314    public final IResponseInterpreter createCompileResponseInterpreter() 
    313315    { 
    314316        return new DmdResponseInterpreter(); 
     
    318320     * @see descent.launching.compiler.ICompilerInterface#createLinkResponseInterpreter() 
    319321     */ 
    320     public IResponseInterpreter createLinkResponseInterpreter() 
     322    public final IResponseInterpreter createLinkResponseInterpreter() 
    321323    { 
    322324        return new DmdResponseInterpreter(); 
    323325    } 
    324  
    325     public CompilerOption[] getOptions() 
    326     { 
    327         return uiOptions; 
    328     } 
    329326} 
  • trunk/descent.building/src/descent/internal/building/compiler/ui/CompilerUIOptions.java

    r1184 r1187  
    11package descent.internal.building.compiler.ui; 
    22 
    3 public abstract class CompilerUIOptions 
     3import static descent.building.IDescentBuilderConstants.*; 
     4import descent.building.compiler.BooleanOption; 
     5 
     6/* package */ interface CompilerUIOptions 
    47{ 
    58    public static final String GROUP_FEATURES = "Features"; 
     
    811    public static final String GROUP_LINKER = "Linker"; 
    912    public static final String GROUP_COMPATABILITY = "Compatability"; 
     13     
     14    /* package */ static final class AddDebugInfoOption extends BooleanOption 
     15    { 
     16        protected AddDebugInfoOption(String onText) 
     17        { 
     18            super(ATTR_ADD_DEBUG_INFO, true, "Add debugging symbols", 
     19                    GROUP_FEATURES, onText, ""); 
     20        } 
     21 
     22        @Override 
     23        public String getHelpText() 
     24        { 
     25            return "Adds debugging symbols. These make the generated objects " 
     26                    + "slightly larger but is needed to use a debugger with the " 
     27                    + "program."; 
     28        } 
     29    } 
     30 
     31    /* package */ static final class DisableAssertsOption extends BooleanOption 
     32    { 
     33        protected DisableAssertsOption(String onText) 
     34        { 
     35            super(ATTR_DISABLE_ASSERTS, false, "Release mode", GROUP_FEATURES, 
     36                    onText, ""); 
     37        } 
     38 
     39        @Override 
     40        public String getHelpText() 
     41        { 
     42            return "Turns off assert() statements in the code, in {} and out {} " 
     43                    + "blocks on functions, and checking for array bounds errors. This " 
     44                    + "makes the code run faster, so is a good choice for releasing the " 
     45                    + "application, but are often useful for development."; 
     46        } 
     47    } 
     48 
     49    /* package */ static final class AddUnittestsOption extends BooleanOption 
     50    { 
     51        protected AddUnittestsOption(String onText) 
     52        { 
     53            super(ATTR_ADD_UNITTESTS, false, "Add unit tests", GROUP_FEATURES, 
     54                    onText, ""); 
     55        } 
     56 
     57        @Override 
     58        public String getHelpText() 
     59        { 
     60            return "Adds code so that unittest {} blocks in your code are run before " 
     61                    + "the program launches and enables version(unitttest) {} blocks."; 
     62        } 
     63    } 
     64 
     65    /* package */ static final class InstrumentForCoverageOption extends BooleanOption 
     66    { 
     67        protected InstrumentForCoverageOption(String onText) 
     68        { 
     69            super(ATTR_INSTRUMENT_FOR_COVERAGE, false, 
     70                    "Instrument for coverage analysis", GROUP_FEATURES, onText, 
     71                    ""); 
     72        } 
     73 
     74        @Override 
     75        public String getHelpText() 
     76        { 
     77            return "Adds code to the generated objects so that they will generate " 
     78                    + "a file containing code coverage information after the program " 
     79                    + "has been run. This is useful for seeing if unit tests execute " 
     80                    + "all paths in your code."; 
     81        } 
     82    } 
     83 
     84    /* package */ static final class InstrumentForProfileOption extends BooleanOption 
     85    { 
     86        protected InstrumentForProfileOption(String onText) 
     87        { 
     88            super(ATTR_INSTRUMENT_FOR_PROFILE, false, 
     89                    "Instrument for profiling", GROUP_FEATURES, onText, ""); 
     90        } 
     91 
     92        @Override 
     93        public String getHelpText() 
     94        { 
     95            return "Adds code to the generated objects so they can be profiled. " 
     96                    + "This helps find bottlenecks that could be slowing down your " 
     97                    + "application."; 
     98        } 
     99    } 
    10100} 
  • trunk/descent.building/src/descent/internal/building/compiler/ui/DmdUIOptions.java

    r1184 r1187  
    11package descent.internal.building.compiler.ui; 
    22 
     3import static descent.internal.building.compiler.IDmdCompilerConstants.ATTR_NOFLOAT; 
    34import descent.building.compiler.BooleanOption; 
    45import descent.building.compiler.CompilerOption; 
    56 
    6 import static descent.building.IDescentBuilderConstants.*; 
    7 import static descent.internal.building.compiler.IDmdCompilerConstants.*; 
    8  
    9 public final class DmdUIOptions extends CompilerUIOptions 
     7public interface DmdUIOptions extends DmdfeUIOptions 
    108{ 
    11     public static final CompilerOption OPTION_ADD_DEBUG_INFO =  
    12         new BooleanOption 
    13         ( 
    14                 ATTR_ADD_DEBUG_INFO, 
    15                 true, 
    16                 "Add debugging symbols", 
    17                 GROUP_FEATURES, 
    18                 "-g", 
    19                 "", 
    20                 "Adds debugging symbols. These make the generated objects " + 
    21                 "slightly larger but is needed to use a debugger with the " + 
    22                 "program." 
    23         ); 
     9    public static final CompilerOption OPTION_ADD_DEBUG_INFO = new AddDebugInfoOption("-g"); 
     10    public static final CompilerOption OPTION_DISABLE_ASSERTS = new DisableAssertsOption("-release"); 
     11    public static final CompilerOption OPTION_ADD_UNITTESTS = new AddUnittestsOption("-unittest"); 
     12    public static final CompilerOption OPTION_INSTRUMENT_FOR_COVERAGE = new InstrumentForCoverageOption("-cov"); 
     13    public static final CompilerOption OPTION_INSTRUMENT_FOR_PROFILE = new InstrumentForProfileOption("-profile"); 
    2414     
     15    public static final CompilerOption OPTION_OPTIMIZE_CODE = new OptimizeCodeOption("-O"); 
     16    public static final CompilerOption OPTION_INLINE_CODE = new InlineCodeOption("-inline"); 
     17    public static final CompilerOption OPTION_NOFLOAT = new BooleanOption 
     18        (ATTR_NOFLOAT, false, "Don't generate __fltused reference", 
     19         GROUP_GENERATED_CODE, "-nofloat", "") 
     20    { 
     21        @Override 
     22        public String getHelpText() 
     23        { 
     24            return "Prevents the emission of the __fltused reference in object files, " 
     25                    + "even if floating point code is present. This is useful in library " 
     26                    + "files."; 
     27        } 
     28    }; 
    2529     
    26     public static final CompilerOption OPTION_DISABLE_ASSERTS = 
    27         new BooleanOption 
    28         ( 
    29                 ATTR_DISABLE_ASSERTS, 
    30                 false, 
    31                 "Release mode", 
    32                 GROUP_FEATURES, 
    33                 "-release", 
    34                 "", 
    35                 "Turns off assert() statements in the code, in {} and out {} " + 
    36                 "blocks on functions, and checking for array bounds errors. This " + 
    37                 "makes the code run faster, so is a good choice for releasing the " + 
    38                 "application, but are often useful for development." 
    39         ); 
    40      
    41     public static final CompilerOption OPTION_ADD_UNITTESTS = 
    42         new BooleanOption 
    43         ( 
    44                 ATTR_ADD_UNITTESTS, 
    45                 false, 
    46                 "Add unit tests", 
    47                 GROUP_FEATURES, 
    48                 "-unittest", 
    49                 "", 
    50                 "Adds code so that unittest {} blocks in your code are run before " + 
    51                 "the program launches and enables version(unitttest) {} blocks." 
    52         ); 
    53      
    54      
    55     public static final CompilerOption OPTION_INSTRUMENT_FOR_COVERAGE = 
    56     new BooleanOption 
    57     ( 
    58             ATTR_INSTRUMENT_FOR_COVERAGE, 
    59             false, 
    60             "Instrument for coverage analysis", 
    61             GROUP_FEATURES, 
    62             "-cov", 
    63             "", 
    64             "Adds code to the generated objects so that they will generate " + 
    65             "a file containing code coverage information after the program " + 
    66             "has been run. This is useful for seeing if unit tests execute " + 
    67             "all paths in your code." 
    68     ); 
    69      
    70     public static final CompilerOption OPTION_INSTRUMENT_FOR_PROFILE = 
    71         new BooleanOption 
    72         ( 
    73                 ATTR_INSTRUMENT_FOR_PROFILE, 
    74                 false, 
    75                 "Instrument for profiling", 
    76                 GROUP_FEATURES, 
    77                 "-profile", 
    78                 "", 
    79                 "Adds code to the generated objects so they can be profiled. " + 
    80                 "This helps find bottlenecks that could be slowing down your " + 
    81                 "application." 
    82         ); 
    83      
    84     public static final CompilerOption OPTION_ALLOW_DEPRECATED = 
    85         new BooleanOption 
    86         ( 
    87                 ATTR_ALLOW_DEPRECATED, 
    88                 true, 
    89                 "Allow deprecated code", 
    90                 GROUP_WARNINGS, 
    91                 "-d", 
    92                 "", 
    93                 "Allows code marked with the \"deprecated\" tags to be included " + 
    94                 "in your program." 
    95         ); 
    96      
    97     public static final CompilerOption OPTION_SHOW_WARNINGS = 
    98         new BooleanOption 
    99         ( 
    100                 ATTR_SHOW_WARNINGS, 
    101                 false, 
    102                 "Show warnings", 
    103                 GROUP_WARNINGS, 
    104                 "-w", 
    105                 "", 
    106                 "Adds warnings for potentially unsafe or error-prone code. In " + 
    107                 "DMD, if warnings are encountered, the program will not be " + 
    108                 "compiled." 
    109         ); 
    110      
    111     public static final CompilerOption OPTION_OPTIMIZE_CODE = 
    112         new BooleanOption 
    113         ( 
    114                 ATTR_OPTIMIZE_CODE, 
    115                 false, 
    116                 "Optimize code", 
    117                 GROUP_GENERATED_CODE, 
    118                 "-O", 
    119                 "", 
    120                 "Optimizes the generated code for best efficiency." 
    121         ); 
    122      
    123     public static final CompilerOption OPTION_INLINE_CODE = 
    124         new BooleanOption 
    125         ( 
    126                 ATTR_INLINE_CODE, 
    127                 false, 
    128                 "Inline functions", 
    129                 GROUP_GENERATED_CODE, 
    130                 "-inline", 
    131                 "", 
    132                 "Allows inlining of short functions for increased code efficiency. " + 
    133                 "This may cause issues with some debuggers." 
    134          ); 
    135      
    136     public static final CompilerOption OPTION_NOFLOAT = 
    137         new BooleanOption 
    138         ( 
    139                 ATTR_NOFLOAT, 
    140                 false, 
    141                 "Don't generate __fltused reference", 
    142                 GROUP_GENERATED_CODE, 
    143                 "-nofloat", 
    144                 "", 
    145                 "Prevents the emission of the __fltused reference in object files, " + 
    146                 "even if floating point code is present. This is useful in library " + 
    147                 "files." 
    148         ); 
     30    public static final CompilerOption OPTION_ALLOW_DEPRECATED = new AllowDeprecatedOption("-d"); 
     31    public static final CompilerOption OPTION_SHOW_WARNINGS = new ShowWarningsOption("-w"); 
    14932} 
  • trunk/descent.building/src/descent/internal/building/compiler/ui/GdcUIOptions.java

    r1186 r1187  
    55import descent.building.compiler.EnumOption; 
    66 
    7 import static descent.building.IDescentBuilderConstants.*; 
    87import static descent.internal.building.compiler.IGdcCompilerConstants.*; 
    98 
    10 public class GdcUIOptions extends CompilerUIOptions 
     9public interface GdcUIOptions extends DmdfeUIOptions 
    1110{ 
    12     public static final CompilerOption OPTION_ADD_DEBUG_INFO =  
    13         new BooleanOption 
    14         ( 
    15                 ATTR_ADD_DEBUG_INFO, 
    16                 true, 
    17                 "Add debugging symbols", 
    18                 GROUP_FEATURES, 
    19                 "-g", 
    20                 "", 
    21                 "Adds debugging symbols. These make the generated objects " + 
    22                 "slightly larger but is needed to use a debugger with the " + 
    23                 "program." 
    24         ); 
     11    public static final CompilerOption OPTION_ADD_DEBUG_INFO = new AddDebugInfoOption("-g"); 
     12    public static final CompilerOption OPTION_DISABLE_ASSERTS = new DisableAssertsOption("-frelease"); 
     13    public static final CompilerOption OPTION_ADD_UNITTESTS = new AddUnittestsOption("-funittest"); 
    2514     
    26      
    27     public static final CompilerOption OPTION_DISABLE_ASSERTS = 
    28         new BooleanOption 
    29         ( 
    30                 ATTR_DISABLE_ASSERTS, 
    31                 false, 
    32                 "Release mode", 
    33                 GROUP_FEATURES, 
    34                 "-frelease", 
    35                 "", 
    36                 "Turns off assert() statements in the code, in {} and out {} " + 
    37                 "blocks on functions, and checking for array bounds errors. This " + 
    38                 "makes the code run faster, so is a good choice for releasing the " + 
    39                 "application, but are often useful for development." 
    40         ); 
    41      
    42     public static final CompilerOption OPTION_ADD_UNITTESTS = 
    43         new BooleanOption 
    44         ( 
    45                 ATTR_ADD_UNITTESTS, 
    46                 false, 
    47                 "Add unit tests", 
    48                 GROUP_FEATURES, 
    49                 "-funittest", 
    50                 "", 
    51                 "Adds code so that unittest {} blocks in your code are run before " + 
    52                 "the program launches and enables version(unitttest) {} blocks." 
    53         ); 
    54      
    55     public static final CompilerOption OPTION_ALLOW_DEPRECATED = 
    56         new BooleanOption 
    57         ( 
    58                 ATTR_ALLOW_DEPRECATED, 
    59                 true, 
    60                 "Allow deprecated code", 
    61                 GROUP_WARNINGS, 
    62                 "-fdeprecated", 
    63                 "", 
    64                 "Allows code marked with the \"deprecated\" tags to be included " + 
    65                 "in your program." 
    66         ); 
    67      
    68     public static final CompilerOption OPTION_SHOW_WARNINGS = 
    69         new BooleanOption 
    70         ( 
    71                 ATTR_SHOW_WARNINGS, 
    72                 false, 
    73                 "Show warnings", 
    74                 GROUP_WARNINGS, 
    75                 "-Wall", 
    76                 "", 
    77                 "Adds warnings for potentially unsafe or error-prone code. In " + 
    78                 "DMD, if warnings are encountered, the program will not be " + 
    79                 "compiled." 
    80         ); 
    81      
    82     public static final CompilerOption OPTION_OPTIMIZE_CODE = 
    83         new BooleanOption 
    84         ( 
    85                 ATTR_OPTIMIZE_CODE, 
    86                 false, 
    87                 "Optimize code", 
    88                 GROUP_GENERATED_CODE, 
    89                 "-O3", 
    90                 "", 
    91                 "Optimizes the generated code for best efficiency." 
    92         ); 
    93      
    94     public static final CompilerOption OPTION_INLINE_CODE = 
    95         new BooleanOption 
    96         ( 
    97                 ATTR_INLINE_CODE, 
    98                 false, 
    99                 "Inline functions", 
    100                 GROUP_GENERATED_CODE, 
    101                 "-finline-functions", 
    102                 "", 
    103                 "Allows inlining of short functions for increased code efficiency. " + 
    104                 "This may cause issues with some debuggers." 
    105          ); 
     15    public static final CompilerOption OPTION_OPTIMIZE_CODE = new OptimizeCodeOption("-O3"); 
     16    public static final CompilerOption OPTION_INLINE_CODE = new InlineCodeOption("-finline-functions"); 
     17    public static final CompilerOption OPTION_ALLOW_DEPRECATED = new AllowDeprecatedOption("-fdeprecated"); 
     18    public static final CompilerOption OPTION_SHOW_WARNINGS = new ShowWarningsOption("-Wall"); 
    10619     
    10720    public static final CompilerOption OPTION_ALL_SOURCES = 
     
    11326                GROUP_COMPATABILITY, 
    11427                "-fall-sources", 
    115                 "", 
    116                 "For each source file on the command line, semantically process each " + 
    117                 "file preceding it.  Use this if compilation errors occur due to " + 
    118                 "complicated circular module references.  This will slow compilation " + 
    119                 "noticeably." 
    120          ); 
     28                "" 
     29         ) 
     30    { 
     31        @Override 
     32        public String getHelpText() 
     33        { 
     34            return "For each source file on the command line, semantically process each " + 
     35            "file preceding it.  Use this if compilation errors occur due to " + 
     36            "complicated circular module references.  This will slow compilation " + 
     37            "noticeably."; 
     38        } 
     39    }; 
    12140     
    12241    public static final CompilerOption OPTION_EMIT_TEMPLATES = 
     
    14261                    "All", 
    14362                    "None" 
    144                 }, 
    145                 "<p>Controls whether or not template code is emitted:</p>" + 
    146                 "<li>Normal -- Emit templates, expecting multiple copies to be merged by the linker.</li>" + 
    147                 "<li>Auto -- For targets that support templates, the \"all\" mode is used.  Otherwise, the \"private\" mode is used.</li>" + 
    148                 "<li>Private -- Emit templates, but make them private to the translation unit.  The executable will have multiple copies of code and data.</li>" + 
    149                 "<li>All -- Emit all template instances with public visibility.  Do this even if they would not normally be emitted.</li>" + 
    150                 "<li>None -- Do not emit templates at all.</li>" 
    151         ); 
     63                } 
     64        ) 
     65    { 
     66        @Override 
     67        public String getHelpText() 
     68        { 
     69            return "<p>Controls whether or not template code is emitted:</p>" + 
     70            "<li>Normal -- Emit templates, expecting multiple copies to be merged by the linker.</li>" + 
     71            "<li>Auto -- For targets that support templates, the \"all\" mode is used.  Otherwise, the \"private\" mode is used.</li>" + 
     72            "<li>Private -- Emit templates, but make them private to the translation unit.  The executable will have multiple copies of code and data.</li>" + 
     73            "<li>All -- Emit all template instances with public visibility.  Do this even if they would not normally be emitted.</li>" + 
     74            "<li>None -- Do not emit templates at all.</li>"; 
     75        } 
     76    }; 
    15277} 
  • trunk/descent.building/src/descent/internal/building/ui/CompilerTab.java

    r1184 r1187  
    66import java.util.TreeMap; 
    77 
     8import org.eclipse.core.runtime.CoreException; 
    89import org.eclipse.debug.core.ILaunchConfiguration; 
    910import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 
     
    4142import org.eclipse.ui.forms.widgets.ScrolledFormText; 
    4243 
     44import descent.building.CompilerInterfaceRegistry; 
     45import descent.building.ICompilerInterfaceType; 
    4346import descent.building.IDescentBuilderConstants; 
    4447import descent.building.compiler.BooleanOption; 
     
    4851import descent.building.compiler.IValidatableOption; 
    4952import descent.building.compiler.StringOption; 
    50 import descent.internal.building.compiler.DmdCompilerInterface
     53import descent.internal.building.BuildingPlugin
    5154import descent.launching.IVMInstall; 
    5255import descent.launching.IVMInstallType; 
    5356import descent.launching.JavaRuntime; 
    5457 
     58// TODO egads, the whole issue of synchronizing all this is CRAZY!!!! So 
     59// this is in a NON-WORKING STATE right now 
    5560/* package */ final class CompilerTab extends AbstractBuilderTab 
    5661{    
     
    109114                    IVMInstall selectedCompiler = selectedIndex >= 0 ? 
    110115                            fCompilers[selectedIndex] : null; 
    111                     compilerOptions.compilerModeChanged(selectedCompiler); 
     116                    compilerOptions.initializeInput(selectedCompiler); 
    112117                     
    113118                    validatePage(); 
     
    164169        public void initializeFrom(ILaunchConfiguration config) 
    165170        { 
     171            int i = getCompilerIndex(config); 
     172            if(-1 != i) 
     173                fCombo.select(i); 
     174            else if(fCompilers.length >= 0) 
     175                fCombo.select(0); 
     176        } 
     177         
     178        public IVMInstall getCompiler(ILaunchConfiguration config) 
     179        { 
     180            int i = getCompilerIndex(config); 
     181            return -1 == i ? null : fCompilers[i]; 
     182        } 
     183         
     184        private int getCompilerIndex(ILaunchConfiguration config) 
     185        { 
     186            initializeCompilers(); 
    166187            String compilerTypeId = getAttribute(config,  
    167188                    IDescentBuilderConstants.ATTR_COMPILER_TYPE_ID, ""); 
     
    175196                        compiler.getId().equals(compilerId)) 
    176197                { 
    177                     fCombo.select(i); 
    178                     return; 
    179                 } 
    180             } 
    181              
    182             if(fCompilers.length >= 0) 
    183                 fCombo.select(0); 
     198                    return i; 
     199                } 
     200            } 
     201             
     202            return -1; 
    184203        } 
    185204 
     
    202221        public void setDefaults(ILaunchConfigurationWorkingCopy config) 
    203222        { 
    204             initializeCompilers(); 
    205             if(fCompilers.length > 0) 
    206             { 
    207                 IVMInstall first = fCompilers[0]; 
    208                 config.setAttribute(IDescentBuilderConstants.ATTR_COMPILER_TYPE_ID, first.getVMInstallType().getId()); 
    209                 config.setAttribute(IDescentBuilderConstants.ATTR_COMPILER_ID, first.getId()); 
     223            IVMInstall defaultCompiler = getDefault(); 
     224            if(null != defaultCompiler) 
     225            { 
     226                config.setAttribute(IDescentBuilderConstants.ATTR_COMPILER_TYPE_ID, defaultCompiler.getVMInstallType().getId()); 
     227                config.setAttribute(IDescentBuilderConstants.ATTR_COMPILER_ID, defaultCompiler.getId()); 
    210228            } 
    211229            else 
     
    215233            } 
    216234        } 
     235         
     236        public IVMInstall getDefault() 
     237        { 
     238            initializeCompilers(); 
     239            return fCompilers.length > 0 ? fCompilers[0] : null; 
     240        } 
    217241 
    218242        public String validate() 
    219243        { 
    220244            int selectedIndex = fCombo.getSelectionIndex(); 
     245             
    221246            if(selectedIndex < 0) 
    222247                return "You must select a compiler to use"; 
     
    428453        } 
    429454         
     455        // TODO file UI options 
     456         
    430457        private final class TreeEntry 
    431458        { 
     
    444471         
    445472        private final class OptionsContentProvider implements ITreeContentProvider 
    446         { 
     473        {    
    447474