Skip to content

Commit

Permalink
changed order of installing refs
Browse files Browse the repository at this point in the history
  • Loading branch information
blazej.kuhajda committed Aug 15, 2024
1 parent ce712fa commit 1ecc1a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ public void Generate()

var projectSources = AxProject.Sources.Select(p => (parseTree: STParser.ParseTextAsync(p).Result, source: p));

TargetProject.ProvisionProjectStructure();

var refParseTrees = GetReferences();


var toCompile = refParseTrees.Concat(projectSources.Select(p => p.parseTree));

var compilationResult = Compilation.Create(toCompile, new List<ISemanticAnalyzer>(), Compilation.Settings.Default).Result;
Expand Down Expand Up @@ -135,7 +138,7 @@ public void Generate()
}
}

TargetProject.ProvisionProjectStructure();
//TargetProject.ProvisionProjectStructure();
GenerateMetadata(compilationResult.Compilation);
TargetProject.GenerateResources();
TargetProject.GenerateCompanionData();
Expand Down Expand Up @@ -193,17 +196,17 @@ private static string EnsureFolder(string folder)

private IEnumerable<ISyntaxTree> GetReferences()
{
TargetProject.InstallAXSharpDependencies(AxProject.AXSharpReferences);

var referencedDependencies = TargetProject.LoadReferences();

CompileProjectReferences(referencedDependencies);

var dependencyMetadata = referencedDependencies
.Where(p => p.IsIxDependency)
.Select(p => p.MetadataPath)
.Select(p => JsonConvert.DeserializeObject<IEnumerable<string>>(File.ReadAllText(p)));


CompileProjectReferences(referencedDependencies);


var refParseTrees = dependencyMetadata.SelectMany(p => p)
.Select(s => STParser.ParseTextAsync(new StringText(s)).Result);

Expand All @@ -213,8 +216,7 @@ private IEnumerable<ISyntaxTree> GetReferences()
private static HashSet<string> compiled = new();

private void CompileProjectReferences(IEnumerable<IReference> referencedDependencies)
{
TargetProject.InstallAXSharpDependencies(AxProject.AXSharpReferences);
{
foreach (var ixProjectReference in AxProject.AXSharpReferences.OfType<AXSharpConfig>())
{

Expand Down
6 changes: 6 additions & 0 deletions src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ public void InstallAXSharpDependencies(IEnumerable<object> dependencies)
if (compilerOptionsProjectFile != null)
{
var dependent = Path.Combine(this.AxSharpProject.OutputFolder, compilerOptionsProjectFile);

if (!File.Exists(dependent))
{
throw new Exception("Missing dependency file.");
}

foreach (var dependency in dependencies)
{

Expand Down

0 comments on commit 1ecc1a4

Please sign in to comment.