Skip to content

Commit

Permalink
Switch build to use dotnet and reference assemblies (IronLanguages#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier authored May 8, 2019
1 parent ca38ce8 commit 077d8dc
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 35 deletions.
6 changes: 0 additions & 6 deletions Build/net45.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WpfReferences Condition="'$(WpfReferences)' == ''">$(SolutionDir)..\Util\References\WPF\4.0</WpfReferences>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<IsFullFramework>true</IsFullFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Unix' ">
<FrameworkPathOverride>/usr/lib/mono/4.5-api</FrameworkPathOverride>
<FrameworkPathOverride Condition="$([MSBuild]::IsOsPlatform('OSX'))">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api</FrameworkPathOverride>
</PropertyGroup>

<PropertyGroup>
<Features>$(Features);FEATURE_APARTMENTSTATE</Features>
Expand Down
2 changes: 1 addition & 1 deletion Build/netcoreapp3.0.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
<Features>$(Features);FEATURE_BASIC_CONSOLE</Features>
<Features>$(Features);FEATURE_CODEDOM</Features>
<Features>$(Features);FEATURE_COM</Features>
<Features>$(Features);FEATURE_CONFIGURATION</Features>
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
<Features>$(Features);FEATURE_DBNULL</Features>
Expand Down Expand Up @@ -47,6 +48,5 @@
<Features>$(Features);FEATURE_WARNING_EXCEPTION</Features>
<Features>$(Features);FEATURE_WIN32EXCEPTION</Features>
<Features>$(Features);FEATURE_XMLDOC</Features>
<Features>$(Features);FEATURE_COM</Features>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Dlr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Build.proj = Build.proj
Directory.Build.props = Directory.Build.props
DLR.ruleset = DLR.ruleset
global.json = global.json
LICENSE = LICENSE
make.ps1 = make.ps1
NuGet.config = NuGet.config
Expand Down
16 changes: 11 additions & 5 deletions Src/Microsoft.Dynamic/ComInterop/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,7 @@ public Object AsDispatch {
Debug.Assert(IsEmpty); // The setter can only be called once as VariantClear might be needed otherwise
VariantType = VarEnum.VT_DISPATCH;
if (value != null) {
#if !NETCOREAPP
_typeUnion._unionTypes._unknown = Marshal.GetIDispatchForObject(value);
#else
_typeUnion._unionTypes._unknown = Marshal.GetComInterfaceForObject<object, IDispatch>(value);
#endif
_typeUnion._unionTypes._unknown = GetIDispatchForObject(value);
}
}
}
Expand All @@ -701,6 +697,16 @@ public void SetAsByrefDispatch(ref IntPtr value) {

#endregion

/// <summary>
/// Helper method for generated code
/// </summary>
private static IntPtr GetIDispatchForObject(object value) {
#if !NETCOREAPP
return Marshal.GetIDispatchForObject(value);
#else
return Marshal.GetComInterfaceForObject<object, IDispatch>(value);
#endif
}

// VT_VARIANT

Expand Down
6 changes: 5 additions & 1 deletion Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" Condition="'$(MSBuildRuntimeType)' == 'Full'" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" Condition="'$(MSBuildRuntimeType)' == 'Full'" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
7 changes: 5 additions & 2 deletions Src/Microsoft.Scripting/Microsoft.Scripting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
<PackageReference Include="System.CodeDom" Version="4.5.0" />
</ItemGroup>


<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Reflection.Emit" Version="4.6.0-preview3.19128.7" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" Condition="'$(MSBuildRuntimeType)' == 'Full'" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
52 changes: 45 additions & 7 deletions Tests/ClrAssembly/ClrAssembly.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<RootNamespace>merlintest</RootNamespace>
<AssemblyName>merlintest.dummy</AssemblyName>
</PropertyGroup>
Expand All @@ -14,25 +14,56 @@
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>

<Target Name="GetFrameworkPath">
<GetFrameworkPath>
<Output TaskParameter="Path" PropertyName="DotNetFrameworkPath" />
</GetFrameworkPath>
<!-- Load ilasm from NuGet - TODO: use an ilproj when it becomes supported? -->
<PropertyGroup>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('windows'))">win</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('linux'))">linux</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx</_OSPlatform>
<_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</_OSArchitecture>

<MicrosoftNetCoreIlasmPackageRuntimeId>$(_OSPlatform)-$(_OSArchitecture.ToLower())</MicrosoftNetCoreIlasmPackageRuntimeId>
<MicrosoftNetCoreIlasmPackageVersion>2.0.8</MicrosoftNetCoreIlasmPackageVersion>
<MicrosoftNetCoreIlasmPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ilasm</MicrosoftNetCoreIlasmPackageName>
<MicrosoftNetCoreRuntimeCoreClrPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.runtime.coreclr</MicrosoftNetCoreRuntimeCoreClrPackageName>
<MicrosoftNetCoreJitPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.jit</MicrosoftNetCoreJitPackageName>

<ToolsDir Condition="'$(ToolsDir)' == ''">$([System.IO.Path]::Combine($([System.IO.Path]::GetTempPath()), $([System.IO.Path]::GetRandomFileName())))</ToolsDir>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="$(MicrosoftNetCoreIlasmPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="$(MicrosoftNetCoreRuntimeCoreClrPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="$(MicrosoftNetCoreJitPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>

<Target Name="LoadIlasm">
<ItemGroup>
<_IlasmSourceFiles Include="$(NuGetPackageRoot)\$(MicrosoftNetCoreIlasmPackageName)\$(MicrosoftNetCoreIlasmPackageVersion)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native\**\*" />
<_IlasmSourceFiles Include="$(NuGetPackageRoot)\$(MicrosoftNetCoreRuntimeCoreClrPackageName)\$(MicrosoftNetCoreIlasmPackageVersion)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native\**\*" />
<_IlasmSourceFiles Include="$(NuGetPackageRoot)\$(MicrosoftNetCoreJitPackageName)\$(MicrosoftNetCoreIlasmPackageVersion)\runtimes\$(MicrosoftNetCoreIlasmPackageRuntimeId)\native\**\*" />
</ItemGroup>

<PropertyGroup>
<_IlasmDir>$(ToolsDir)\ilasm</_IlasmDir>
</PropertyGroup>

<MakeDir Directories="$(_IlasmDir)" />
<Copy DestinationFolder="$(_IlasmDir)" SourceFiles="@(_IlasmSourceFiles)" />
</Target>

<Target Name="LoadOrder" Inputs="@(LoadOrderCSFile)" Outputs="$(OutputPath)\$(Prefix)%(Filename).dll">
<Csc TargetType="Library" References="@(ReferencePath)" Sources="%(LoadOrderCSFile.Identity)" OutputAssembly="$(OutputPath)\$(Prefix)%(LoadOrderCSFile.Filename).dll" />
</Target>

<Target Name="ReachType" Inputs="@(ReachTypeInput)" Outputs="@(ReachTypeOutput)" DependsOnTargets="GetFrameworkPath" Condition="'$(MSBuildRuntimeType)' != 'Core'">
<Target Name="ReachType" Inputs="@(ReachTypeInput)" Outputs="@(ReachTypeOutput)" DependsOnTargets="LoadIlasm">
<Csc TargetType="Library" References="@(ReferencePath)" Sources="Src\loadtypesample.cs" OutputAssembly="$(OutputPath)\$(Prefix)loadtypesample.dll" />
<Csc TargetType="Library" References="@(ReferencePath)" Sources="Src\missingtype.cs" OutputAssembly="$(OutputPath)\$(Prefix)missingtype.dll" />
<Csc TargetType="Library" References="@(ReferencePath);$(OutputPath)\$(Prefix)missingtype.dll" Sources="Src\loadexception.cs" OutputAssembly="$(OutputPath)\$(Prefix)loadexception.dll" />
<Delete Files="$(OutputPath)\$(Prefix)missingtype.dll" />
<Csc TargetType="Library" References="@(ReferencePath)" Sources="Src\typeforwardee1.cs" OutputAssembly="$(OutputPath)\$(Prefix)typeforwardee1.dll" />
<Csc TargetType="Library" References="@(ReferencePath);$(OutputPath)\$(Prefix)typeforwardee1.dll" Sources="Src\typeforwarder1.cs" OutputAssembly="$(OutputPath)\$(Prefix)typeforwarder1.dll" />
<Csc TargetType="Library" References="@(ReferencePath)" Sources="Src\typeforwardee2.cs" OutputAssembly="$(OutputPath)\$(Prefix)typeforwardee2.dll" />
<Exec Command="&quot;$(DotNetFrameworkPath)\ilasm.exe&quot; /NOLOGO /QUIET /DLL /out=&quot;$(OutputPath)\$(Prefix)typeforwarder2.dll&quot; Src\typeforwarder2.il" />
<Exec Command="&quot;$(_IlasmDir)/ilasm&quot; -NOLOGO -QUIET -DLL -OUTPUT=&quot;$(OutputPath)/$(Prefix)typeforwarder2.dll&quot; Src/typeforwarder2.il" />
<Csc TargetType="Library" References="@(ReferencePath)" Sources="Src\typeforwardee3.cs" OutputAssembly="$(OutputPath)\$(Prefix)typeforwardee3.dll" />
<Csc TargetType="Library" References="@(ReferencePath);$(OutputPath)\$(Prefix)typeforwardee3.dll" Sources="Src\typeforwarder3.cs" OutputAssembly="$(OutputPath)\$(Prefix)typeforwarder3.dll" />
</Target>
Expand Down Expand Up @@ -102,4 +133,11 @@
<ProjectReference Include="..\..\Src\Microsoft.Dynamic\Microsoft.Dynamic.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
10 changes: 9 additions & 1 deletion Tests/Metadata/Metadata.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);CCI</DefineConstants>
Expand All @@ -12,10 +12,18 @@
<ProjectReference Include="..\..\Src\Microsoft.Dynamic\Microsoft.Dynamic.csproj" />
<ProjectReference Include="..\..\Src\Microsoft.Scripting.Metadata\Microsoft.Scripting.Metadata.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnitLite" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
9 changes: 8 additions & 1 deletion Tests/Microsoft.Dynamic.Test/Microsoft.Dynamic.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,4 +14,11 @@
<ProjectReference Include="..\..\Src\Microsoft.Dynamic\Microsoft.Dynamic.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tests/Microsoft.Dynamic.Test/TestReflectionServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void TestExtensionMethods1() {
"DefaultIfEmpty", "ElementAt", "ElementAtOrDefault"
}).ToList();

#if !NETCOREAPP2_0 && !NETCOREAPP2_1 && !NETSTANDARD2_0
#if !NETCOREAPP && !NETSTANDARD
names.AddRange(
new string[] {
"AsQueryable", "AsQueryable", "AsParallel", "AsParallel", "AsParallel", "AsOrdered",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,4 +14,11 @@
<ProjectReference Include="..\..\Src\Microsoft.Scripting\Microsoft.Scripting.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.0.100-preview4-011223"
"version": "3.0.100-preview"
}
}
9 changes: 2 additions & 7 deletions make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Param(
[Parameter(Position=1)]
[String] $target = "release",
[String] $configuration = "Release",
[String[]] $frameworks=@('net45','netcoreapp2.0','netcoreapp2.1'),
[String[]] $frameworks=@('net45','netcoreapp2.0','netcoreapp2.1','netcoreapp3.0'),
[String] $platform = "x64",
[switch] $runIgnored
)
Expand Down Expand Up @@ -58,12 +58,7 @@ $_defaultFrameworkSettings = @{
$_FRAMEWORKS = @{}

function Main([String] $target, [String] $configuration) {
if (!$global:isUnix) {
msbuild Build.proj /m /t:$target /p:Configuration=$configuration /verbosity:minimal /nologo /p:Platform="Any CPU" /bl:build-$target-$configuration.binlog
}
else {
dotnet msbuild Build.proj /m /t:$target /p:Configuration=$configuration /verbosity:minimal /nologo /p:Platform="Any CPU" /bl:build-$target-$configuration.binlog
}
dotnet msbuild Build.proj /m /t:$target /p:Configuration=$configuration /verbosity:minimal /nologo /p:Platform="Any CPU" /bl:build-$target-$configuration.binlog
# use the exit code of msbuild as the exit code for this script
$global:Result = $LastExitCode
}
Expand Down

0 comments on commit 077d8dc

Please sign in to comment.