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

136 refactor from ix to ax# #138

Merged
merged 21 commits into from
Mar 27, 2023
95 changes: 54 additions & 41 deletions cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public sealed class CleanUpTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.DotNetClean(Path.Combine(context.ScrDir, "AXSharp.sln"), new DotNetCleanSettings() { Verbosity = context.BuildParameters.Verbosity});
context.DotNetClean(Path.Combine(context.ScrDir, "AXSharp.sln"), new DotNetCleanSettings() { Verbosity = context.BuildParameters.Verbosity });
context.CleanDirectory(context.Artifacts);
context.CleanDirectory(context.TestResults);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ public override void Run(BuildContext context)
}

context.DotNetBuild(Path.Combine(context.ScrDir, "AXSharp.sln"), context.DotNetBuildSettings);

}
}

Expand All @@ -149,7 +149,7 @@ public override void Run(BuildContext context)
return;
}


if (context.BuildParameters.TestLevel == 1)
{
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L1-tests.slnf"));
Expand All @@ -164,7 +164,7 @@ public override void Run(BuildContext context)
}
else
{
context.UploadTestPlc(
context.UploadTestPlc(
Path.GetFullPath(Path.Combine(context.WorkDirName, "..//..//src//AXSharp.connectors//tests//ax-test-project//")),
Environment.GetEnvironmentVariable("AX_WEBAPI_TARGET"),
Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT"));
Expand All @@ -177,13 +177,13 @@ public override void Run(BuildContext context)
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests.slnf"));
}



}






}

[TaskName("CreateArtifacts")]
Expand All @@ -201,17 +201,17 @@ public override void Run(BuildContext context)
PackPackages(context, Path.Combine(context.ScrDir, "AXSharp-packable-only.slnf"));
}



private static void PackPackages(BuildContext context, string solutionToPack)
{
context.DotNetPack(solutionToPack,
{
context.DotNetPack(solutionToPack,
new Cake.Common.Tools.DotNet.Pack.DotNetPackSettings()
{
OutputDirectory = Path.Combine(context.Artifacts, @"nugets"),
NoRestore = true,
NoBuild = false,
});
{
OutputDirectory = Path.Combine(context.Artifacts, @"nugets"),
NoRestore = true,
NoBuild = false,
});
}
}

Expand Down Expand Up @@ -244,7 +244,7 @@ public override void Run(BuildContext context)
{
//var licensedFiles = Directory.EnumerateFiles(Path.Combine(context.RootDir, "apax", ".apax", "packages"),
var licensedFiles = Directory.EnumerateFiles(Path.Combine(context.ScrDir, "apax", "stc"),
"AX.*.*",
"AX.*.*",
SearchOption.AllDirectories)
.Select(p => new FileInfo(p));

Expand Down Expand Up @@ -375,12 +375,22 @@ public override void Run(BuildContext context)
});
}

foreach (var template in context.GetTemplateProjects())
{
context.ProcessRunner.Start(@"dotnet", new Cake.Core.IO.ProcessSettings()
{
Arguments = $" ixc ",
WorkingDirectory = template.ax

});
}

foreach (var template in context.GetTemplateProjects())
{
context.DotNetBuild(Path.Combine(context.ScrDir, template.solution), context.DotNetBuildSettings);
}


}
}

Expand All @@ -396,14 +406,17 @@ public override void Run(BuildContext context)
return;
}

foreach (var template in context.GetTemplateProjects())
if (context.BuildParameters.TestLevel >= 3)
{
context.UploadTestPlc(
Path.GetFullPath(Path.Combine(template.ax)),
Environment.GetEnvironmentVariable("AXTARGET"),
Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT"));
foreach (var template in context.GetTemplateProjects())
{
context.UploadTestPlc(
Path.GetFullPath(Path.Combine(template.ax)),
Environment.GetEnvironmentVariable("AXTARGET"),
Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT"));

// context.DotNetRun(template.approject, context.DotNetRunSettings);
// context.DotNetRun(template.approject, context.DotNetRunSettings);
}
}
}
}
Expand All @@ -426,34 +439,34 @@ public override void Run(BuildContext context)
}

private static void PackTemplatePackages(BuildContext context, string solutionToPack)
{
context.DotNetPack(solutionToPack,
new Cake.Common.Tools.DotNet.Pack.DotNetPackSettings()
{
OutputDirectory = Path.Combine(context.Artifacts, @"templates"),
Sources = new List<string>() { Path.Combine(context.Artifacts, "templates") },
NoRestore = false,
NoBuild = false,
});
}
{
context.DotNetPack(solutionToPack,
new Cake.Common.Tools.DotNet.Pack.DotNetPackSettings()
{
OutputDirectory = Path.Combine(context.Artifacts, @"templates"),
Sources = new List<string>() { Path.Combine(context.Artifacts, "templates") },
NoRestore = false,
NoBuild = false,
});
}

}

[TaskName("Templates push")]
[IsDependentOn(typeof(TemplatesPackTask))]
public class TemplatesPush : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
public override void Run(BuildContext context)
if (!context.BuildParameters.DoPublish)
{
if (!context.BuildParameters.DoPublish)
{
context.Log.Warning($"Skipping template build.");
return;
}

context.PushNugetPackages("templates");
context.Log.Warning($"Skipping template build.");
return;
}

context.PushNugetPackages("templates");
}
}

[TaskName("Default")]
[IsDependentOn(typeof(TemplatesPush))]
Expand Down