ScriptCompiler should now compile scripts with /optimize flag when -debug is NOT enabled.
This commit is contained in:
parent
b90d8fdb8d
commit
22557eef9f
1 changed files with 14 additions and 11 deletions
|
|
@ -78,26 +78,29 @@ namespace Server
|
|||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static string GetDefines()
|
||||
public static string GetCompilerOptions( bool debug )
|
||||
{
|
||||
StringBuilder sb = null;
|
||||
|
||||
if( !debug )
|
||||
AppendCompilerOption( ref sb, "/optimize" );
|
||||
|
||||
#if MONO
|
||||
AppendDefine( ref sb, "/d:MONO" );
|
||||
#endif
|
||||
|
||||
//These following defines are legacy, ie, depreciated.
|
||||
if( Core.Is64Bit )
|
||||
AppendDefine( ref sb, "/d:x64" );
|
||||
AppendCompilerOption( ref sb, "/d:x64" );
|
||||
|
||||
AppendDefine( ref sb, "/d:Framework_2_0" );
|
||||
AppendCompilerOption( ref sb, "/d:Framework_2_0" );
|
||||
|
||||
AppendDefine( ref sb, "/d:Framework_4_0" );
|
||||
AppendCompilerOption( ref sb, "/d:Framework_4_0" );
|
||||
|
||||
return (sb == null ? null : sb.ToString());
|
||||
}
|
||||
|
||||
public static void AppendDefine( ref StringBuilder sb, string define )
|
||||
private static void AppendCompilerOption( ref StringBuilder sb, string define )
|
||||
{
|
||||
if( sb == null )
|
||||
sb = new StringBuilder();
|
||||
|
|
@ -217,10 +220,10 @@ namespace Server
|
|||
|
||||
CompilerParameters parms = new CompilerParameters( GetReferenceAssemblies(), path, debug );
|
||||
|
||||
string defines = GetDefines();
|
||||
string options = GetCompilerOptions( debug );
|
||||
|
||||
if( defines != null )
|
||||
parms.CompilerOptions = defines;
|
||||
if( options != null )
|
||||
parms.CompilerOptions = options;
|
||||
|
||||
if( Core.HaltOnWarning )
|
||||
parms.WarningLevel = 4;
|
||||
|
|
@ -357,10 +360,10 @@ namespace Server
|
|||
|
||||
CompilerParameters parms = new CompilerParameters( GetReferenceAssemblies(), path, debug );
|
||||
|
||||
string defines = GetDefines();
|
||||
string options = GetCompilerOptions( debug );
|
||||
|
||||
if( defines != null )
|
||||
parms.CompilerOptions = String.Format( "/D:{0}", defines );
|
||||
if( options != null )
|
||||
parms.CompilerOptions = options;
|
||||
|
||||
if( Core.HaltOnWarning )
|
||||
parms.WarningLevel = 4;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue