From 084d6e354450ce5d357119bd674f67178ced4c45 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 21 Jan 2014 20:17:07 -0800 Subject: [PATCH] Added initial build. --- .gitignore | 13 +------- build.cmd | 12 +++++++ build/_k-build.shade | 17 ++++++++++ build/_k-clean.shade | 13 ++++++++ build/_k-standard-goals.shade | 43 +++++++++++++++++++++++++ build/_k.shade | 31 ++++++++++++++++++ makefile.shade | 7 ++++ src/Microsoft.AspNet.Razor/project.json | 9 +++--- 8 files changed, 128 insertions(+), 17 deletions(-) create mode 100644 build.cmd create mode 100644 build/_k-build.shade create mode 100644 build/_k-clean.shade create mode 100644 build/_k-standard-goals.shade create mode 100644 build/_k.shade create mode 100644 makefile.shade diff --git a/.gitignore b/.gitignore index 7473e2211c..a15e81c51f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,18 +5,14 @@ /TestResults *.vspscc *.vssscc -deploy -deploy/* *.suo *.cache *.docstates -_ReSharper.* *.csproj.user *[Rr]e[Ss]harper.user _ReSharper.*/ packages/* artifacts/* -msbuild.log PublishProfiles/ *.psess *.vsp @@ -24,11 +20,4 @@ PublishProfiles/ *.userprefs *DS_Store *.ncrunchsolution -*.log -*.vspx -*.log.txt -/tests/Microsoft.AspNet.SignalR.FunctionalTests/artifacts/ -/samples/Microsoft.AspNet.SignalR.Client.WindowsStoreJavaScript.Samples/bld/ -jquery.signalR.js -jquery.signalR.min.js -xamarin/SignalRPackage/component/lib/mobile/ +.nuget/NuGet.exe \ No newline at end of file diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000000..e2ce3f1317 --- /dev/null +++ b/build.cmd @@ -0,0 +1,12 @@ +@echo off +cd %~dp0 + +IF EXIST .nuget\NuGet.exe goto part2 +echo Downloading latest version of NuGet.exe... +mkdir .nuget +@powershell -NoProfile -ExecutionPolicy unrestricted -Command "((new-object net.webclient).DownloadFile('https://nuget.org/nuget.exe', '.nuget\NuGet.exe'))" + +:part2 +set EnableNuGetPackageRestore=true +.nuget\NuGet.exe install Sake -version 0.2 -o packages +packages\Sake.0.2\tools\Sake.exe -I build -f makefile.shade %* diff --git a/build/_k-build.shade b/build/_k-build.shade new file mode 100644 index 0000000000..435bdca74a --- /dev/null +++ b/build/_k-build.shade @@ -0,0 +1,17 @@ +@{/* + +k-build + Builds project. Downloads and executes k sdk tools. + +projectFile='' + Required. Path to the project.json to build. + +*/} + +var projectFolder='${Path.GetDirectoryName(projectFile)}' +var projectName='${Path.GetFileName(projectFolder)}' +var projectBin='${Path.Combine(projectFolder, "bin")}' + +directory delete="${projectBin}" +k command='build ${projectFolder}' +copy sourceDir='${projectBin}' outputDir='${Path.Combine(BUILD_DIR, projectName)}' diff --git a/build/_k-clean.shade b/build/_k-clean.shade new file mode 100644 index 0000000000..7f8b643682 --- /dev/null +++ b/build/_k-clean.shade @@ -0,0 +1,13 @@ +@{/* + +k-clean + Cleans project. Downloads and executes k sdk tools. + +projectFile='' + Required. Path to the project.json to build. + +*/} + +var projectFolder='${Path.GetDirectoryName(projectFile)}' + +k command='clean ${projectFolder}' diff --git a/build/_k-standard-goals.shade b/build/_k-standard-goals.shade new file mode 100644 index 0000000000..6ae2edb94b --- /dev/null +++ b/build/_k-standard-goals.shade @@ -0,0 +1,43 @@ +use namespace="System" +use namespace="System.IO" +use import="Files" + +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")}' + +@{ + E("K_BUILD_VERSION", "t" + DateTime.UtcNow.ToString("yyMMddHHmmss")); +} + +#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); + } + } + +#nuget-install target='install' description='Copy NuGet packages to local repo' + @{ + var HOME_DIR = E("HOME"); + if (string.IsNullOrEmpty(HOME_DIR)) + { + HOME_DIR = E("HOMEDRIVE") + E("HOMEPATH"); + } + } + copy sourceDir='${BUILD_DIR}' include='*.nupkg' outputDir='${Path.Combine(HOME_DIR, ".nuget")}' overwrite='${true}' + + +functions @{ + string E(string key) { return Environment.GetEnvironmentVariable(key); } + void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); } +} diff --git a/build/_k.shade b/build/_k.shade new file mode 100644 index 0000000000..c0e216dcae --- /dev/null +++ b/build/_k.shade @@ -0,0 +1,31 @@ +@{/* + +k + Run klr commands in your project. Downloads and 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='' + +*/} + +default kLatestSuccessful='\\wsr-teamcity\Drops\ProjectK.Main\latest-successful\sdk' +default kVersion='' + +test if='string.IsNullOrEmpty(kVersion)' + for each='var file in System.IO.Directory.EnumerateFiles(kLatestSuccessful).Select(System.IO.Path.GetFileName)' + test if='file.StartsWith("ProjectK.") && file.EndsWith(".nupkg")' + - kVersion = file.Substring("ProjectK.".Length, file.Length - "ProjectK.".Length - ".nupkg".Length); + +default kProgram='packages/ProjectK.${kVersion}/tools/k.cmd' + +-// Download xunit from nuget sources if not already present +test if='!File.Exists(kProgram)' + log info='Installing ProjectK ${kVersion} from ${kLatestSuccessful}' + nuget-install package='ProjectK' packageVersion='${kVersion}' outputDir='packages' extra='-Source ${kLatestSuccessful}' + +exec program='${Path.GetFullPath(kProgram)}' commandline='${command}' diff --git a/makefile.shade b/makefile.shade new file mode 100644 index 0000000000..6357ea2841 --- /dev/null +++ b/makefile.shade @@ -0,0 +1,7 @@ + +var VERSION='0.1' +var FULL_VERSION='0.1' +var AUTHORS='Microsoft' + +use-standard-lifecycle +k-standard-goals diff --git a/src/Microsoft.AspNet.Razor/project.json b/src/Microsoft.AspNet.Razor/project.json index ba570aacfc..d1ae305356 100644 --- a/src/Microsoft.AspNet.Razor/project.json +++ b/src/Microsoft.AspNet.Razor/project.json @@ -1,7 +1,6 @@ { - "dependencies": [], - "configurations": [ - { "net45": {} }, - { "k10": {} } - ] + "configurations": { + "net45": {}, + "k10": {} + } } \ No newline at end of file