diff --git a/.gitattributes b/.gitattributes index bdaa5ba982..c2f0f84273 100644 --- a/.gitattributes +++ b/.gitattributes @@ -48,3 +48,5 @@ *.fsproj text=auto *.dbproj text=auto *.sln text=auto eol=crlf + +*.sh eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0d01a992a1..0fb89cd896 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ nuget.exe *.ipch *.sln.ide project.lock.json -.vs \ No newline at end of file +.vs +.build/ +.testPublish/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2fc624899f..bf811dc26a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,11 @@ addons: - libssl-dev - libunwind8 - zlib1g -env: - - KOREBUILD_DNU_RESTORE_CORECLR=true mono: - 4.0.5 +os: + - linux + - osx +osx_image: xcode7.1 script: - - ./build.sh --quiet verify + - ./build.sh verify \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 636a7618d3..3fab83e134 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ init: - git config --global core.autocrlf true build_script: - - build.cmd --quiet verify + - build.cmd verify clone_depth: 1 test: off deploy: off \ No newline at end of file diff --git a/build.cmd b/build.cmd index 553e3929a0..ebb619e737 100644 --- a/build.cmd +++ b/build.cmd @@ -1,40 +1,40 @@ -@echo off -cd %~dp0 - +@ECHO off SETLOCAL + +SET REPO_FOLDER=%~dp0 +CD %REPO_FOLDER% + +SET BUILD_FOLDER=.build +SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet +SET KOREBUILD_VERSION= + +SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe SET NUGET_VERSION=latest SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe -SET BUILDCMD_KOREBUILD_VERSION= -SET BUILDCMD_DNX_VERSION= -IF EXIST %CACHED_NUGET% goto copynuget -echo Downloading latest version of NuGet.exe... -IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" - -:copynuget -IF EXIST .nuget\nuget.exe goto restore -md .nuget -copy %CACHED_NUGET% .nuget\nuget.exe > nul - -:restore -IF EXIST packages\Sake goto getdnx -IF "%BUILDCMD_KOREBUILD_VERSION%"=="" ( - .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre -) ELSE ( - .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre -) -.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages - -:getdnx -IF "%BUILDCMD_DNX_VERSION%"=="" ( - SET BUILDCMD_DNX_VERSION=latest -) -IF "%SKIP_DNX_INSTALL%"=="" ( - CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CoreCLR -arch x86 -alias default - CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x86 -alias default -) ELSE ( - CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 +IF NOT EXIST %BUILD_FOLDER% ( + md %BUILD_FOLDER% ) -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* +IF NOT EXIST %NUGET_PATH% ( + IF NOT EXIST %CACHED_NUGET% ( + echo Downloading latest version of NuGet.exe... + IF NOT EXIST %LocalAppData%\NuGet ( + md %LocalAppData%\NuGet + ) + @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" + ) + + copy %CACHED_NUGET% %NUGET_PATH% > nul +) + +IF NOT EXIST %KOREBUILD_FOLDER% ( + SET KOREBUILD_DOWNLOAD_ARGS= + IF NOT "%KOREBUILD_VERSION%"=="" ( + SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION% + ) + + %BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS% +) + +"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %* diff --git a/build.sh b/build.sh index da4e3fcd1c..7b5e25e3a8 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +repoFolder="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +buildFolder=.build +koreBuildFolder=$buildFolder/KoreBuild-dotnet + +nugetPath=$buildFolder/nuget.exe + if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild else @@ -11,33 +24,25 @@ else fi mkdir -p $cachedir nugetVersion=latest -cachePath=$cachedir/nuget.$nugetVersion.exe +cacheNuget=$cachedir/nuget.$nugetVersion.exe -url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe +nugetUrl=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe -if test ! -f $cachePath; then - wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null +if test ! -d $buildFolder; then + mkdir $buildFolder fi -if test ! -e .nuget; then - mkdir .nuget - cp $cachePath .nuget/nuget.exe +if test ! -f $nugetPath; then + if test ! -f $cacheNuget; then + wget -O $cacheNuget $nugetUrl 2>/dev/null || curl -o $cacheNuget --location $nugetUrl /dev/null + fi + + cp $cacheNuget $nugetPath fi -if test ! -d packages/Sake; then - mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages +if test ! -d $koreBuildFolder; then + mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre fi -if ! type dnvm > /dev/null 2>&1; then - source packages/KoreBuild/build/dnvm.sh -fi +source $koreBuildFolder/build/KoreBuild.sh -if ! type dnx > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then - dnvm install latest -runtime coreclr -alias default - dnvm install default -runtime mono -alias default -else - dnvm use default -runtime mono -fi - -mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" diff --git a/makefile.shade b/makefile.shade index 2364f26b21..46e9653763 100644 --- a/makefile.shade +++ b/makefile.shade @@ -1,5 +1,3 @@ -use assembly='WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' -use namespace='System.IO.Packaging' use import="Environment" var VERSION='0.1' @@ -9,78 +7,20 @@ var AUTHORS='Microsoft Open Technologies, Inc.' use-standard-lifecycle k-standard-goals -var Configuration2='${E("Configuration")}' -var ROOT = '${Directory.GetCurrentDirectory()}' -var BUILD_DIR2 = '${Path.Combine(ROOT, "build")}' +var Configuration_Local = '${E("Configuration")}' +var ROOT_Local = '${Directory.GetCurrentDirectory()}' +var BUILD_DIR_Local = '${Path.Combine(ROOT_Local, "build")}' -#build-compile target='compile' if='!IsWindows && !IsBuildV2 && Directory.Exists("src")' - @{ - var projectFiles = Files.Include("src/**/project.json") - .Exclude("src/Microsoft.AspNet.DataProtection.SystemWeb/project.json") - .ToList(); - - if (ShouldRunInParallel) - { - Parallel.ForEach(projectFiles, projectFile => DnuPack(projectFile, BUILD_DIR2, Configuration2)); - } - else - { - projectFiles.ForEach(projectFile => DnuPack(projectFile, BUILD_DIR2, Configuration2)); - } - - foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR2, "*/*.nupkg"))) - { - File.Copy(nupkg, Path.Combine(BUILD_DIR2, Path.GetFileName(nupkg)), true); - } +#build-compile target='compile' if='IsLinux' + @{ + var projectFiles = Files.Include("src/**/project.json") + .Exclude("src/Microsoft.AspNet.DataProtection.SystemWeb/project.json") + .ToList(); + + projectFiles.ForEach(projectFile => DotnetPack(projectFile, BUILD_DIR_Local, Configuration_Local)); + + foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR_Local, "*/*.nupkg"))) + { + File.Copy(nupkg, Path.Combine(BUILD_DIR_Local, Path.GetFileName(nupkg)), true); } - -#build-compile target='compile' if='!IsWindows && IsBuildV2' - @{ - if (Directory.Exists("src")) - { - var projects = Files.Include("src/*") - .Exclude("src/Microsoft.AspNet.DataProtection.SystemWeb") - .ToList(); - - DnuPack(string.Join(";", projects), BUILD_DIR2, Configuration2); - - foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR2, "*/*.nupkg"))) - { - File.Copy(nupkg, Path.Combine(BUILD_DIR2, Path.GetFileName(nupkg)), true); - } - } - - if (Directory.Exists("test")) - { - DnuBuild("test/*", Configuration2); - } - } - -functions - @{ - PackagePart CreatePartFromFile( - Package destination, - string sourceFileName, - string partUriString) - { - var partUri = PackUriHelper.CreatePartUri(new Uri(partUriString, UriKind.Relative)); - var packagePart = destination.CreatePart(partUri, "application/octet", CompressionOption.Maximum); - - using (var sourceStream = File.OpenRead(sourceFileName)) - using (var stream = packagePart.GetStream()) - { - sourceStream.CopyTo(stream); - } - - return packagePart; - } - - bool IsWindows - { - get - { - var p = (int)Environment.OSVersion.Platform; - return (p != 4) && (p != 6) && (p != 128); - } - } - } \ No newline at end of file + } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Cryptography.Internal.Test/project.json b/test/Microsoft.AspNet.Cryptography.Internal.Test/project.json index 741892fb6b..96f149e31c 100644 --- a/test/Microsoft.AspNet.Cryptography.Internal.Test/project.json +++ b/test/Microsoft.AspNet.Cryptography.Internal.Test/project.json @@ -6,12 +6,21 @@ "version": "" }, "Microsoft.AspNet.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "frameworks": { - "dnx451": { }, - "dnxcore50": { } + "dnx451": { + "dependencies": { + "xunit.runner.console": "2.1.0" + } + }, + "dnxcore50": { + "dependencies": { + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + } }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, diff --git a/test/Microsoft.AspNet.Cryptography.KeyDerivation.Test/project.json b/test/Microsoft.AspNet.Cryptography.KeyDerivation.Test/project.json index 09cf034660..61c2870baf 100644 --- a/test/Microsoft.AspNet.Cryptography.KeyDerivation.Test/project.json +++ b/test/Microsoft.AspNet.Cryptography.KeyDerivation.Test/project.json @@ -4,12 +4,21 @@ "Microsoft.AspNet.Cryptography.KeyDerivation": "1.0.0-*", "Microsoft.AspNet.DataProtection.Test.Shared": "", "Microsoft.AspNet.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "frameworks": { - "dnx451": { }, - "dnxcore50": { } + "dnx451": { + "dependencies": { + "xunit.runner.console": "2.1.0" + } + }, + "dnxcore50": { + "dependencies": { + "xunit.runner.aspnet": "2.0.0-aspnet-*" + } + } }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, diff --git a/test/Microsoft.AspNet.DataProtection.Abstractions.Test/project.json b/test/Microsoft.AspNet.DataProtection.Abstractions.Test/project.json index 8ceb6a391c..793a08beeb 100644 --- a/test/Microsoft.AspNet.DataProtection.Abstractions.Test/project.json +++ b/test/Microsoft.AspNet.DataProtection.Abstractions.Test/project.json @@ -3,20 +3,23 @@ "Microsoft.AspNet.Cryptography.Internal": "1.0.0-*", "Microsoft.AspNet.DataProtection.Abstractions": "1.0.0-*", "Microsoft.AspNet.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "frameworks": { "dnx451": { "dependencies": { - "Moq": "4.2.1312.1622" + "Moq": "4.2.1312.1622", + "xunit.runner.console": "2.1.0" } }, "dnxcore50": { "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, diff --git a/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json b/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json index 2f098cd064..d0159eb435 100644 --- a/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json +++ b/test/Microsoft.AspNet.DataProtection.Extensions.Test/project.json @@ -7,20 +7,23 @@ "version": "" }, "Microsoft.AspNet.Testing": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "frameworks": { "dnx451": { "dependencies": { - "Moq": "4.2.1312.1622" + "Moq": "4.2.1312.1622", + "xunit.runner.console": "2.1.0" } }, "dnxcore50": { "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" }, diff --git a/test/Microsoft.AspNet.DataProtection.Test/project.json b/test/Microsoft.AspNet.DataProtection.Test/project.json index 7970ff1eca..4d06843dbb 100644 --- a/test/Microsoft.AspNet.DataProtection.Test/project.json +++ b/test/Microsoft.AspNet.DataProtection.Test/project.json @@ -7,20 +7,23 @@ }, "Microsoft.AspNet.Testing": "1.0.0-*", "Microsoft.Extensions.DependencyInjection": "1.0.0-*", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "frameworks": { "dnx451": { "dependencies": { - "Moq": "4.2.1312.1622" + "Moq": "4.2.1312.1622", + "xunit.runner.console": "2.1.0" } }, "dnxcore50": { "dependencies": { - "moq.netcore": "4.4.0-beta8" + "moq.netcore": "4.4.0-beta8", + "xunit.runner.aspnet": "2.0.0-aspnet-*" } } }, + "testRunner": "xunit", "commands": { "test": "xunit.runner.aspnet" },