diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..1ff0c42304 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/build-template/.gitattributes b/build-template/.gitattributes new file mode 100644 index 0000000000..bdaa5ba982 --- /dev/null +++ b/build-template/.gitattributes @@ -0,0 +1,50 @@ +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +*.jpg binary +*.png binary +*.gif binary + +*.cs text=auto diff=csharp +*.vb text=auto +*.resx text=auto +*.c text=auto +*.cpp text=auto +*.cxx text=auto +*.h text=auto +*.hxx text=auto +*.py text=auto +*.rb text=auto +*.java text=auto +*.html text=auto +*.htm text=auto +*.css text=auto +*.scss text=auto +*.sass text=auto +*.less text=auto +*.js text=auto +*.lisp text=auto +*.clj text=auto +*.sql text=auto +*.php text=auto +*.lua text=auto +*.m text=auto +*.asm text=auto +*.erl text=auto +*.fs text=auto +*.fsx text=auto +*.hs text=auto + +*.csproj text=auto +*.vbproj text=auto +*.fsproj text=auto +*.dbproj text=auto +*.sln text=auto eol=crlf diff --git a/build-template/.gitignore b/build-template/.gitignore new file mode 100644 index 0000000000..2554a1fc23 --- /dev/null +++ b/build-template/.gitignore @@ -0,0 +1,22 @@ +[Oo]bj/ +[Bb]in/ +TestResults/ +.nuget/ +_ReSharper.*/ +packages/ +artifacts/ +PublishProfiles/ +*.user +*.suo +*.cache +*.docstates +_ReSharper.* +nuget.exe +*net45.csproj +*k10.csproj +*.psess +*.vsp +*.pidb +*.userprefs +*DS_Store +*.ncrunchsolution diff --git a/build-template/NuGet.Config b/build-template/NuGet.Config new file mode 100644 index 0000000000..ab583b0ff7 --- /dev/null +++ b/build-template/NuGet.Config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/build-template/build.cmd b/build-template/build.cmd new file mode 100644 index 0000000000..d54931bc8f --- /dev/null +++ b/build-template/build.cmd @@ -0,0 +1,15 @@ +@echo off +cd %~dp0 + +IF EXIST .nuget\NuGet.exe goto restore +echo Downloading latest version of NuGet.exe... +md .nuget +@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '.nuget\NuGet.exe'" + +:restore +IF EXIST packages\KoreBuild goto run +.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre +.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion + +:run +packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* diff --git a/build-template/makefile.shade b/build-template/makefile.shade new file mode 100644 index 0000000000..6357ea2841 --- /dev/null +++ b/build-template/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/makefile.shade b/makefile.shade index 3701ddd0da..1cd247ba7b 100644 --- a/makefile.shade +++ b/makefile.shade @@ -57,21 +57,28 @@ default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts", "build")}' #init @{ + var templatePath = Path.Combine(BASE_DIR, "build-template"); + var templateFiles = Files.Include(templatePath + Path.DirectorySeparatorChar + "*.*").Select(Path.GetFileName).ToList(); + foreach(var repo in repos) { - foreach (string file in new[] - { - ".gitattributes", - ".gitignore", - "build.cmd", - "makefile.shade", - "NuGet.Config", - }) + foreach (string fileName in templateFiles) { - if (!File.Exists(repo.Key + @"\" + file)) - { - File.Copy(@"Template\" + file, repo.Key + @"\" + file); - } + var targetFile = Path.Combine(repo.Key, fileName); + var sourceFile = Path.Combine(templatePath, fileName); + + // Don't update the makefile + if(fileName.Equals("makefile.shake", StringComparison.OrdinalIgnoreCase) && File.Exists(targetFile)) + { + continue; + } + + if(!File.Exists(targetFile) || + (File.ReadAllText(sourceFile) != File.ReadAllText(targetFile))) + { + Log.Info("Updating " + fileName + " to " + repo.Key); + File.Copy(sourceFile, targetFile, true); + } } } }