-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Create a redist package for tensorflowCreate a nuget package that red… #720
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a59b6be
Create a redist package for tensorflow
ericstj ee5f0bf
Make TF redist project a normal MSBuild project
ericstj cba17af
Add TF License file to package
ericstj 69aca5d
Don't use fullpaths when un-tar'ing
ericstj c7172d6
Add some logging to TF redist project
ericstj e0e439d
Fix casing of TF redist proj
ericstj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
pkg/Microsoft.ML.TensorFlow.Redist/Microsoft.ML.TensorFlow.Redist.nupkgproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Pack"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<PackageDescription>$(MSBuildProjectName) contains the TensorFlow C library version $(TensorFlowVersion) redistributed as a NuGet package.</PackageDescription> | ||
<PackageLicenseUrl>https://github.com/tensorflow/tensorflow/blob/master/LICENSE</PackageLicenseUrl> | ||
<PackageProjectUrl>https://www.tensorflow.org/install/install_c</PackageProjectUrl> | ||
<PackageReleaseNotes>https://github.com/tensorflow/tensorflow/releases/tag/v$(TensorFlowVersion)</PackageReleaseNotes> | ||
<PackageTags>$(PackageTags) TensorFlow</PackageTags> | ||
<!-- TODO: consider PackageIconUrl --> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="..\common\CommonPackage.props" Pack="true" PackagePath="build\netstandard2.0\$(MSBuildProjectName).props" /> | ||
<Content Include="$(PackageAssetsPath)$(PackageIdFolderName)\LICENSE" Pack="true" PackagePath=".\" /> | ||
</ItemGroup> | ||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
src/Redist/Microsoft.ML.TensorFlow.Redist/Microsoft.ML.TensorFlow.Redist.proj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<TensorFlowConfig Include="windows" FileExtension=".zip" FilesFromArchive="lib\tensorflow.dll;include\tensorflow\c\LICENSE" Runtime="win-x64"/> | ||
<TensorFlowConfig Include="linux" FileExtension=".tar.gz" FilesFromArchive="lib\libtensorflow.so;lib\libtensorflow_framework.so" Runtime="linux-x64" /> | ||
<TensorFlowConfig Include="darwin" FileExtension=".tar.gz" FilesFromArchive="lib\libtensorflow.so;lib\libtensorflow_framework.so" Runtime="osx-x64" /> | ||
<TensorFlowArchive Include="@(TensorFlowConfig->'https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-%(Identity)-x86_64-$(TensorFlowVersion)%(FileExtension)')" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PrepareArchives"> | ||
<ItemGroup> | ||
<!-- set up metdata used by all targets --> | ||
<TensorFlowArchive DownloadFile="$(IntermediateOutputPath)%(FileName)%(Extension)" | ||
DownloadShaFile="$(IntermediateOutputPath)%(FileName)%(Extension).sha" | ||
ExtractDirectory="$(IntermediateOutputPath)%(FileName)" | ||
ExtractSemaphore="$(IntermediateOutputPath)%(FileName)\.extracted" | ||
LocalShaFile="$(MSBuildProjectDirectory)\%(FileName)%(Extension).sha"/> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<UsingTask TaskName="DownloadFilesFromUrl" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll"/> | ||
<Target Name="DownloadArchives" | ||
DependsOnTargets="PrepareArchives" | ||
Inputs="$(MSBuildProjectFile)" | ||
Outputs="@(TensorFlowArchive->'%(DownloadFile)')"> | ||
<MakeDir Directories="$(IntermediateOutputPath)" /> | ||
<ItemGroup> | ||
<!-- DownloadFilesFromUrl requires Url metadata is set and ignores the identity of the item --> | ||
<_downloadFiles Include="@(TensorFlowArchive)" Url="%(Identity)" DestinationFile="%(DownloadFile)" /> | ||
</ItemGroup> | ||
<Message Importance="High" Text="Downloading '%(_downloadFiles.Url)' to '%(_downloadFiles.DestinationFile)'." /> | ||
<DownloadFilesFromUrl Items="@(_downloadFiles)" /> | ||
</Target> | ||
|
||
<UsingTask TaskName="GenerateChecksums" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll"/> | ||
<UsingTask TaskName="ZipFileExtractToDirectory" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll"/> | ||
<Target Name="ValidateAndExtractArchives" | ||
DependsOnTargets="DownloadArchives" | ||
Inputs="@(TensorFlowArchive->'%(DownloadFile)')" | ||
Outputs="@(TensorFlowArchive->'%(ExtractSemaphore)')"> | ||
<!-- GenerateChecksums writes a sha checksum to the file specified by DestinationPath metadata --> | ||
<ItemGroup> | ||
<_filesToCheckSum Include="@(TensorFlowArchive->'%(DownloadFile)')" DestinationPath="%(DownloadShaFile)" /> | ||
</ItemGroup> | ||
<GenerateChecksums Items="@(_filesToCheckSum)" /> | ||
|
||
<!-- If specified we'll update the checked in SHAs with the downloaded ones. --> | ||
<Copy Condition="'$(UpdateSHA)' == 'true'" | ||
SourceFiles="@(TensorFlowArchive->'%(DownloadShaFile)')" | ||
DestinationFiles="@(TensorFlowArchive->'%(LocalShaFile)')" /> | ||
|
||
<Error Condition="!Exists('%(TensorFlowArchive.LocalShaFile)')" Text="SHA file '%(TensorFlowArchive.LocalShaFile)' does not exist. Build with /p:UpdateSHA=true to save it." /> | ||
|
||
<!-- Read in the SHAs as metadata on the archive items --> | ||
<ItemGroup> | ||
<TensorFlowArchive> | ||
<LocalSha>$([System.IO.File]::ReadAllText('%(LocalShaFile)'))</LocalSha> | ||
<DownloadSha>$([System.IO.File]::ReadAllText('%(DownloadShaFile)'))</DownloadSha> | ||
</TensorFlowArchive> | ||
</ItemGroup> | ||
<!-- Validate that the downloaded SHAs match the expected checked in SHAs --> | ||
<Error Condition="'%(TensorFlowArchive.LocalSha)' != '%(TensorFlowArchive.DownloadSha)'" Text="Downloaded file '%(TensorFlowArchive.DownloadFile)' has unexpected SHA.%0A expected: %(_downloadedTensorFlowArchive.LocalSha)%0A actual: %(_downloadedTensorFlowArchive.DownloadSha)%0ABuild with /p:UpdateSHA=true if you intentionally changed the URL and wish to update the SHAs, otherwise this could indicate an incomplete download or intercerpted URL and should be examined." /> | ||
|
||
<!-- The archives are valid, lets extract them, ensuring an empty directory --> | ||
<RemoveDir Directories="@(TensorFlowArchive->'%(ExtractDirectory)')" /> | ||
<MakeDir Directories="@(TensorFlowArchive->'%(ExtractDirectory)')" /> | ||
<ZipFileExtractToDirectory Condition="'%(TensorFlowArchive.FileExtension)' == '.zip'" | ||
SourceArchive="%(TensorFlowArchive.DownloadFile)" | ||
DestinationDirectory="%(TensorFlowArchive.ExtractDirectory)" | ||
OverwriteDestination="true" /> | ||
|
||
<Message Importance="High" Condition="'%(TensorFlowArchive.FileExtension)' == '.tar.gz'" Text="Decompressing '%(TensorFlowArchive.DownloadFile)' to '%(TensorFlowArchive.ExtractDirectory)'." /> | ||
<Exec Condition="'%(TensorFlowArchive.FileExtension)' == '.tar.gz'" | ||
WorkingDirectory="%(TensorFlowArchive.ExtractDirectory)" | ||
Command="tar -xzmf "$([MSBuild]::MakeRelative('%(TensorFlowArchive.ExtractDirectory)', '%(TensorFlowArchive.DownloadFile)'))"" /> | ||
<Touch Files="@(TensorFlowArchive->'%(ExtractSemaphore)')" AlwaysCreate="true" /> | ||
</Target> | ||
|
||
<!-- Select the files we want to copy out of each archive. --> | ||
<Target Name="GetFilesFromArchive" | ||
DependsOnTargets="ValidateAndExtractArchives" > | ||
<ItemGroup> | ||
<!-- batch rather than transform so that we can split FilesFromArchive metadata --> | ||
<_fileFromArchive Include="%(TensorFlowArchive.FilesFromArchive)" ExtractDirectory="%(TensorFlowArchive.ExtractDirectory)" Runtime="%(TensorFlowArchive.Runtime)" /> | ||
<_fileFromArchive DestinationFile="%(FileName)%(Extension)"/> | ||
<!-- rename the .so to .dylib --> | ||
<_fileFromArchive Condition="'%(Runtime)' == 'osx-x64'" DestinationFile="%(FileName).dylib" /> | ||
<_fileFromArchive PackagePath="runtimes\%(_fileFromArchive.Runtime)\native\%(_fileFromArchive.DestinationFile)" /> | ||
|
||
<!-- put the LICENSE in the root --> | ||
<_fileFromArchive Condition="'%(DestinationFile)' == 'LICENSE'" PackagePath="%(_fileFromArchive.DestinationFile)" Runtime="" /> | ||
|
||
<!-- copy to packaging location --> | ||
<FilesFromArchive Include="%(_fileFromArchive.ExtractDirectory)\%(_fileFromArchive.Identity)" | ||
TargetPath="$(PackageAssetsPath)$(MSBuildProjectName)\%(_fileFromArchive.PackagePath)" /> | ||
|
||
<!-- copy to NativeAssets location, only for current RID, so that they may be used by tests --> | ||
<FilesFromArchive Condition="'$(PackageRID)' == '%(_fileFromArchive.Runtime)'" | ||
Include="%(_fileFromArchive.ExtractDirectory)\%(_fileFromArchive.Identity)" | ||
TargetPath="$(NativeAssetsBuiltPath)\%(_fileFromArchive.DestinationFile)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="CopyFilesFromArchive" | ||
DependsOnTargets="GetFilesFromArchive"> | ||
<Message Importance="High" Text="@(FilesFromArchive) -> %(FilesFromArchive.TargetPath)" /> | ||
<Copy SourceFiles="@(FilesFromArchive)" | ||
DestinationFiles="@(FilesFromArchive->'%(TargetPath)')" /> | ||
</Target> | ||
|
||
<!-- Define Build to do the work of downloading and copying assets --> | ||
<Target Name="Build" | ||
DependsOnTargets="CopyFilesFromArchive" /> | ||
|
||
<Target Name="Clean"> | ||
<RemoveDir Directories="$(IntermediateOutputPath)" /> | ||
</Target> | ||
</Project> |
1 change: 1 addition & 0 deletions
1
src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-darwin-x86_64-1.10.0.tar.gz.sha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
77218EC4DA96A73B15B8AA5637C9F21B389510A9FAF4DCF06DF5B81A5403015C6BA3EEE29BD8BA5B0694F40C671D8E6722D554C4F93F95C33F29AB491C70263C |
1 change: 1 addition & 0 deletions
1
src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-linux-x86_64-1.10.0.tar.gz.sha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
B9E9CD95BC6A28297ACAB0D684FBBFAFF1F9AE893432AC2D208120D767101AC20E2C55BC79E59DBE6E5BD9EC802026694960FA12137BB303061C5A21B62BD29E |
1 change: 1 addition & 0 deletions
1
src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-windows-x86_64-1.10.0.zip.sha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
66F3A9522917076038AE9CCA11FE805DD516C60B3A3E156B78C2E4BD0E3E5785A9D0380C5E06411473EF14A72B72FD93F954AA3496A12D1FAF0FA3393970E700 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project> | ||
<ItemGroup> | ||
<Project Include="*\*proj" /> | ||
</ItemGroup> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" /> | ||
</Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Question (probably for a lawyer): Do we need to put a license/notice in this package? or is using the
PackageLicenseUrl
enough to meet TF requirements? #ResolvedThere 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.
We have a discussion going around this and will find out all the details.
In reply to: 212419037 [](ancestors = 212419037)
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.
TF included a license in their zips so I went ahead and placed it in the root of this package.
In reply to: 212426813 [](ancestors = 212426813,212419037)