Skip to content
代码片段 群组 项目
提交 90a149ab 编辑于 作者: David Fowler's avatar David Fowler
浏览文件

Added initial support for mono

上级 8b2dfabc
No related branches found
No related tags found
无相关合并请求
#!/bin/sh
if test `uname` = Darwin; then
cachedir=~/Library/Caches/KBuild
else
if x$XDG_DATA_HOME = x; then
cachedir=$HOME/.local/share
else
cachedir=$XDG_DATA_HOME;
fi
fi
mkdir -p $cachedir
url=https://www.nuget.org/nuget.exe
if test ! -f $cachedir/nuget.exe; then
wget -o $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null
fi
if test ! -e .nuget; then
mkdir .nuget
cp $cachedir/nuget.exe .nuget
fi
if test ! -d packages/KoreBuild; then
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion
fi
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
\ No newline at end of file
...@@ -3,6 +3,7 @@ use namespace="System.IO" ...@@ -3,6 +3,7 @@ use namespace="System.IO"
use import="Files" use import="Files"
use import="BuildEnv" use import="BuildEnv"
use import="FileWatcher" use import="FileWatcher"
use import="Environment"
default BASE_DIR='${Directory.GetCurrentDirectory()}' default BASE_DIR='${Directory.GetCurrentDirectory()}'
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}' default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
...@@ -16,7 +17,7 @@ default Configuration='Release' ...@@ -16,7 +17,7 @@ default Configuration='Release'
#repo-initialize target='initialize' #repo-initialize target='initialize'
k-restore k-restore
k-generate-projects solutionPath='${BASE_DIR}' k-generate-projects solutionPath='${BASE_DIR}' if='!IsMono'
#target-dir-clean target='clean' #target-dir-clean target='clean'
directory delete="${TARGET_DIR}" directory delete="${TARGET_DIR}"
...@@ -33,7 +34,7 @@ default Configuration='Release' ...@@ -33,7 +34,7 @@ default Configuration='Release'
} }
} }
#native-compile target='compile' #native-compile target='compile' if='!IsMono'
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}' var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
var msbuild = '${Path.Combine(programFilesX86, "MSBuild", "12.0", "Bin", "MSBuild.exe")}' var msbuild = '${Path.Combine(programFilesX86, "MSBuild", "12.0", "Bin", "MSBuild.exe")}'
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}' var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
......
...@@ -17,8 +17,10 @@ prefetch='true' ...@@ -17,8 +17,10 @@ prefetch='true'
*/} */}
default prefetch='${true}' default prefetch='${true}'
default mono='${IsMono}'
nuget-install package='ProjectK' outputDir='packages' extra='-pre -nocache' once='ProjectK-NuGet' if='prefetch' nuget-install package='ProjectK' outputDir='packages' extra='-pre -nocache' once='ProjectK-NuGet' if='prefetch && !mono'
nuget-install package='ProjectK.Mono' outputDir='packages' extra='-pre -nocache' once='ProjectK-NuGet' if='mono'
@{ @{
Func<string, long> getVersion = version => { Func<string, long> getVersion = version => {
...@@ -38,12 +40,42 @@ nuget-install package='ProjectK' outputDir='packages' extra='-pre -nocache' once ...@@ -38,12 +40,42 @@ nuget-install package='ProjectK' outputDir='packages' extra='-pre -nocache' once
return Int64.MaxValue; return Int64.MaxValue;
}; };
var projectKPrefix = mono ? "ProjectK.Mono*" : "ProjectK";
string packagesDir = Path.Combine(Directory.GetCurrentDirectory(), "packages"), string packagesDir = Path.Combine(Directory.GetCurrentDirectory(), "packages"),
projectKDir = Directory.EnumerateDirectories(packagesDir, "ProjectK*") projectKDir = Directory.EnumerateDirectories(packagesDir, projectKPrefix)
.OrderByDescending(getVersion) .OrderByDescending(getVersion)
.First(); .First();
} }
default kProgram='${projectKDir}/tools/k.cmd' default kProgram='${projectKDir}/tools/k.cmd'
exec program='${Path.GetFullPath(kProgram)}' commandline='${command}' exec program='${Path.GetFullPath(kProgram)}' commandline='${command}' if='!mono'
default kMonoProgram='${projectKDir}/tools/net45/klr.mono.managed.dll'
default monoPath='${Environment.GetEnvironmentVariable("MONO_PATH")}'
@{
if(string.IsNullOrEmpty(monoPath))
{
monoPath = "mono";
}
var folder = Path.Combine(projectKDir, "tools", "net45");
var kMonoEntryPoint = Path.GetFullPath(kMonoProgram);
if(command.StartsWith("build"))
{
command = kMonoEntryPoint + " --lib " + folder + " Microsoft.Net.Project " + command;
}
else if(command.StartsWith("restore"))
{
command = Path.Combine(projectKDir, "tools", "NuGet.exe") + " " + command;
}
else
{
command = kMonoEntryPoint + " --lib " + folder + " Microsoft.Net.ApplicationHost " + command;
}
}
exec program='${monoPath}' commandline='${command}' if='mono'
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册