-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Changes from 6 commits
449c8df
f0ebe31
4e93cf3
1ba081c
c113ef3
455ab08
b9d2fac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,32 @@ | |
|
||
</Target> | ||
|
||
<!-- API Compat --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
||
<StableApiProject>$(RepoRoot)tools-local\Microsoft.ML.StableApi\Microsoft.ML.StableApi.csproj</StableApiProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(RunApiCompat)' == 'true'"> | ||
<PackageReference Include="Microsoft.DotNet.ApiCompat" | ||
Version="$(MicrosoftDotNetApiCompatPackageVersion)" | ||
PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<Target Name="ResolveMatchingContract"> | ||
<MSBuild Projects="$(StableApiProject)" | ||
Targets="GetContract" | ||
Properties="ContractName=$(AssemblyName);TargetFramework=$(TargetFramework)"> | ||
<Output TaskParameter="TargetOutputs" ItemName="ResolvedMatchingContract"/> | ||
</MSBuild> | ||
<PropertyGroup> | ||
<ContractOutputPath>%(ResolvedMatchingContract.DependencyPaths)</ContractOutputPath> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This project will actually build a There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. What I did was adding:
to the .csproj file. What is the correct way to overwrite it? In reply to: 280105436 [](ancestors = 280105436) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 --> | ||
<TargetFramework Condition="'$(UseIntrinsics)' != 'true'">netstandard2.0</TargetFramework> | ||
<TargetFrameworks Condition="'$(UseIntrinsics)' == 'true'">netstandard2.0;netcoreapp3.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why should we have the condition here? Is there any harm in always resolving for both TFMs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, makes sense. |
||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.ML" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.DataView" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.CpuMath" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.FastTree" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.LightGbm" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.ImageAnalytics" Version="1.0.0" /> | ||
<PackageReference Include="Microsoft.ML.Mkl.Components" Version="1.0.0" /> | ||
</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)'" /> | ||
<_allReferenceDirectories Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" /> | ||
<_contractReferencePath Include="@(ReferencePath)" Condition="'%(FileName)' == '$(ContractName)'" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines 24 and 26 are identical... 😕 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RussKie - can you log an issue (or even submit a PR for the fix)? |
||
<_contractReferencePath DependencyPaths="@(_allReferenceDirectories)" /> | ||
</ItemGroup> | ||
<Error Condition="'@(_contractReferencePath)' == ''" Text="Could not locate $(ContractName)" /> | ||
</Target> | ||
|
||
<Target Name="Build"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be improved by changing the project extension and defining a couple targets. We do that elsewhere: IOW: call this a .proj, or a .restoreproj or something. SLN entry looks the same (you have to do it manually in text editor, IDE won't let you). Add the workaround I linked, define stub targets for anything that fails, and it should avoid There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tried to add the lines found in the issue to the new .restoreproj file but that did not work. |
||
<!-- This will override the default Build target. --> | ||
</Target> | ||
<Target Name="Rebuild"> | ||
<!-- This will override the default Rebuild target. --> | ||
</Target> | ||
<Target Name="BuildAndTest"> | ||
<!-- This will override the default BuildAndTest target. --> | ||
</Target> | ||
<Target Name="RebuildAndTest"> | ||
<!-- This will override the default RebuildAndTest target. --> | ||
</Target> | ||
|
||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to revert these two lines. I don't know what happens if someone tries opening the solution with VS 2017 (which is version 15) and this .sln says it is for VS 2019.