66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
@{/*
|
|
|
|
kpm-pack
|
|
Builds package from project.
|
|
|
|
projectFile=''
|
|
Required. Path to the project.json to build.
|
|
|
|
kpmPackOutputDir=''
|
|
Required. Base output directory.
|
|
|
|
configuration=''
|
|
Optional. The configuration to build in. Defaults to 'Debug'.
|
|
*/}
|
|
|
|
default configuration = 'Debug'
|
|
default pack_options=' ${E("KOREBUILD_DNU_PACK_OPTIONS")}'
|
|
|
|
@{
|
|
if (IsBuildV2)
|
|
{
|
|
var projectsToPack = new List<string>();
|
|
foreach(var arg in projectFile.Split((char)';'))
|
|
{
|
|
if (!arg.Contains("*"))
|
|
{
|
|
projectsToPack.Add(Path.GetDirectoryName(arg));
|
|
}
|
|
else
|
|
{
|
|
var projectFolders = Files.Include(arg + "/project.json").Select(proj => Path.GetDirectoryName(proj));
|
|
projectsToPack.AddRange(projectFolders);
|
|
}
|
|
}
|
|
|
|
foreach(var projFolder in projectsToPack)
|
|
{
|
|
DeleteFolder(Path.Combine(projFolder, "bin", configuration));
|
|
}
|
|
|
|
var projectsArg=projectFile.Replace(";", " ");
|
|
var dnuArgs=string.Format("pack{0} {1} --configuration {2}", pack_options, projectsArg, configuration);
|
|
Dnu(dnuArgs);
|
|
|
|
foreach(var projFolder in projectsToPack)
|
|
{
|
|
CopyFolder(
|
|
Path.Combine(projFolder, "bin", configuration),
|
|
Path.Combine(kpmPackOutputDir, Path.GetFileName(projFolder)),
|
|
true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var projectFolder=Path.GetDirectoryName(projectFile);
|
|
var projectName=Path.GetFileName(projectFolder);
|
|
var projectBin=Path.Combine(projectFolder, "bin", configuration);
|
|
|
|
DeleteFolder(projectBin);
|
|
|
|
var dnuArgs=string.Format("pack{0} {1} --configuration {2}", pack_options, projectFolder, configuration);
|
|
Dnu(dnuArgs);
|
|
|
|
CopyFolder(projectBin, Path.Combine(kpmPackOutputDir, projectName), true);
|
|
}
|
|
} |