@{/* k Run klr commands in your project. Executes k sdk. kVersion='0.0.1-pre-30109-087' May be passed to override the nuget package version holding xunit console runner. kProgram='...' May be passed to override the path to the xunit program that will be executed command='' prefetch='true' May be passed if fetching k from nuget is required before running */} default prefetch='${true}' default mono='${IsMono}' nuget-install package='ProjectK' outputDir='packages' extra='-pre -nocache' once='ProjectK-NuGet' if='prefetch && !mono' nuget-install package='ProjectK.Mono' outputDir='packages' extra='-pre -nocache' once='ProjectK-NuGet' if='mono' @{ Func getVersion = version => { var dash = version.LastIndexOf('-'); if(dash != -1) { var lastToken = version.Substring(dash + 1); if(lastToken.StartsWith("t")) { return Int64.Parse(lastToken.Substring(1)); } return Int64.Parse(lastToken); } return Int64.MaxValue; }; var projectKPrefix = mono ? "ProjectK.Mono" : "ProjectK"; string packagesDir = Path.Combine(Directory.GetCurrentDirectory(), "packages"), projectKDir = Directory.EnumerateDirectories(packagesDir, projectKPrefix + "*") .OrderByDescending(getVersion) .First(); } default kProgram='${projectKDir}/tools/k.cmd' exec program='${Path.GetFullPath(kProgram)}' commandline='${command}' if='!mono' default kMonoProgram='${projectKDir}/tools/net45/klr.mono.managed.dll' default monoPath='${Environment.GetEnvironmentVariable("MONO_PATH")}' @{ if(mono) { if(string.IsNullOrEmpty(monoPath)) { monoPath = "mono"; } var folder = Path.Combine(projectKDir, "tools", "net45"); var kMonoEntryPoint = Path.GetFullPath(kMonoProgram); if(command.StartsWith("build")) { command = kMonoEntryPoint + " --lib " + folder + " Microsoft.Net.Project " + command; } else if(command.StartsWith("restore")) { command = Path.Combine(projectKDir, "tools", "NuGet.exe") + " " + command; } else { command = kMonoEntryPoint + " --lib " + folder + " Microsoft.Net.ApplicationHost " + command; } } } exec program='${monoPath}' commandline='${command}' if='mono'