Skip to content

Commit

Permalink
chore: add cli binaries (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed Aug 26, 2024
1 parent a712701 commit 24bd9c9
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 93 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Assets/Rivet/Editor/Native/*.dll filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/*.so filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/*.dylib filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/*.dylib filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/cli/rivet-linux filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/cli/rivet-windows.exe filter=lfs diff=lfs merge=lfs -text
Assets/Rivet/Editor/Native/cli/rivet-x86-apple filter=lfs diff=lfs merge=lfs -text
8 changes: 8 additions & 0 deletions Assets/Rivet/Editor/Native/cli.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple
Git LFS file not shown
7 changes: 7 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-linux
Git LFS file not shown
7 changes: 7 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-linux.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-windows.exe
Git LFS file not shown
7 changes: 7 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-windows.exe.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-x86-apple
Git LFS file not shown
7 changes: 7 additions & 0 deletions Assets/Rivet/Editor/Native/cli/rivet-x86-apple.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

This file was deleted.

Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
28 changes: 24 additions & 4 deletions Assets/Rivet/Editor/Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,29 @@ private Result<JObject> RunTask(string name, JObject input, JObject runConfig)
// TODO: Remove this
public static string GetRivetCLIPath()
{
// TODO: Update this path as needed
// return "/Users/nathan/rivet/cli/target/debug/rivet-cli";
return "/Users/nathan/rivet/cli/target/debug/rivet";
if (Application.platform == RuntimePlatform.WindowsEditor)
{
return "Assets/Rivet/Editor/Native/cli/rivet-windows.exe";
}
else if (Application.platform == RuntimePlatform.OSXEditor)
{
if (SystemInfo.processorType.Contains("Apple"))
{
return "Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple";
}
else
{
return "Assets/Rivet/Editor/Native/cli/rivet-x86-apple";
}
}
else if (Application.platform == RuntimePlatform.LinuxEditor)
{
return "Assets/Rivet/Editor/Native/cli/rivet-linux";
}
else
{
throw new Exception("Unsupported platform");
}
}

// private static Result<JObject> RunRivetCLI(params string[] args)
Expand Down Expand Up @@ -326,4 +346,4 @@ private void CleanupTempFiles()
}
}
}
}
}
2 changes: 1 addition & 1 deletion Assets/Rivet/Editor/UI/RivetPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void CreateGUI()
// Bind links
var links = rootVisualElement.Q(name: "Header").Q(name: "Links");
links.Q(name: "DashboardButton").RegisterCallback<ClickEvent>((ev) => Application.OpenURL("https://hub.rivet.gg"));
rootVisualElement.Q(className: "docsButton").RegisterCallback<ClickEvent>((ev) => Application.OpenURL("https://rivet.gg/docs/unity"));
rootVisualElement.Q(className: "docsButton").RegisterCallback<ClickEvent>((ev) => Application.OpenURL("https://rivet.gg/learn/unity"));
rootVisualElement.Q(className: "discordButton").RegisterCallback<ClickEvent>((ev) => Application.OpenURL("https://rivet.gg/discord"));
rootVisualElement.Q(className: "feedbackButton").RegisterCallback<ClickEvent>((ev) => Application.OpenURL("https://hub.rivet.gg/?modal=feedback&utm=unity"));

Expand Down
14 changes: 8 additions & 6 deletions Assets/Rivet/Editor/UI/Tabs/DevelopController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,14 @@ private void OnPlayerStart()

private void OnBackendGenerateSDK()
{
TaskPopupWindow.RunTask("Generate SDK", "backend_sdk_gen", new JObject
{
["cwd"] = Builder.ProjectRoot(),
["fallback_sdk_path"] = "Assets/Backend",
["target"] = "unity",
});
// TaskPopupWindow.RunTask("Generate SDK", "backend_sdk_gen", new JObject
// {
// ["cwd"] = Builder.ProjectRoot(),
// ["fallback_sdk_path"] = "Assets/Backend",
// ["target"] = "unity",
// });

EditorUtility.DisplayDialog("Generate SDK Disabled", "Generate SDK temporarily disabled. Contact support for further questions.", "OK");
}

private void OnBackendEditConfig()
Expand Down
2 changes: 1 addition & 1 deletion Assets/Rivet/Editor/UI/Tabs/Setup.uxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<ui:Label tabindex="-1" text="Step 1: Create Game &amp; Backend Configs" parse-escape-sequences="true" display-tooltip-when-elided="true" style="flex-grow: 1; flex-shrink: 1;" />
<ui:Button text="Setup" parse-escape-sequences="true" display-tooltip-when-elided="true" />
</ui:VisualElement>
<ui:Label tabindex="-1" text="WIP" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" text="Please see &lt;a href=&quot;https://rivet.gg/learn/unity&quot;&gt;Quickstart Guide&lt;/a&gt; to get setarted\n\nSetup wizard coming soon" parse-escape-sequences="true" display-tooltip-when-elided="true" />
</ui:UXML>
8 changes: 0 additions & 8 deletions backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
]
}
},
"registries": {
"default": {
"local": {
"directory": "/Users/nathan/rivet/opengb-modules/modules"
}
}
},
"modules": {
"users": {},
"rate_limit": {},
"tokens": {},
"lobbies": {
Expand Down
10 changes: 9 additions & 1 deletion scripts/copy_ffi.sh → scripts/copy_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ set -euf
# Linux (x86_64)
rm -rf ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_linux_x86_64.so
cp -r $CLI_REPO_PATH/target/x86_64-unknown-linux-gnu/release/librivet_toolchain_ffi.so ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_linux_x86_64.so
rm -rf ./Assets/Rivet/Editor/Native/cli/rivet-linux
cp -r $CLI_REPO_PATH/target/x86_64-unknown-linux-gnu/release/rivet ./Assets/Rivet/Editor/Native/cli/rivet-linux

# Windows (x86_64)
rm -rf ./Assets/Rivet/Editor/Native/rivet_toolchain_ffi_windows_x86_64.dll
cp -r $CLI_REPO_PATH/target/x86_64-pc-windows-gnu/release/rivet_toolchain_ffi.dll ./Assets/Rivet/Editor/Native/rivet_toolchain_ffi_windows_x86_64.dll
rm -rf ./Assets/Rivet/Editor/Native/cli/rivet-windows.exe
cp -r $CLI_REPO_PATH/target/x86_64-pc-windows-gnu/release/rivet.exe ./Assets/Rivet/Editor/Native/cli/rivet-windows.exe

# macOS (x86_64)
rm -rf ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_x86_64.dylib
cp -r $CLI_REPO_PATH/target/x86_64-apple-darwin/release/librivet_toolchain_ffi.dylib ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_x86_64.dylib
rm -rf ./Assets/Rivet/Editor/Native/cli/rivet-x86-apple
cp -r $CLI_REPO_PATH/target/x86_64-apple-darwin/release/rivet ./Assets/Rivet/Editor/Native/cli/rivet-x86-apple

# macOS (ARM64)
rm -rf ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_arm64.dylib
cp -r $CLI_REPO_PATH/target/aarch64-apple-darwin/release/librivet_toolchain_ffi.dylib ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_arm64.dylib
cp -r $CLI_REPO_PATH/target/aarch64-apple-darwin/release/librivet_toolchain_ffi.dylib ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_arm64.dylib
rm -rf ./Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple
cp -r $CLI_REPO_PATH/target/aarch64-apple-darwin/release/rivet ./Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple
13 changes: 13 additions & 0 deletions scripts/copy_native_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -euf

echo "TODO: Currently only supports macOS ARM64"

# Build client
(cd $CLI_REPO_PATH && cargo build)

# macOS (ARM64)
rm -rf ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_arm64.dylib
cp -r $CLI_REPO_PATH/target/debug/librivet_toolchain_ffi.dylib ./Assets/Rivet/Editor/Native/librivet_toolchain_ffi_macos_arm64.dylib
rm -rf ./Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple
cp -r $CLI_REPO_PATH/target/debug/rivet ./Assets/Rivet/Editor/Native/cli/rivet-aarch64-apple

0 comments on commit 24bd9c9

Please sign in to comment.