var bepInExPatchersFolder = string.Format("{0}/{1}/{2}", buildDir, "BepInEx", "patchers");
var solutionPath = "./Modules.sln";
Setup(context =>
{
//building from VS will lock the files and fail to clean the project directories. Post-Build event on Aki.Build sets this switch to true to avoid this.
FileWriteText("./vslock", "lock");
});
Teardown(context =>
{
if(FileExists("./vslock"))
{
DeleteFile("./vslock"); //remove vslock file
}
});
// Clean build directory and remove obj / bin folder from projects
Task("Clean")
.WithCriteria(!VSBuilt)
.Does(() =>
{
CleanDirectory(buildDir);
})
.DoesForEach(delPaths, (directoryPath) =>
{
DeleteDirectory(directoryPath, new DeleteDirectorySettings
{
Recursive = true,
Force = true
});
});
// Build solution
Task("Build")
.IsDependentOn("Clean")
.WithCriteria(!FileExists("./vslock")) // check for lock file if running from VS
.Does(() =>
{
DotNetBuild(solutionPath, new DotNetBuildSettings
{
Configuration = "Release"
});
});
// Copy modules, managed dlls, and license to the build folder