Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW-FEATURE][IXC] When compiling referenced project we should not recompile what's been compiled already #226

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,19 @@ private IEnumerable<ISyntaxTree> GetReferences()
return refParseTrees;
}

private static HashSet<string> compiled = new();

private void CompileProjectReferences(IEnumerable<IReference> referencedDependencies)
{
foreach (var ixProjectReference in AxProject.AXSharpReferences)
{

if (compiled.Contains(ixProjectReference.AxProjectFolder))
{
Log.Logger.Information($"Skipping '{ixProjectReference.AxProjectFolder}' compiled in this session previously");
continue;
}

string apaxFolder = ixProjectReference.AxProjectFolder == null
? referencedDependencies
.Where(p => p.IsIxDependency)
Expand All @@ -225,6 +234,10 @@ private void CompileProjectReferences(IEnumerable<IReference> referencedDependen
var project = new AXSharpProject(ax, BuilderTypes, targetProject.GetType());

project.Generate();

if(!string.IsNullOrEmpty(ixProjectReference.AxProjectFolder))
compiled.Add(ixProjectReference.AxProjectFolder);

}
}

Expand Down
4 changes: 4 additions & 0 deletions src/AXSharp.compiler/src/ixc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ private static AXSharpProject GenerateIxProject(Options o)
var project = new AXSharpProject(ax, new[] { typeof(CsOnlinerSourceBuilder), typeof(CsPlainSourceBuilder) },
typeof(CsProject), o);

var sw = new System.Diagnostics.Stopwatch();
sw.Start();
project.Generate();
sw.Stop();
Log.Logger.Information($"Done in {TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)}");
return project;
}

Expand Down