Skip to content

Commit

Permalink
litter refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Zhang committed Mar 28, 2024
1 parent 5a1f885 commit ddbeac1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
parameters:
- name: msbuildPlatform
type: string
- name: java_artifact_id
type: string

steps:
- task: CmdLine@2
displayName: 'Add symbols and notices to Java'
inputs:
script: |
@echo on
cd $(Build.SourcesDirectory)\java
call $(Build.SourcesDirectory)\java\gradlew.bat cmakeCheck -DcmakeBuildDir=$(Build.BinariesDirectory)\RelWithDebInfo
if %errorlevel% neq 0 exit /b %errorlevel%
cd $(Build.BinariesDirectory)\RelWithDebInfo
set NATIVE_FOLDER=$(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ai\onnxruntime\native\win-x64
mkdir %NATIVE_FOLDER%
echo "Directories created"
copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
set artifact_id=${{ parameters.java_artifact_id }}
jar xf onnxruntime-$(OnnxRuntimeVersion).jar META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml
move META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml onnxruntime-$(OnnxRuntimeVersion).pom
rd /s /q META-INF
popd
copy .\RelWithDebInfo\onnxruntime.pdb %NATIVE_FOLDER%
copy .\RelWithDebInfo\onnxruntime4j_jni.pdb %NATIVE_FOLDER%
copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\Privacy.md
copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ThirdPartyNotices.txt
@echo $(OnnxRuntimeGitCommitHash) > $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\GIT_COMMIT_ID
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID
popd
pushd $(Build.SourcesDirectory)\java\build\classes\java\test
if %errorlevel% neq 0 exit /b %errorlevel%
jar cvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
if %errorlevel% neq 0 exit /b %errorlevel%
popd
pushd $(Build.SourcesDirectory)\java\build\resources\test
rd /s /q ai\onnxruntime\native
jar uvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
popd
rd /s /q $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
dir /s /b $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
90 changes: 8 additions & 82 deletions tools/ci_build/github/azure-pipelines/templates/win-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,47 +188,10 @@ stages:
# For CPU job, tests are run in the same machine as buidling

Check warning on line 188 in tools/ci_build/github/azure-pipelines/templates/win-ci.yml

View workflow job for this annotation

GitHub Actions / Optional Lint

[misspell] reported by reviewdog 🐶 "buidling" is a misspelling of "building" Raw Output: ./tools/ci_build/github/azure-pipelines/templates/win-ci.yml:188:58: "buidling" is a misspelling of "building"
- ${{ if contains(parameters.ort_build_pool_name, 'CPU') }}:
- ${{ if eq(parameters.buildJava, 'true') }}:
- task: CmdLine@2
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
displayName: 'Add symbols and notices to Java'
inputs:
script: |
@echo on
cd $(Build.SourcesDirectory)\java
call $(Build.SourcesDirectory)\java\gradlew.bat cmakeCheck -DcmakeBuildDir=$(Build.BinariesDirectory)\RelWithDebInfo
if %errorlevel% neq 0 exit /b %errorlevel%
cd $(Build.BinariesDirectory)\RelWithDebInfo
set NATIVE_FOLDER=$(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ai\onnxruntime\native\win-x64
mkdir %NATIVE_FOLDER%
echo "Directories created"
copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
set artifact_id=${{ parameters.java_artifact_id }}
jar xf onnxruntime-$(OnnxRuntimeVersion).jar META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml
move META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml onnxruntime-$(OnnxRuntimeVersion).pom
rd /s /q META-INF
popd
copy .\RelWithDebInfo\onnxruntime.pdb %NATIVE_FOLDER%
copy .\RelWithDebInfo\onnxruntime4j_jni.pdb %NATIVE_FOLDER%
copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\Privacy.md
copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ThirdPartyNotices.txt
@echo $(OnnxRuntimeGitCommitHash) > $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\GIT_COMMIT_ID
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID
popd
pushd $(Build.SourcesDirectory)\java\build\classes\java\test
if %errorlevel% neq 0 exit /b %errorlevel%
jar cvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
if %errorlevel% neq 0 exit /b %errorlevel%
popd
pushd $(Build.SourcesDirectory)\java\build\resources\test
rd /s /q ai\onnxruntime\native
jar uvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
popd
rd /s /q $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
dir /s /b $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
- template: make_java_win_binaries.yml
parameters:
msbuildPlatform: ${{ parameters.msbuildPlatform }}
java_artifact_id: ${{ parameters.java_artifact_id }}

- task: PublishBuildArtifacts@1
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
Expand Down Expand Up @@ -423,47 +386,10 @@ stages:
workingDirectory: '$(Build.BinariesDirectory)'

- ${{ if eq(parameters.buildJava, 'true') }}:
- task: CmdLine@2
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
displayName: 'Add symbols and notices to Java'
inputs:
script: |
@echo on
cd $(Build.SourcesDirectory)\java
call $(Build.SourcesDirectory)\java\gradlew.bat cmakeCheck -DcmakeBuildDir=$(Build.BinariesDirectory)\RelWithDebInfo
if %errorlevel% neq 0 exit /b %errorlevel%
cd $(Build.BinariesDirectory)\RelWithDebInfo
set NATIVE_FOLDER=$(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ai\onnxruntime\native\win-x64
mkdir %NATIVE_FOLDER%
echo "Directories created"
copy .\java\build\libs\*.jar $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
set artifact_id=${{ parameters.java_artifact_id }}
jar xf onnxruntime-$(OnnxRuntimeVersion).jar META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml
move META-INF\maven\com.microsoft.onnxruntime\%artifact_id%\pom.xml onnxruntime-$(OnnxRuntimeVersion).pom
rd /s /q META-INF
popd
copy .\RelWithDebInfo\onnxruntime.pdb %NATIVE_FOLDER%
copy .\RelWithDebInfo\onnxruntime4j_jni.pdb %NATIVE_FOLDER%
copy $(Build.SourcesDirectory)\docs\Privacy.md $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\Privacy.md
copy $(Build.SourcesDirectory)\ThirdPartyNotices.txt $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\ThirdPartyNotices.txt
@echo $(OnnxRuntimeGitCommitHash) > $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage\GIT_COMMIT_ID
pushd $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar ai\onnxruntime\native\win-x64\onnxruntime4j_jni.pdb
jar uf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\onnxruntime-$(OnnxRuntimeVersion).jar Privacy.md ThirdPartyNotices.txt GIT_COMMIT_ID
popd
pushd $(Build.SourcesDirectory)\java\build\classes\java\test
if %errorlevel% neq 0 exit /b %errorlevel%
jar cvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
if %errorlevel% neq 0 exit /b %errorlevel%
popd
pushd $(Build.SourcesDirectory)\java\build\resources\test
rd /s /q ai\onnxruntime\native
jar uvf $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\testing.jar .
popd
rd /s /q $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}\stage
dir /s /b $(Build.BinariesDirectory)\onnxruntime-java-win-${{ parameters.msbuildPlatform }}
- template: make_java_win_binaries.yml
parameters:
msbuildPlatform: ${{ parameters.msbuildPlatform }}
java_artifact_id: ${{ parameters.java_artifact_id }}

- task: PublishBuildArtifacts@1
condition: and(succeeded(), eq('${{ parameters.buildJava}}', true))
Expand Down

0 comments on commit ddbeac1

Please sign in to comment.