Combine JAR Packages for Windows, Linux, and MacOS (#669)

* unpack all JARs

* fix macos job

* remove -f for macos tree

* move build files from java and linux into macos directory for combined JAR

* test with download and publish pipeline artifacts instead

* use full download task name rather than shortcut

* add job dependencies

* combine JAR packages into one

* update version from version.txt

* change relative path for version.txt

* test

* typo

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* test without output variable

* Update java_packaging.yml for Azure Pipelines

* test with type rather than cat command

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* set version in each job

* Update java_packaging.yml for Azure Pipelines

* Update java_packaging.yml for Azure Pipelines

* add back dependencies

* final

---------

Co-authored-by: Sayan Shaw <sayanshaw@microsoft.com>
This commit is contained in:
Sayan Shaw 2024-03-15 11:30:19 -07:00 коммит произвёл GitHub
Родитель ebc652d4af
Коммит 232132992b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 76 добавлений и 19 удалений

Просмотреть файл

@ -13,6 +13,15 @@ stages:
pool: {name: 'onnxruntime-Win-CPU-2022'}
steps:
- task: PowerShell@2
displayName: 'Set version'
inputs:
targetType: 'inline'
script: |
$_ExtVersion=(cat version.txt)
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
workingDirectory: '$(Build.SourcesDirectory)'
- script: |
call .\build.bat -DOCOS_BUILD_JAVA=ON
displayName: build the extensions java package
@ -25,7 +34,7 @@ stages:
- script: |
cd $(Build.ArtifactStagingDirectory)
jar xvf onnxruntime-extensions-0.11.0.jar
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
tree $(Build.ArtifactStagingDirectory) /f
displayName: Unpack JAR to sign DLL
@ -35,18 +44,9 @@ stages:
DisplayName: 'Sign DLL'
DoEsrp: 'true'
- script: |
cd $(Build.ArtifactStagingDirectory)
rm onnxruntime-extensions-0.11.0.jar
jar cmf0 META-INF/MANIFEST.MF onnxruntime-extensions-0.11.0.jar *
tree $(Build.ArtifactStagingDirectory) /f
displayName: Repack JAR with signed DLL
- task: PublishPipelineArtifact@1
displayName: 'Publish Windows Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'drop-signed-windows-onnxruntime-extensions-java-cpu'
- publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/
displayName: 'Publish Windows Binaries for Combined JAR'
artifact: WindowsBinaries
- template: templates/component-governance-component-detection-steps.yml
parameters :
@ -62,6 +62,15 @@ stages:
pool: {name: 'Azure-Pipelines-EO-Ubuntu-2004-aiinfra'}
steps:
- task: PowerShell@2
displayName: 'Set version'
inputs:
targetType: 'inline'
script: |
$_ExtVersion=(cat version.txt)
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
workingDirectory: '$(Build.SourcesDirectory)'
- script: |
sh ./build.sh -DOCOS_BUILD_JAVA=ON
displayName: build the extensions java package
@ -72,11 +81,16 @@ stages:
SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Linux Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'drop-linux-onnxruntime-extensions-java-cpu'
- script: |
cd $(Build.ArtifactStagingDirectory)
echo $(OrtExtVersion)
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
tree $(Build.ArtifactStagingDirectory) /f
displayName: Unpack JAR
- publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/
displayName: 'Publish Linux Binaries for Combined JAR'
artifact: LinuxBinaries
- template: templates/component-governance-component-detection-steps.yml
parameters :
@ -87,12 +101,24 @@ stages:
condition: always()
- job: MacOS_CPU_Java_Packaging
dependsOn:
- Windows_CPU_Java_Packaging
- Linux_CPU_Java_Packaging
workspace:
clean: all
pool:
vmImage: 'macOS-13'
steps:
- task: PowerShell@2
displayName: 'Set version'
inputs:
targetType: 'inline'
script: |
$_ExtVersion=(cat version.txt)
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
workingDirectory: '$(Build.SourcesDirectory)'
- script: |
sh ./build.sh -DOCOS_BUILD_JAVA=ON
displayName: build the extensions java package
@ -103,11 +129,42 @@ stages:
SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- script: |
cd $(Build.ArtifactStagingDirectory)
echo $(OrtExtVersion)
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
brew install tree
tree $(Build.ArtifactStagingDirectory)
displayName: Unpack JAR to view contents
- task: DownloadPipelineArtifact@0
displayName: 'Download Windows Pipeline Artifact'
inputs:
artifactName: 'WindowsBinaries'
targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/'
- task: DownloadPipelineArtifact@0
displayName: 'Download Linux Pipeline Artifact'
inputs:
artifactName: 'LinuxBinaries'
targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/'
- script: |
brew install tree
tree $(Build.ArtifactStagingDirectory)
displayName: Print contents
- script: |
cd $(Build.ArtifactStagingDirectory)
rm onnxruntime-extensions-$(OrtExtVersion).jar
jar cmf0 META-INF/MANIFEST.MF onnxruntime-extensions-$(OrtExtVersion).jar *
displayName: Combine and pack JAR with Windows, Linux and MacOS Binaries
- task: PublishPipelineArtifact@1
displayName: 'Publish MacOS Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'drop-macos-onnxruntime-extensions-java-cpu'
artifact: 'drop-onnxruntime-extensions-java-cpu'
- template: templates/component-governance-component-detection-steps.yml
parameters :