Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Compat tool in ML.NET #3623

Merged
merged 7 commits into from
May 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,14 @@
<PropertyGroup>
<CustomAfterMicrosoftCommonTargets>$(RepoRoot)build\AfterCommonTargets.targets</CustomAfterMicrosoftCommonTargets>
</PropertyGroup>

<!-- API Compat -->
artidoro marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<!-- only validate that the current implementation is compatible
with the old one, not vice-versa (since latest may have new
API missing from old) -->
<RunApiCompatForSrc>true</RunApiCompatForSrc>
<RunMatchingRefApiCompat>false</RunMatchingRefApiCompat>
<MicrosoftDotNetApiCompatPackageVersion>1.0.0-beta.19225.5</MicrosoftDotNetApiCompatPackageVersion>
artidoro marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
</Project>
15 changes: 15 additions & 0 deletions Microsoft.ML.sln
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.ML.FastTree", "Mi
pkg\Microsoft.ML.FastTree\Microsoft.ML.FastTree.symbols.nupkgproj = pkg\Microsoft.ML.FastTree\Microsoft.ML.FastTree.symbols.nupkgproj
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.StableApi", "tools-local\Microsoft.ML.StableApi\Microsoft.ML.StableApi.csproj", "{C1884169-7330-42DF-B401-9427C6EFB092}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -968,6 +970,18 @@ Global
{E02DA82D-3FEE-4C60-BD80-9EC3C3448DFC}.Release-Intrinsics|Any CPU.Build.0 = Release-Intrinsics|Any CPU
{E02DA82D-3FEE-4C60-BD80-9EC3C3448DFC}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU
{E02DA82D-3FEE-4C60-BD80-9EC3C3448DFC}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug-Intrinsics|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug-Intrinsics|Any CPU.Build.0 = Debug-Intrinsics|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release|Any CPU.Build.0 = Release|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release-Intrinsics|Any CPU.ActiveCfg = Release-Intrinsics|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release-Intrinsics|Any CPU.Build.0 = Release-Intrinsics|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU
{C1884169-7330-42DF-B401-9427C6EFB092}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1055,6 +1069,7 @@ Global
{AD7058C9-5608-49A8-BE23-58C33A74EE91} = {D3D38B03-B557-484D-8348-8BADEE4DF592}
{E02DA82D-3FEE-4C60-BD80-9EC3C3448DFC} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{B1B3F284-FA3D-4D76-A712-FF04495D244B} = {D3D38B03-B557-484D-8348-8BADEE4DF592}
{C1884169-7330-42DF-B401-9427C6EFB092} = {7F13E156-3EBA-4021-84A5-CD56BA72F99E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D}
Expand Down
25 changes: 25 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,29 @@

</Target>

<!-- API Compat -->
Copy link
Member

@ericstj ericstj Apr 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving these to a seperate targets file if that is a convention you'd like to follow in this repo. #Pending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only have one for the src repo. But let me know if there is a better way.


In reply to: 279938766 [](ancestors = 279938766)

<PropertyGroup Condition="'$(RunApiCompat)' == 'true'">
<!-- resolve contract for APICompat as part of resolve references -->
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
ResolveMatchingContract
</ResolveReferencesDependsOn>

<StabelApiProject>$(RepoRoot)tools-local\Microsoft.ML.StableApi\Microsoft.ML.StableApi.csproj</StabelApiProject>
artidoro marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup Condition="'$(RunApiCompat)' == 'true'">
<PackageReference Include="Microsoft.DotNet.ApiCompat"
Version="$(MicrosoftDotNetApiCompatPackageVersion)"
PrivateAssets="All" />
</ItemGroup>

<Target Name="ResolveMatchingContract">
<MSBuild Projects="$(StabelApiProject)"
Targets="GetContract"
Properties="ContractName=$(AssemblyName);TargetFramework=$(TargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="ResolvedMatchingContract"/>
</MSBuild>
</Target>

</Project>
3 changes: 2 additions & 1 deletion src/Microsoft.ML.Analyzer/Microsoft.ML.Analyzer.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeAnalyzerInPackage>Microsoft.ML</IncludeAnalyzerInPackage>
<RunApiCompat>true</RunApiCompat>
artidoro marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Core/Microsoft.ML.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>CORECLR</DefineConstants>
<RootNamespace>Microsoft.ML</RootNamespace>
<RunApiCompat>true</RunApiCompat>
artidoro marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.DataView\Microsoft.ML.DataView.csproj" />

<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.ML.CpuMath/Microsoft.ML.CpuMath.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);CPUMATH_INFRASTRUCTURE</DefineConstants>
<LangVersion>7.3</LangVersion>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.ML.Data/Microsoft.ML.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IncludeInPackage>Microsoft.ML</IncludeInPackage>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>CORECLR</DefineConstants>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.DataView/Microsoft.ML.DataView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML.DataView</IncludeInPackage>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand All @@ -13,5 +14,4 @@
<ItemGroup>
<Compile Include="..\Microsoft.ML.Core\Utilities\ArrayUtils.cs" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Microsoft.ML.FastTree/Microsoft.ML.FastTree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IncludeInPackage>Microsoft.ML.FastTree</IncludeInPackage>
<DefineConstants>$(DefineConstants);USE_FASTTREENATIVE;NO_STORE;CORECLR</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML.ImageAnalytics</IncludeInPackage>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML</IncludeInPackage>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.LightGbm/Microsoft.ML.LightGbm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML.LightGbm</IncludeInPackage>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML.Mkl.Components</IncludeInPackage>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.ML.PCA/Microsoft.ML.PCA.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML</IncludeInPackage>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeInPackage>Microsoft.ML</IncludeInPackage>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.ML.Transforms/Microsoft.ML.Transforms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IncludeInPackage>Microsoft.ML</IncludeInPackage>
<DefineConstants>CORECLR</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunApiCompat>true</RunApiCompat>
</PropertyGroup>

<ItemGroup>
Expand Down
31 changes: 31 additions & 0 deletions tools-local/Microsoft.ML.StableApi/Microsoft.ML.StableApi.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project will actually build a .dll when we build the .sln file. That seems unnecessary. Maybe we should override the Build target or maybe not name it .csproj and instead just .proj? It's mission in life isn't to build .cs files into a .dll, but instead pull down external packages and provide the GetContract target.

Copy link
Contributor Author

@artidoro artidoro May 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried renaming, but that did not work (it gave an error saying that project.assets.json was not generated.
I have also tried to overwrite the Build target, but I must have made some mistake since I still found the generated .dll.

What I did was adding:

 <Target Name="Build">
    <!-- This will override the default Build target. -->
  </Target>

to the .csproj file.

What is the correct way to overwrite it?


In reply to: 280105436 [](ancestors = 280105436)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that is fine.


<PropertyGroup>
<!-- needs to contain all frameworks which src projects wish to restore -->
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="1.0.0-preview-27625-16"/>
Copy link
Member

@eerhardt eerhardt Apr 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) you can use the latest 1.0.0-preview build: 1.0.0-preview-27630-5. We just spun it and will have the official 1.0.0 up soon. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update to the new build and change to 1.0.0 as soon as it is available.


In reply to: 279941849 [](ancestors = 279941849)

Copy link
Member

@eerhardt eerhardt May 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's available on myget now. You should be able to use 1.0.0. #Resolved

<PackageReference Include="Microsoft.ML.DataView" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.CpuMath" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.FastTree" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.LightGbm" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.ImageAnalytics" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.Mkl.Components" Version="1.0.0-preview-27625-16"/>
<PackageReference Include="Microsoft.ML.Mkl.Redist" Version="1.0.0-preview-27625-16"/>
</ItemGroup>

<!-- The purpose of this target is to return a path from a referenced
package / project -->
<Target Name="GetContract"
DependsOnTargets="ResolveReferences"
Returns="@(_contractReferencePath)">
<Error Condition="'$(ContractName)' == ''" Text="ContractName must be specified" />
<ItemGroup>
<_contractReferencePath Include="@(ReferencePath)" Condition="'%(FileName)' == '$(ContractName)'" />
</ItemGroup>
<Error Condition="'$(ContractName)' == ''" Text="Could not locate $(ContractName)" />
artidoro marked this conversation as resolved.
Show resolved Hide resolved
</Target>

</Project>