Skip to content

Commit 2321329

Browse files
sayanshaw24Sayan Shaw
andauthored
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 <[email protected]>
1 parent ebc652d commit 2321329

File tree

1 file changed

+76
-19
lines changed

1 file changed

+76
-19
lines changed

.pipelines/java_packaging.yml

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ stages:
1313
pool: {name: 'onnxruntime-Win-CPU-2022'}
1414

1515
steps:
16+
- task: PowerShell@2
17+
displayName: 'Set version'
18+
inputs:
19+
targetType: 'inline'
20+
script: |
21+
$_ExtVersion=(cat version.txt)
22+
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
23+
workingDirectory: '$(Build.SourcesDirectory)'
24+
1625
- script: |
1726
call .\build.bat -DOCOS_BUILD_JAVA=ON
1827
displayName: build the extensions java package
@@ -25,7 +34,7 @@ stages:
2534

2635
- script: |
2736
cd $(Build.ArtifactStagingDirectory)
28-
jar xvf onnxruntime-extensions-0.11.0.jar
37+
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
2938
tree $(Build.ArtifactStagingDirectory) /f
3039
displayName: Unpack JAR to sign DLL
3140
@@ -35,18 +44,9 @@ stages:
3544
DisplayName: 'Sign DLL'
3645
DoEsrp: 'true'
3746

38-
- script: |
39-
cd $(Build.ArtifactStagingDirectory)
40-
rm onnxruntime-extensions-0.11.0.jar
41-
jar cmf0 META-INF/MANIFEST.MF onnxruntime-extensions-0.11.0.jar *
42-
tree $(Build.ArtifactStagingDirectory) /f
43-
displayName: Repack JAR with signed DLL
44-
45-
- task: PublishPipelineArtifact@1
46-
displayName: 'Publish Windows Artifact'
47-
inputs:
48-
targetPath: '$(Build.ArtifactStagingDirectory)'
49-
artifact: 'drop-signed-windows-onnxruntime-extensions-java-cpu'
47+
- publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/
48+
displayName: 'Publish Windows Binaries for Combined JAR'
49+
artifact: WindowsBinaries
5050

5151
- template: templates/component-governance-component-detection-steps.yml
5252
parameters :
@@ -62,6 +62,15 @@ stages:
6262
pool: {name: 'Azure-Pipelines-EO-Ubuntu-2004-aiinfra'}
6363

6464
steps:
65+
- task: PowerShell@2
66+
displayName: 'Set version'
67+
inputs:
68+
targetType: 'inline'
69+
script: |
70+
$_ExtVersion=(cat version.txt)
71+
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
72+
workingDirectory: '$(Build.SourcesDirectory)'
73+
6574
- script: |
6675
sh ./build.sh -DOCOS_BUILD_JAVA=ON
6776
displayName: build the extensions java package
@@ -72,11 +81,16 @@ stages:
7281
SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs'
7382
TargetFolder: '$(Build.ArtifactStagingDirectory)'
7483

75-
- task: PublishPipelineArtifact@1
76-
displayName: 'Publish Linux Artifact'
77-
inputs:
78-
targetPath: '$(Build.ArtifactStagingDirectory)'
79-
artifact: 'drop-linux-onnxruntime-extensions-java-cpu'
84+
- script: |
85+
cd $(Build.ArtifactStagingDirectory)
86+
echo $(OrtExtVersion)
87+
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
88+
tree $(Build.ArtifactStagingDirectory) /f
89+
displayName: Unpack JAR
90+
91+
- publish: $(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/
92+
displayName: 'Publish Linux Binaries for Combined JAR'
93+
artifact: LinuxBinaries
8094

8195
- template: templates/component-governance-component-detection-steps.yml
8296
parameters :
@@ -87,12 +101,24 @@ stages:
87101
condition: always()
88102

89103
- job: MacOS_CPU_Java_Packaging
104+
dependsOn:
105+
- Windows_CPU_Java_Packaging
106+
- Linux_CPU_Java_Packaging
90107
workspace:
91108
clean: all
92109
pool:
93110
vmImage: 'macOS-13'
94111

95112
steps:
113+
- task: PowerShell@2
114+
displayName: 'Set version'
115+
inputs:
116+
targetType: 'inline'
117+
script: |
118+
$_ExtVersion=(cat version.txt)
119+
echo "##vso[task.setvariable variable=OrtExtVersion;]$_ExtVersion"
120+
workingDirectory: '$(Build.SourcesDirectory)'
121+
96122
- script: |
97123
sh ./build.sh -DOCOS_BUILD_JAVA=ON
98124
displayName: build the extensions java package
@@ -103,11 +129,42 @@ stages:
103129
SourceFolder: 'out/$(Agent.OS)/RelWithDebInfo/java/build/libs'
104130
TargetFolder: '$(Build.ArtifactStagingDirectory)'
105131

132+
- script: |
133+
cd $(Build.ArtifactStagingDirectory)
134+
echo $(OrtExtVersion)
135+
jar xvf onnxruntime-extensions-$(OrtExtVersion).jar
136+
brew install tree
137+
tree $(Build.ArtifactStagingDirectory)
138+
displayName: Unpack JAR to view contents
139+
140+
- task: DownloadPipelineArtifact@0
141+
displayName: 'Download Windows Pipeline Artifact'
142+
inputs:
143+
artifactName: 'WindowsBinaries'
144+
targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/'
145+
146+
- task: DownloadPipelineArtifact@0
147+
displayName: 'Download Linux Pipeline Artifact'
148+
inputs:
149+
artifactName: 'LinuxBinaries'
150+
targetPath: '$(Build.ArtifactStagingDirectory)/ai/onnxruntime/extensions/native/'
151+
152+
- script: |
153+
brew install tree
154+
tree $(Build.ArtifactStagingDirectory)
155+
displayName: Print contents
156+
157+
- script: |
158+
cd $(Build.ArtifactStagingDirectory)
159+
rm onnxruntime-extensions-$(OrtExtVersion).jar
160+
jar cmf0 META-INF/MANIFEST.MF onnxruntime-extensions-$(OrtExtVersion).jar *
161+
displayName: Combine and pack JAR with Windows, Linux and MacOS Binaries
162+
106163
- task: PublishPipelineArtifact@1
107164
displayName: 'Publish MacOS Artifact'
108165
inputs:
109166
targetPath: '$(Build.ArtifactStagingDirectory)'
110-
artifact: 'drop-macos-onnxruntime-extensions-java-cpu'
167+
artifact: 'drop-onnxruntime-extensions-java-cpu'
111168

112169
- template: templates/component-governance-component-detection-steps.yml
113170
parameters :

0 commit comments

Comments
 (0)