Skip to content

Commit

Permalink
[NEW-FEATURE] Compiler should look for nearby project from the direct…
Browse files Browse the repository at this point in the history
…ory containing workspace file (#299)

* Create draft PR for #298

* starting directoy for nearby project given by worspace file directory

* add message about workspace file

---------

Co-authored-by: PTKu <61538034+PTKu@users.noreply.github.com>
  • Loading branch information
IX-BOT and PTKu authored Mar 26, 2024
1 parent 09d705d commit 4436f9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/AXSharp.compiler/src/AXSharp.Compiler/AxProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,19 @@ private static string GetStartDirectory(string givenDirectory, int levelsUp)
if (dirInfo.Parent != null)
{
dirInfo = dirInfo.Parent;
var potentialapax = dirInfo.GetFiles().Where(p => p.Name == "apax.yml").FirstOrDefault();
if (potentialapax != null)
{
var apax = Apax.CreateApaxDto(potentialapax.FullName);
if (apax.Type == "workspace")
{
return dirInfo.FullName;
}
}
}
else
{
Log.Logger.Information("Workspace apax file was not located in the directory structure, project references won't be compiled.");
return dirInfo.FullName; // Return root if we hit it before moving the desired levels up
}
}
Expand Down Expand Up @@ -232,7 +242,7 @@ private IEnumerable<object> GetProjectDependencies()
ApaxFile = new FileInfo(Path.Combine(p, "apax.yml"))
}).ToList();

nearByProjects = SearchForApaxFiles(GetStartDirectory(this.ProjectFolder, 2), 0, 4)
nearByProjects = SearchForApaxFiles(GetStartDirectory(this.ProjectFolder, 4), 0, 4)
.Select(p => new FileInfo(p))
.Where(p => !p.Directory.FullName.Contains(".apax"))
.Select(a => new NearByProjects() { Apax = Apax.TryCreateApaxDto(a.FullName), ApaxFile = a })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"ixc-simple-template": {
"commandName": "Project",
"workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\_axopen\\axopen.template.simple\\ax"
"workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\_axopen\\axopen.templates\\axopen.template.simple\\ax"
},
"ixc-template-ref": {
"commandName": "Project",
Expand Down

0 comments on commit 4436f9b

Please sign in to comment.