Skip to content

Commit

Permalink
Use mono 5.18 (OmniSharp#1444)
Browse files Browse the repository at this point in the history
Use Mono 5.18/MSBuild 16
  • Loading branch information
Ravi Chande authored Apr 8, 2019
1 parent 6f44524 commit 1c2dcf3
Show file tree
Hide file tree
Showing 42 changed files with 207 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: csharp
sudo: required
dist: trusty
dist: xenial
env:
global:
- secure: m2PtYwYOhaK0uFMZ19ZxApZwWZeAIq1dS//jx/5I3txpIWD+TfycQMAWYxycFJ/GJkeVF29P4Zz1uyS2XKKjPJpp2Pds98FNQyDv3OftpLAVa0drsjfhurVlBmSdrV7GH6ncKfvhd+h7KVK5vbZc+NeR4dH7eNvN/jraS//AMJg=
Expand Down
1 change: 1 addition & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="dotnet-core-redux" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
<add key="OmniSharp" value="https://www.myget.org/F/omnisharp/api/v3/index.json" />
<add key="roslyn-myget" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
</packageSources>
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
vmImage: "macOS-10.13"
dependsOn: GitVersion
variables:
MONO_VERSION: 5.16.0
MONO_VERSION: 5.18.1
steps:
- template: ./.pipelines/init.yml
parameters:
Expand All @@ -41,6 +41,8 @@ jobs:
NuGetVersion: $(NuGetVersion)
pushNuget: false
- script: |
curl -o mono5.18.pkg https://download.mono-project.com/archive/5.18.1/macos-10-universal/MonoFramework-MDK-5.18.1.0.macos10.xamarin.universal.pkg
sudo installer -pkg mono5.18.pkg -target /
sudo cp -rf /Library/Frameworks/Mono.framework/Versions/$MONO_VERSION/ /Library/Frameworks/Mono.framework/Versions/Current/
MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$MONO_VERSION
echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;]$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH"
Expand Down
139 changes: 93 additions & 46 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ Task("CreateMSBuildFolder")
{
DirectoryHelper.ForceCreate(env.Folders.MSBuild);
var msbuild15TargetFolder = CombinePaths(env.Folders.MSBuild, "15.0");
var msbuild15BinTargetFolder = CombinePaths(msbuild15TargetFolder, "Bin");
var msbuildCurrentTargetFolder = CombinePaths(env.Folders.MSBuild, "Current");
var msbuildCurrentBinTargetFolder = CombinePaths(msbuildCurrentTargetFolder, "Bin");
var msbuildLibraries = new []
{
Expand All @@ -273,41 +273,41 @@ Task("CreateMSBuildFolder")
{
Information("Copying MSBuild runtime...");
var msbuildSourceFolder = CombinePaths(env.Folders.Tools, "Microsoft.Build.Runtime", "contentFiles", "any", "net46");
DirectoryHelper.Copy(msbuildSourceFolder, msbuild15BinTargetFolder, copySubDirectories: false);
var msbuildSourceFolder = CombinePaths(env.Folders.Tools, "Microsoft.Build.Runtime", "contentFiles", "any", "net472");
DirectoryHelper.Copy(msbuildSourceFolder, msbuildCurrentBinTargetFolder, copySubDirectories: false);
var msbuild15SourceFolder = CombinePaths(msbuildSourceFolder, "15.0");
DirectoryHelper.Copy(msbuild15SourceFolder, msbuild15TargetFolder);
var msbuild15SourceFolder = CombinePaths(msbuildSourceFolder, "Current");
DirectoryHelper.Copy(msbuild15SourceFolder, msbuildCurrentTargetFolder);
Information("Copying MSBuild libraries...");
foreach (var library in msbuildLibraries)
{
var libraryFileName = library + ".dll";
var librarySourcePath = CombinePaths(env.Folders.Tools, library, "lib", "net46", libraryFileName);
var libraryTargetPath = CombinePaths(msbuild15BinTargetFolder, libraryFileName);
var librarySourcePath = CombinePaths(env.Folders.Tools, library, "lib", "net472", libraryFileName);
var libraryTargetPath = CombinePaths(msbuildCurrentBinTargetFolder, libraryFileName);
FileHelper.Copy(librarySourcePath, libraryTargetPath);
}
sdkResolverTFM = "net46";
sdkResolverTFM = "net472";
}
else
{
Information("Copying Mono MSBuild runtime...");
var msbuildSourceFolder = env.Folders.MonoMSBuildRuntime;
DirectoryHelper.Copy(msbuildSourceFolder, msbuild15BinTargetFolder, copySubDirectories: false);
DirectoryHelper.Copy(msbuildSourceFolder, msbuildCurrentBinTargetFolder, copySubDirectories: false);
var msbuild15SourceFolder = CombinePaths(msbuildSourceFolder, "15.0");
DirectoryHelper.Copy(msbuild15SourceFolder, msbuild15TargetFolder);
DirectoryHelper.Copy(msbuild15SourceFolder, msbuildCurrentTargetFolder);
Information("Copying MSBuild libraries...");
foreach (var library in msbuildLibraries)
{
var libraryFileName = library + ".dll";
var librarySourcePath = CombinePaths(env.Folders.MonoMSBuildLib, libraryFileName);
var libraryTargetPath = CombinePaths(msbuild15BinTargetFolder, libraryFileName);
var libraryTargetPath = CombinePaths(msbuildCurrentBinTargetFolder, libraryFileName);
FileHelper.Copy(librarySourcePath, libraryTargetPath);
}
Expand All @@ -317,7 +317,7 @@ Task("CreateMSBuildFolder")
// Copy MSBuild SDK Resolver and DotNetHostResolver
Information("Copying MSBuild SDK resolver...");
var sdkResolverSourceFolder = CombinePaths(env.Folders.Tools, "Microsoft.DotNet.MSBuildSdkResolver", "lib", sdkResolverTFM);
var sdkResolverTargetFolder = CombinePaths(msbuild15BinTargetFolder, "SdkResolvers", "Microsoft.DotNet.MSBuildSdkResolver");
var sdkResolverTargetFolder = CombinePaths(msbuildCurrentBinTargetFolder, "SdkResolvers", "Microsoft.DotNet.MSBuildSdkResolver");
DirectoryHelper.ForceCreate(sdkResolverTargetFolder);
FileHelper.Copy(
source: CombinePaths(sdkResolverSourceFolder, "Microsoft.DotNet.MSBuildSdkResolver.dll"),
Expand All @@ -339,16 +339,16 @@ Task("CreateMSBuildFolder")
// Copy content of NuGet.Build.Tasks
var nugetBuildTasksFolder = CombinePaths(env.Folders.Tools, "NuGet.Build.Tasks");
var nugetBuildTasksBinariesFolder = CombinePaths(nugetBuildTasksFolder, "lib", "net46");
var nugetBuildTasksBinariesFolder = CombinePaths(nugetBuildTasksFolder, "lib", "net472");
var nugetBuildTasksTargetsFolder = CombinePaths(nugetBuildTasksFolder, "runtimes", "any", "native");
FileHelper.Copy(
source: CombinePaths(nugetBuildTasksBinariesFolder, "NuGet.Build.Tasks.dll"),
destination: CombinePaths(msbuild15BinTargetFolder, "NuGet.Build.Tasks.dll"));
destination: CombinePaths(msbuildCurrentBinTargetFolder, "NuGet.Build.Tasks.dll"));
FileHelper.Copy(
source: CombinePaths(nugetBuildTasksTargetsFolder, "NuGet.targets"),
destination: CombinePaths(msbuild15BinTargetFolder, "NuGet.targets"));
destination: CombinePaths(msbuildCurrentBinTargetFolder, "NuGet.targets"));
// Copy dependencies of NuGet.Build.Tasks
var nugetPackages = new []
Expand All @@ -358,7 +358,7 @@ Task("CreateMSBuildFolder")
"NuGet.Configuration",
"NuGet.Frameworks",
"NuGet.ProjectModel",
"NuGet.Protocol",
"NuGet.Protocol",
"NuGet.Versioning"
};
Expand All @@ -367,14 +367,14 @@ Task("CreateMSBuildFolder")
var binaryName = nugetPackage + ".dll";
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, nugetPackage, "lib", "net46", binaryName),
destination: CombinePaths(msbuild15BinTargetFolder, binaryName));
source: CombinePaths(env.Folders.Tools, nugetPackage, "lib", "net472", binaryName),
destination: CombinePaths(msbuildCurrentBinTargetFolder, binaryName));
}
// Copy content of Microsoft.Net.Compilers
Information("Copying Microsoft.Net.Compilers...");
var compilersSourceFolder = CombinePaths(env.Folders.Tools, "Microsoft.Net.Compilers", "tools");
var compilersTargetFolder = CombinePaths(msbuild15BinTargetFolder, "Roslyn");
var compilersTargetFolder = CombinePaths(msbuildCurrentBinTargetFolder, "Roslyn");
DirectoryHelper.Copy(compilersSourceFolder, compilersTargetFolder);
Expand All @@ -386,6 +386,32 @@ Task("CreateMSBuildFolder")
FileHelper.Delete(CombinePaths(compilersTargetFolder, "vbc.exe"));
FileHelper.Delete(CombinePaths(compilersTargetFolder, "vbc.exe.config"));
FileHelper.Delete(CombinePaths(compilersTargetFolder, "vbc.rsp"));
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.core", "lib", "net45", "SQLitePCLRaw.core.dll"),
destination: CombinePaths(msbuildCurrentBinTargetFolder, "SQLitePCLRaw.core.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.provider.e_sqlite3.net45", "lib", "net45", "SQLitePCLRaw.provider.e_sqlite3.dll"),
destination: CombinePaths(msbuildCurrentBinTargetFolder, "SQLitePCLRaw.provider.e_sqlite3.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_v2.dll"),
destination: CombinePaths(msbuildCurrentBinTargetFolder, "SQLitePCLRaw.batteries_v2.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_green.dll"),
destination: CombinePaths(msbuildCurrentBinTargetFolder, "SQLitePCLRaw.batteries_green.dll"),
overwrite: true);
var msbuild15TargetFolder = CombinePaths(env.Folders.MSBuild, "15.0");
if (!Platform.Current.IsWindows)
{
DirectoryHelper.Copy(msbuildCurrentTargetFolder, msbuild15TargetFolder);
}
});

/// <summary>
Expand Down Expand Up @@ -616,8 +642,7 @@ Task("Test")
foreach (var testProject in buildPlan.TestProjects)
{
PrintBlankLine();
var instanceFolder = CombinePaths(env.Folders.Bin, configuration, testProject, "net461");
var instanceFolder = CombinePaths(env.Folders.Bin, configuration, testProject, "net472");
// Copy xunit executable to test folder to solve path errors
var xunitToolsFolder = CombinePaths(env.Folders.Tools, "xunit.runner.console", "tools", "net452");
Expand All @@ -631,7 +656,7 @@ Task("Test")
if (Platform.Current.IsWindows)
{
Run(xunitInstancePath, arguments, instanceFolder)
.ExceptionOnError($"Test {testProject} failed for net461");
.ExceptionOnError($"Test {testProject} failed for net472");
}
else
{
Expand All @@ -644,7 +669,7 @@ Task("Test")
// By default, the run script launches OmniSharp. To launch our Mono runtime
// with xUnit rather than OmniSharp, we pass '--no-omnisharp'
Run(runScript, $"--no-omnisharp \"{xunitInstancePath}\" {arguments}", instanceFolder)
.ExceptionOnError($"Test {testProject} failed for net461");
.ExceptionOnError($"Test {testProject} failed for net472");
}
}
}
Expand All @@ -658,9 +683,34 @@ void CopyMonoBuild(BuildEnvironment env, string sourceFolder, string outputFolde
{
DirectoryHelper.Copy(sourceFolder, outputFolder, copySubDirectories: false);

var msbuildFolder = CombinePaths(outputFolder, "msbuild");

// Copy MSBuild runtime and libraries
DirectoryHelper.Copy($"{env.Folders.MSBuild}", CombinePaths(outputFolder, "msbuild"));
DirectoryHelper.Copy($"{env.Folders.MSBuild}", msbuildFolder);

var msbuildBinFolder = CombinePaths(msbuildFolder, "bin", "Current");
EnsureDirectoryExists(msbuildBinFolder);

// Copy dependencies of Mono build
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.core", "lib", "net45", "SQLitePCLRaw.core.dll"),
destination: CombinePaths(msbuildBinFolder, "SQLitePCLRaw.core.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.provider.e_sqlite3.net45", "lib", "net45", "SQLitePCLRaw.provider.e_sqlite3.dll"),
destination: CombinePaths(msbuildBinFolder, "SQLitePCLRaw.provider.e_sqlite3.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_v2.dll"),
destination: CombinePaths(msbuildBinFolder, "SQLitePCLRaw.batteries_v2.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_green.dll"),
destination: CombinePaths(msbuildBinFolder, "SQLitePCLRaw.batteries_green.dll"),
overwrite: true);
}

void CopyExtraDependencies(BuildEnvironment env, string outputFolder)
Expand All @@ -675,34 +725,31 @@ string PublishMonoBuild(string project, BuildEnvironment env, BuildPlan plan, st

var outputFolder = CombinePaths(env.Folders.ArtifactsPublish, project, "mono");

var buildFolder = CombinePaths(env.Folders.Bin, configuration, project, "net461");
var buildFolder = CombinePaths(env.Folders.Bin, configuration, project, "net472");

CopyMonoBuild(env, buildFolder, outputFolder);

CopyExtraDependencies(env, outputFolder);

Package(project, "mono", outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage);

// Copy dependencies of Mono build
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.core", "lib", "net45", "SQLitePCLRaw.core.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.core.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.provider.e_sqlite3.net45", "lib", "net45", "SQLitePCLRaw.provider.e_sqlite3.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.provider.e_sqlite3.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_v2.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_v2.dll"),
overwrite: true);

FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_green.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_green.dll"),
overwrite: true);
// Copy dependencies of Mono build
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.core", "lib", "net45", "SQLitePCLRaw.core.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.core.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.provider.e_sqlite3.net45", "lib", "net45", "SQLitePCLRaw.provider.e_sqlite3.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.provider.e_sqlite3.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_v2.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_v2.dll"),
overwrite: true);
FileHelper.Copy(
source: CombinePaths(env.Folders.Tools, "SQLitePCLRaw.bundle_green", "lib", "net45", "SQLitePCLRaw.batteries_green.dll"),
destination: CombinePaths(outputFolder, "SQLitePCLRaw.batteries_green.dll"),
overwrite: true);

return outputFolder;
}
Expand Down
12 changes: 6 additions & 6 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
],
"LegacyDotNetVersion": "1.0.0-preview2-1-003177",
"RequiredMonoVersion": "5.8.0.0",
"DownloadURL": "https://omnisharpdownload.blob.core.windows.net/ext",
"MonoRuntimeMacOS": "mono.macOS-5.12.0.301.zip",
"MonoRuntimeLinux32": "mono.linux-x86-5.12.0.301.zip",
"MonoRuntimeLinux64": "mono.linux-x86_64-5.12.0.301.zip",
"MonoMSBuildRuntime": "Microsoft.Build.Runtime.Mono-5.12.0.301.zip",
"MonoMSBuildLib": "Microsoft.Build.Lib.Mono-5.12.0.301.zip",
"DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext",
"MonoRuntimeMacOS": "mono.macOS-5.18.1.0.zip",
"MonoRuntimeLinux32": "mono.linux-x86-5.18.1.0.zip",
"MonoRuntimeLinux64": "mono.linux-x86_64-5.18.1.0.zip",
"MonoMSBuildRuntime": "Microsoft.Build.Runtime.Mono-5.18.1.0.zip",
"MonoMSBuildLib": "Microsoft.Build.Lib.Mono-5.18.1.0.zip",
"HostProjects": [
"OmniSharp.Stdio.Driver",
"OmniSharp.Http.Driver"
Expand Down
6 changes: 3 additions & 3 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<MSBuildPackageVersion>15.8.166</MSBuildPackageVersion>
<NuGetPackageVersion>4.8.0</NuGetPackageVersion>
<MSBuildPackageVersion>16.0.461</MSBuildPackageVersion>
<NuGetPackageVersion>5.0.0-rtm.5856</NuGetPackageVersion>
<RoslynPackageVersion>3.0.0-beta4-19126-05</RoslynPackageVersion>
<XunitPackageVersion>2.4.0</XunitPackageVersion>
</PropertyGroup>
Expand Down Expand Up @@ -67,7 +67,7 @@
<PackageReference Update="System.ComponentModel.Composition" Version="4.5.0" />
<PackageReference Update="System.Composition" Version="1.0.31" />
<PackageReference Update="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.5.24" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageReference Update="System.ValueTuple" Version="4.4.0" />

<PackageReference Update="System.Reactive" Version="4.1.2" />
Expand Down
6 changes: 6 additions & 0 deletions mono-packaging/copy-mono.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ _copy_runtime_assets() {
local mono_lib_path=""
local mono_etc_path=""
local libMonoPosixHelper_name=""
local libMonoBtlsShared_name=""

if [ "$os" = "$OS_MAC" ]; then
mono_base_path=/Library/Frameworks/Mono.framework/Versions/Current
Expand All @@ -183,14 +184,17 @@ _copy_runtime_assets() {
mono_lib_path=/usr/lib
mono_etc_path=/etc/mono
libMonoPosixHelper_name=libMonoPosixHelper.so
libMonoBtlsShared_name=libmono-btls-shared.so
fi

local mono_libMonoPosixHelper_path=$mono_lib_path/$libMonoPosixHelper_name
local mono_libMonoBtlsShared_path=$mono_lib_path/$libMonoBtlsShared_name
local mono_config_path=$mono_etc_path/config
local mono_machine_config_path=$mono_etc_path/4.5/machine.config

_verify_file "$mono_runtime_path"
_verify_file "$mono_libMonoPosixHelper_path"
_verify_file "$mono_libMonoBtlsShared_path"
_verify_file "$mono_config_path"
_verify_file "$mono_machine_config_path"

Expand All @@ -209,11 +213,13 @@ _copy_runtime_assets() {

target_runtime_path=$target_bin_path/mono
target_libMonoPosixHelper_path=$target_lib_path/$libMonoPosixHelper_name
target_libMonoBtlsShared_path=$target_lib_path/$libMonoBtlsShared_name
target_config_path=$target_etc_path/config
target_machine_config_path=$target_etc_path/mono/4.5/machine.config

cp "$mono_runtime_path" "$target_runtime_path"
cp "$mono_libMonoPosixHelper_path" "$target_libMonoPosixHelper_path"
cp "$mono_libMonoBtlsShared_path" "$target_libMonoBtlsShared_path"
cp "$mono_config_path" "$target_config_path"
cp "$mono_machine_config_path" "$target_machine_config_path"

Expand Down
Loading

0 comments on commit 1c2dcf3

Please sign in to comment.