Skip to content

Commit

Permalink
feat(Compiler): Optimize compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Nov 20, 2019
1 parent d03dc8e commit 340a94c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Packages/com.coffee.internal-accessible/Compiler~/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public static void Main(string[] args)

// CSharpCompilationOptions
// MetadataImportOptions.All
var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, allowUnsafe: true)
var compilationOptions = new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
allowUnsafe: true,
optimizationLevel: OptimizationLevel.Release
)
.WithMetadataImportOptions(MetadataImportOptions.All);

// BindingFlags.IgnoreAccessibility
Expand All @@ -45,10 +49,11 @@ public static void Main(string[] args)
var preprocessorSymbols = csproj
.Select(line => reg_preprocessorSymbols.Match(line))
.Where(match => match.Success)
.SelectMany(match => match.Groups[1].Value.Split(';'));
.SelectMany(match => match.Groups[1].Value.Split(';'))
.Where(x=>x != "DEBUG");

// Get all source codes.
var parserOption = new CSharpParseOptions(LanguageVersion.CSharp7, preprocessorSymbols: preprocessorSymbols);
var parserOption = new CSharpParseOptions(LanguageVersion.Latest, preprocessorSymbols: preprocessorSymbols);
var reg_cs = new Regex("<Compile Include=\"(.*\\.cs)\"", RegexOptions.Compiled);
var syntaxTrees = csproj
.Select(line => reg_cs.Match(line))
Expand Down

0 comments on commit 340a94c

Please sign in to comment.