Skip to content

Commit 6ce2c8a

Browse files
authored
Merge pull request #63 from asus4/updaate-ci
Publish GenAI package to UPM
2 parents 1512078 + 16b8684 commit 6ce2c8a

File tree

13 files changed

+55
-27
lines changed

13 files changed

+55
-27
lines changed

.github/workflows/publish-packages.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
run: |
3030
./scripts/download-onnx-libs.sh ${{ env.ORT_VERSION }}
3131
./scripts/download-onnx-extensions-libs.sh ${{ env.ORT_EXTENSIONS_VERSION }}
32+
./scripts/download-onnx-genai-libs.sh ${{ env.ORT_GENAI_VERSION }}
3233
- name: Publish all NPM packages
3334
run: |
3435
publish_npm() {
@@ -40,6 +41,7 @@ jobs:
4041
publish_npm com.github.asus4.onnxruntime
4142
publish_npm com.github.asus4.onnxruntime.unity
4243
publish_npm com.github.asus4.onnxruntime-extensions
44+
publish_npm com.github.asus4.onnxruntime-genai
4345
# publish_npm com.github.asus4.onnxruntime.linux-x64-gpu
4446
# publish_npm com.github.asus4.onnxruntime.win-x64-gpu
4547
env:
@@ -51,6 +53,7 @@ jobs:
5153
zip -r com.github.asus4.onnxruntime-${{ github.ref_name }}.zip com.github.asus4.onnxruntime
5254
zip -r com.github.asus4.onnxruntime.unity-${{ github.ref_name }}.zip com.github.asus4.onnxruntime.unity
5355
zip -r com.github.asus4.onnxruntime-extensions-${{ github.ref_name }}.zip com.github.asus4.onnxruntime-extensions
56+
zip -r com.github.asus4.onnxruntime-genai-${{ github.ref_name }}.zip com.github.asus4.onnxruntime-genai
5457
zip -r com.github.asus4.onnxruntime.linux-x64-gpu-${{ github.ref_name }}.zip com.github.asus4.onnxruntime.linux-x64-gpu
5558
zip -r com.github.asus4.onnxruntime.win-x64-gpu-${{ github.ref_name }}.zip com.github.asus4.onnxruntime.win-x64-gpu
5659
- name: Upload release assets
@@ -61,5 +64,6 @@ jobs:
6164
com.github.asus4.onnxruntime-${{ github.ref_name }}.zip
6265
com.github.asus4.onnxruntime.unity-${{ github.ref_name }}.zip
6366
com.github.asus4.onnxruntime-extensions-${{ github.ref_name }}.zip
67+
com.github.asus4.onnxruntime-genai-${{ github.ref_name }}.zip
6468
com.github.asus4.onnxruntime.linux-x64-gpu-${{ github.ref_name }}.zip
6569
com.github.asus4.onnxruntime.win-x64-gpu-${{ github.ref_name }}.zip

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.git
7070
}
7171
]
7272
"dependencies": {
73-
"com.github.asus4.onnxruntime": "0.3.5",
74-
"com.github.asus4.onnxruntime.unity": "0.3.5",
75-
"com.github.asus4.onnxruntime.win-x64-gpu": "0.3.5",
76-
"com.github.asus4.onnxruntime-extensions": "0.3.5",
73+
"com.github.asus4.onnxruntime": "0.4.0",
74+
"com.github.asus4.onnxruntime.unity": "0.4.0",
75+
"com.github.asus4.onnxruntime.win-x64-gpu": "0.4.0",
76+
"com.github.asus4.onnxruntime-extensions": "0.4.0",
7777
... other dependencies
7878
}
7979
```

com.github.asus4.onnxruntime-extensions/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime-extensions",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime Extensions",
55
"description": "ONNX Runtime Extensions for Unity",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"unity": "2022.3",
1111
"unityRelease": "0f1",
1212
"dependencies": {
13-
"com.github.asus4.onnxruntime": "0.3.5"
13+
"com.github.asus4.onnxruntime": "0.4.0"
1414
},
1515
"repository": {
1616
"type": "git",

com.github.asus4.onnxruntime-genai/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime-genai",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime GenAI",
55
"description": "ONNX Runtime Generative AI for Unity",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"unity": "2022.3",
1111
"unityRelease": "0f1",
1212
"dependencies": {
13-
"com.github.asus4.onnxruntime": "0.3.5"
13+
"com.github.asus4.onnxruntime": "0.4.0"
1414
},
1515
"repository": {
1616
"type": "git",

com.github.asus4.onnxruntime.linux-x64-gpu/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime.linux-x64-gpu",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime - Linux x64 GPU",
55
"description": "ONNX Runtime for Unity - Linux x64 GPU Provider",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"unity": "2022.3",
1111
"unityRelease": "0f1",
1212
"dependencies": {
13-
"com.github.asus4.onnxruntime": "0.3.5"
13+
"com.github.asus4.onnxruntime": "0.4.0"
1414
},
1515
"repository": {
1616
"type": "git",

com.github.asus4.onnxruntime.unity/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime.unity",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime Unity Utilities",
55
"description": "ONNX Runtime Utilities for Unity",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"unity": "2022.3",
1111
"unityRelease": "0f1",
1212
"dependencies": {
13-
"com.github.asus4.onnxruntime": "0.3.5"
13+
"com.github.asus4.onnxruntime": "0.4.0"
1414
},
1515
"repository": {
1616
"type": "git",

com.github.asus4.onnxruntime.win-x64-gpu/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime.win-x64-gpu",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime - Windows x64 GPU",
55
"description": "ONNX Runtime for Unity - Windows x64 GPU Provider",
66
"keywords": [
@@ -10,7 +10,7 @@
1010
"unity": "2022.3",
1111
"unityRelease": "0f1",
1212
"dependencies": {
13-
"com.github.asus4.onnxruntime": "0.3.5"
13+
"com.github.asus4.onnxruntime": "0.4.0"
1414
},
1515
"repository": {
1616
"type": "git",

com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public void OnPostprocessBuild(BuildReport report)
3636
}
3737
}
3838

39+
/// <summary>
40+
/// A common method that copies and sets options for ONNX Runtime XCFramework in iOS
41+
/// </summary>
42+
/// <param name="report">A build report</param>
43+
/// <param name="packagePath">A package path starting from "Packages/com.domain.package"</param>
44+
/// <param name="frameworkSrcPath">A source XCFramework path</param>
45+
/// <param name="frameworkDstPath">A destination XCFramework path</param>
3946
public static void CopyOrtXCFramework(
4047
BuildReport report,
4148
string packagePath,
@@ -50,21 +57,32 @@ public static void CopyOrtXCFramework(
5057
// Copy XCFramework to the Xcode project folder
5158
string frameworkSrcAbsPath = Path.Combine(packagePath, frameworkSrcPath);
5259
string frameworkDstAbsPath = Path.Combine(report.summary.outputPath, frameworkDstPath);
53-
FileUtil.ReplaceDirectory(frameworkSrcAbsPath, frameworkDstAbsPath);
60+
CopyDirectory(frameworkSrcAbsPath, frameworkDstAbsPath);
5461

5562
// Then add to Xcode project
5663
string frameworkGuid = pbxProject.AddFile(frameworkDstAbsPath, frameworkDstPath, PBXSourceTree.Source);
5764
string unityTargetGuid = pbxProject.GetUnityFrameworkTargetGuid();
5865
string targetBuildPhaseGuid = pbxProject.AddFrameworksBuildPhase(unityTargetGuid);
5966
pbxProject.AddFileToBuildSection(unityTargetGuid, targetBuildPhaseGuid, frameworkGuid);
6067

61-
// TODO: Required only when GenAI is installed
62-
// Add to Embed Frameworks in the main target
68+
#if ORT_GENAI_ENABLED
69+
// NOTE: Required only when GenAI package is installed
70+
// GenAI loads the dynamic library in runtime. need to embed in the main target
6371
string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();
6472
pbxProject.AddFileToEmbedFrameworks(mainTargetGuid, frameworkGuid);
73+
#endif // ORT_GENAI_ENABLED
6574

6675
pbxProject.WriteToFile(pbxProjectPath);
6776
#endif // UNITY_IOS
6877
}
78+
79+
static void CopyDirectory(string source, string dest)
80+
{
81+
if (Directory.Exists(dest) && !FileUtil.DeleteFileOrDirectory(dest))
82+
{
83+
throw new IOException($"Failed to delete directory '{dest}'.");
84+
}
85+
FileUtil.CopyFileOrDirectoryFollowSymlinks(source, dest);
86+
}
6987
}
7088
}

com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"precompiledReferences": [],
1212
"autoReferenced": true,
1313
"defineConstraints": [],
14-
"versionDefines": [],
14+
"versionDefines": [
15+
{
16+
"name": "com.github.asus4.onnxruntime-genai",
17+
"expression": "0.4.0",
18+
"define": "ORT_GENAI_ENABLED"
19+
}
20+
],
1521
"noEngineReferences": false
1622
}

com.github.asus4.onnxruntime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.github.asus4.onnxruntime",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"displayName": "ONNX Runtime",
55
"description": "ONNX Runtime Plugin for Unity",
66
"keywords": [

0 commit comments

Comments
 (0)