115 lines
4.1 KiB
Plaintext
115 lines
4.1 KiB
Plaintext
use assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
|
use namespace="System"
|
|
use namespace="System.IO"
|
|
use import="Files"
|
|
use import="BuildEnv"
|
|
use import="Environment"
|
|
|
|
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
|
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
|
|
default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
|
|
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'
|
|
default Configuration='Release'
|
|
|
|
@{
|
|
E("K_BUILD_VERSION", BuildNumber);
|
|
}
|
|
|
|
#repo-initialize target='initialize'
|
|
k-restore
|
|
|
|
#target-dir-clean target='clean'
|
|
directory delete="${TARGET_DIR}"
|
|
|
|
#build-clean target='clean'
|
|
k-clean each='var projectFile in Files.Include("src/**/project.json")'
|
|
|
|
#build-compile target='compile'
|
|
k-build each='var projectFile in Files.Include("src/**/project.json")'
|
|
@{
|
|
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
|
|
{
|
|
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
|
}
|
|
}
|
|
|
|
#native-compile target='compile' if='!IsMono'
|
|
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
|
var msbuild = '${Path.Combine(programFilesX86, "MSBuild", "12.0", "Bin", "MSBuild.exe")}'
|
|
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
|
|
|
|
@{
|
|
if(!File.Exists(msbuild))
|
|
{
|
|
Log.Warn("msbuild version 12 not found. Please ensure you have the VS 2013 C++ SDK installed.");
|
|
Environment.Exit(1);
|
|
}
|
|
else
|
|
{
|
|
foreach (var project in nativeProjects)
|
|
{
|
|
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=Win32");
|
|
Exec(msbuild, project + " /p:Configuration=" + Configuration + ";Platform=x64");
|
|
}
|
|
}
|
|
}
|
|
|
|
copy sourceDir='${Path.GetDirectoryName(project)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR, Path.GetFileNameWithoutExtension(project))}' overwrite='${true}' each='var project in nativeProjects'
|
|
|
|
|
|
#nuget-install target='install' description='Copy NuGet packages to local repo'
|
|
nuget-local-publish sourcePackagesDir='${BUILD_DIR}'
|
|
|
|
#xunit-test target='test' if='Directory.Exists("test")'
|
|
k-test each='var projectFile in Files.Include("test/**/project.json")'
|
|
|
|
#make-roslyn-fast
|
|
ngen-roslyn
|
|
|
|
#resx
|
|
@{
|
|
foreach (var file in Directory.EnumerateFiles(BASE_DIR, "*.resx", SearchOption.AllDirectories))
|
|
{
|
|
UpdateResx(file);
|
|
}
|
|
}
|
|
|
|
#restore-npm-modules
|
|
-// Find all dirs that contain a package.json file
|
|
var npmDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json")}'
|
|
npm npmCommand='install' each='var npmDir in npmDirs'
|
|
|
|
#restore-bower-components
|
|
-// Find all dirs that contain a bower.json file
|
|
var bowerDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "bower.json")}'
|
|
bower each='var bowerDir in bowerDirs' bowerCommand='install'
|
|
|
|
#run-grunt .restore-npm-modules .restore-bower-components target='compile'
|
|
-// Find all dirs that contain a gruntfile.js file
|
|
var gruntDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "gruntfile.js")}'
|
|
grunt each='var gruntDir in gruntDirs'
|
|
|
|
#stylecop
|
|
stylecop-setup
|
|
stylecop-run each='var projectFile in Files.Include("src/**/project.json")'
|
|
|
|
functions @{
|
|
string E(string key) { return Environment.GetEnvironmentVariable(key); }
|
|
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
|
|
IEnumerable<string> GetDirectoriesContaining(string path, string searchPattern) {
|
|
var sep = Path.DirectorySeparatorChar;
|
|
// Don't include directories that are children of a node_modules or bower_components directory
|
|
return Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories)
|
|
.Where(p => p.IndexOf(sep + "node_modules" + sep) < 0 &&
|
|
p.IndexOf(sep + "bower_components" + sep) < 0)
|
|
.Select(p => Path.GetDirectoryName(p))
|
|
.Distinct();
|
|
}
|
|
}
|
|
|
|
macro name='Exec' program='string' commandline='string'
|
|
exec
|
|
|
|
macro name="UpdateResx" resxFile='string'
|
|
k-generate-resx
|