Skip to content

Commit

Permalink
headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mszhanyi committed Dec 19, 2023
1 parent 8e31c6c commit 7e9071c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ stages:
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
CurrentDate: $[format('{0:yyyyMMdd}', pipeline.startTime)]
CurrentTime: $[format('{0:HHmm}', pipeline.startTime)]
BuildDate: $[format('{0:yyyyMMdd}', pipeline.startTime)]
BuildTime: $[format('{0:HHmm}', pipeline.startTime)]

steps:
- checkout: self
Expand Down Expand Up @@ -815,40 +815,26 @@ stages:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
configuration: RelWithDebInfo
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) -p:CurrrentDate=$(BuildDate) -p:CurrentTime=$(BuildTime)'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)

- task: MSBuild@1
displayName: 'Build Nuget Packages Microsoft.ML.OnnxRuntime.Sub.Gpu.Windows'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
configuration: RelWithDebInfo
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Sub.Gpu.Windows -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Sub.Gpu.Windows -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) -p:CurrrentDate=$(BuildDate) -p:CurrentTime=$(BuildTime) -p:IsPlatformSpecificSubPackage=True'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)
IsPlatformSpecificSubPackage: 'True'

- task: MSBuild@1
displayName: 'Build Nuget Packages Microsoft.ML.OnnxRuntime.Sub.Gpu.Linux'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
configuration: RelWithDebInfo
platform: 'Any CPU'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Sub.Gpu.Linux -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.Sub.Gpu.Linux -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) -p:CurrrentDate=$(BuildDate) -p:CurrentTime=$(BuildTime) -p:IsPlatformSpecificSubPackage=True'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
env:
# check out csharp/OnnxRuntime.CSharp.proj for the usage of these variables
CurrentDate: $(CurrentDate)
CurrentTime: $(CurrentTime)
IsPlatformSpecificSubPackage: 'True'

- task: BatchScript@1
displayName: 'Add TensorRT header file to the native nuGet package'
Expand Down
53 changes: 28 additions & 25 deletions tools/nuget/generate_nuspec_for_native_nuget.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,32 +415,35 @@ def generate_files(line_list, args):
runtimes = f'{runtimes_target}{args.target_architecture}\\{runtimes_native_folder}"'

# Process headers
build_dir = "buildTransitive" if "Microsoft.ML.OnnxRuntime.Gpu" in args.package_name else "build"
build_dir = "buildTransitive" if "Gpu" in args.package_name else "build"
include_dir = f"{build_dir}\\native\\include"
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\session\\onnxruntime_*.h")
+ '" target="'
+ include_dir
+ '" />'
)
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\framework\\provider_options.h")
+ '" target="'
+ include_dir
+ '" />'
)
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\providers\\cpu\\cpu_provider_factory.h")
+ '" target="'
+ include_dir
+ '" />'
)

# Sub.Gpu packages do not include the onnxruntime headers
if not "Sub.Gpu" in args.package_name:

Check warning

Code scanning / lintrunner

RUFF/E713 Warning

Test for membership should be not in.
See https://docs.astral.sh/ruff/rules/not-in-test
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\session\\onnxruntime_*.h")
+ '" target="'
+ include_dir
+ '" />'
)
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\framework\\provider_options.h")
+ '" target="'
+ include_dir
+ '" />'
)
files_list.append(
"<file src="
+ '"'
+ os.path.join(args.sources_path, "include\\onnxruntime\\core\\providers\\cpu\\cpu_provider_factory.h")
+ '" target="'
+ include_dir
+ '" />'
)

if is_training_package:
files_list.append(
Expand Down

0 comments on commit 7e9071c

Please sign in to comment.