Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
Fix entropy samples and update to run with dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo committed Feb 17, 2016
1 parent 791ea33 commit 4b56220
Show file tree
Hide file tree
Showing 60 changed files with 338 additions and 260 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@
*.fsproj text=auto
*.dbproj text=auto
*.sln text=auto eol=crlf

*.sh eol=lf
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ bower_components/
node_modules/
*/*.Spa/public/*
*/*.Spa/wwwroot/lib
*launchSettings.json
*launchSettings.json
.testPublish/
.build/
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ addons:
- libssl-dev
- libunwind8
- zlib1g
env:
- KOREBUILD_DNU_RESTORE_CORECLR=true KOREBUILD_TEST_DNXCORE=true MONO_MANAGED_WATCHER=disabled
mono:
- 4.0.5
os:
- linux
- osx
osx_image: xcode7.1
install:
- curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/libuv-1.4.2/
- sh autogen.sh
Expand All @@ -23,8 +24,5 @@ install:
- make install
- export LD_LIBRARY_PATH="$HOME/libuvinstall/lib"
- cd $OLDPWD
mono:
- 4.0.5
script:
- ./build.sh --quiet verify
osx_image: xcode7.2
66 changes: 32 additions & 34 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,42 +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

IF NOT EXIST %BUILD_FOLDER% (
md %BUILD_FOLDER%
)
.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 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 "%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 CoreCLR -arch x64
CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x64
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 %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%
)

packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*
40 changes: 21 additions & 19 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

buildFolder=.build
koreBuildFolder=$buildFolder/KoreBuild-dotnet

nugetPath=$buildFolder/nuget.exe

if test `uname` = Darwin; then
cachedir=~/Library/Caches/KBuild
else
Expand All @@ -11,33 +16,30 @@ 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
fi
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

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
cp $cacheNuget $nugetPath
fi

if ! type dnvm > /dev/null 2>&1; then
source packages/KoreBuild/build/dnvm.sh
if test ! -d $koreBuildFolder; then
mono $nugetPath install KoreBuild-dotnet -ExcludeVersion -o $buildFolder -nocache -pre
chmod +x $koreBuildFolder/build/KoreBuild.sh
fi

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
makeFile=makefile.shade
if [ ! -e $makeFile ]; then
makeFile=$koreBuildFolder/build/makefile.shade
fi

mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
./$koreBuildFolder/build/KoreBuild.sh -n $nugetPath -m $makeFile "$@"
7 changes: 0 additions & 7 deletions makefile.shade

This file was deleted.

6 changes: 5 additions & 1 deletion samples/Builder.Filtering.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
6 changes: 5 additions & 1 deletion samples/Builder.HelloWorld.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
6 changes: 5 additions & 1 deletion samples/Builder.Middleware.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
6 changes: 5 additions & 1 deletion samples/Config.ChangeNotification.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
},
"frameworks": {
"dnx451": { },
"dnxcore50" : { }
"dnxcore50" : {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
}
}
6 changes: 3 additions & 3 deletions samples/Config.CustomProviders.Web/MyConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string
{
// TODO: This method signature is pretty bad

if (prefix == "" && delimiter == ":")
if (string.IsNullOrEmpty(prefix) && delimiter == ":")
{
return earlierKeys.Concat(new[] { "Hardcoded" });
}
if (prefix == "Hardcoded:" && delimiter == ":")
if (prefix == "Hardcoded" && delimiter == ":")
{
return earlierKeys.Concat(new[] { "1", "2" });
}
if (prefix == "Hardcoded:1:" || prefix == "Hardcoded:2:")
if (prefix == "Hardcoded:1" || prefix == "Hardcoded:2")
{
return earlierKeys.Concat(new[] { "Caption" });
}
Expand Down
6 changes: 5 additions & 1 deletion samples/Config.CustomProviders.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"commands": {
"web": "Config.CustomProviders.Web"
Expand Down
11 changes: 9 additions & 2 deletions samples/Config.Providers.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"commands": {
"web": "Config.Providers.Web"
}
},
"content": [
"Config.Providers.ini"
]
}
6 changes: 5 additions & 1 deletion samples/Config.SettingObject.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
11 changes: 9 additions & 2 deletions samples/Config.WalkingValues.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "Config.WalkingValues.Web"
}
},
"content": [
"Config.Sources.ini"
]
}
6 changes: 5 additions & 1 deletion samples/Container.Fallback.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
6 changes: 5 additions & 1 deletion samples/Content.Upload.Files/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
6 changes: 5 additions & 1 deletion samples/Content.Upload.Form/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*"
}
}
},
"compilationOptions": {
"emitEntryPoint": true
Expand Down
1 change: 1 addition & 0 deletions samples/Content.Upload.Multipart/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*",
"System.Net.Http": "4.0.1-*"
}
}
Expand Down
7 changes: 6 additions & 1 deletion samples/Data.InMemory/project.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.InMemory": "1.0.0-*",
"Microsoft.NETCore.Platforms": "1.0.1-*"
Expand All @@ -7,8 +10,10 @@
"dnx451": {},
"dnxcore50": {
"dependencies": {
"NETStandard.Library": "1.0.0-*",
"System.Console": "4.0.0-*"
}
},
"imports": "portable-net451+win8"
}
}
}
Loading

0 comments on commit 4b56220

Please sign in to comment.