Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Commit 92d2937

Browse files
minyakunga
minya
authored andcommitted
Macos (#32)
* at least i made it builds on macos * use msbuld on macOS * fix copying * Fix target rewriting * - Added target for copying distr on Unix - Use mono NuGet ... on Unix
1 parent 09f5048 commit 92d2937

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Cement.Net/CementEntry.csproj

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build; CopyExe" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build; CopyExe; CopyExeUnix;" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<UsingTask TaskName="Kontur.MsBuild.GitCommit2AssemblyTitle" AssemblyFile="..\externals\Kontur.MsBuild.dll" />
44
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
55
<PropertyGroup>
@@ -116,12 +116,20 @@
116116
<Exec Command="$(Merger) /out:&quot;$(OutputAssembly)&quot; @(MergeAssemblies->'&quot;%(FullPath)&quot;', ' ')" />
117117
<Exec Command="$(OutputAssembly) help --gen $(SolutionDir)\README-commands.md" />
118118
</Target>
119-
<Target Name="CopyExe" DependsOnTargets="AfterBuild">
119+
<Target Name="CopyExe" DependsOnTargets="AfterBuild" Condition="'$(OS)' != 'Unix'">
120120
<Exec Command="rmdir /S /Q %25userprofile%25\bin\dotnet" />
121121
<Exec Command="mkdir %25userprofile%25\bin\dotnet" />
122122
<Exec Command="copy $(OutputAssembly) %25userprofile%25\bin\dotnet\cm.exe" />
123123
<Exec Command="copy $(OutputAssembly).config %25userprofile%25\bin\dotnet\cm.exe.config" />
124124
<Exec Command="xcopy $(SolutionDir)\files-common %25userprofile%25\bin\dotnet /s /i /Y" />
125125
<Exec Condition="Exists('$(SolutionDir)\files-kontur')" Command="xcopy $(SolutionDir)\files-kontur %25userprofile%25\bin\dotnet /s /i /Y" />
126126
</Target>
127-
</Project>
127+
<Target Name="CopyExeUnix" DependsOnTargets="AfterBuild" Condition="'$(OS)' == 'Unix'">
128+
<Exec Command="rm -rf ~/bin/dotnet" />
129+
<Exec Command="mkdir ~/bin/dotnet" />
130+
<Exec Command="cp $(OutputAssembly) ~/bin/dotnet/cm.exe" />
131+
<Exec Command="cp $(OutputAssembly).config ~/bin/dotnet/cm.exe.config" />
132+
<Exec Command="cp -R $(SolutionDir)/files-common/* ~/bin/dotnet" />
133+
<Exec Condition="Exists('$(SolutionDir)/files-kontur')" Command="cp -R $(SolutionDir)/files-kontur/* ~/bin/dotnet" />
134+
</Target>
135+
</Project>

Common/BuildYamlScriptsMaker.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static string FindTool(Tool buildTool, string moduleName)
5353
if (buildTool.Name != "msbuild")
5454
return buildTool.Name;
5555
if (Helper.OsIsUnix())
56-
return "xbuild";
56+
return "msbuild";
5757

5858
return ModuleBuilderHelper.FindMsBuild(buildTool.Version, moduleName);
5959
}
@@ -80,4 +80,4 @@ private static List<string> GetDefaultMsbuildParameters(string toolVersion)
8080
return parameters;
8181
}
8282
}
83-
}
83+
}

Common/ModuleBuilder.cs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ private void RunNugetRestore(string buildFile, string nuGetPath)
4343
var buildFolder = Directory.GetParent(buildFile).FullName;
4444
var target = buildFile.EndsWith(".sln") ? Path.GetFileName(buildFile) : "";
4545
var command = $"\"{nuGetPath}\" restore {target} -Verbosity {(buildSettings.ShowOutput ? "normal" : "quiet")}";
46+
if (Helper.OsIsUnix())
47+
command = $"mono {command}";
4648
log.Info(command);
4749

4850
var runner = PrepareShellRunner();

0 commit comments

Comments
 (0)