first commit

This commit is contained in:
Chris
2025-03-12 14:22:16 -04:00
commit 0ad0c01249
1999 changed files with 189708 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
"""
The model of the config file that can optionally be added in the unity project directory.
The name of the file shall be 'hot-reload-config.json'
Example json contents:
{
"externalSolutions": [
"../src/Serialization/Serialization.sln",
"../src/WebSocket/WebSocket.sln"
],
"additionalSourceDirectories": [
"../src/SharedUtility",
"../src/UnitTestBoilerplate"
],
"projectBlacklist": [
"../src/UnitTests/UnitTests.csproj"
],
"polyfillSourceFiles": [
"Polyfills/CompilerSupport.cs",
"Polyfills/IndexRange.cs"
]
}
"""
input HotReloadConfig {
"""
The file paths to external solutions.
Paths shall be specified relative to the unity project path.
Consider the following example:
UnityProject
|_ UnityProject.sln
src
|_ ExternalSlnDir
|_ External.sln
here the path would be '../src/ExternalSlnDir/External.sln'
"""
externalSolutions: [String!]
"""
The file paths to additional source directories that are not already part of a solution folder or its sub folders.
Paths shall be specified relative to the unity project path.
Consider this example:
UnityProject
|_ UnityProject.sln
src
|_ ExternalSlnDir
|_ External.sln
|_ External.csproj <- uses Foo.cs
|_ SharedUtility
|_ Foo.cs
In such a case the path '../src/SharedUtility' needs to be specified as an additional source directory.
This is mainly to ensure that the file watcher listens to all c# files that are related to the unity project.
The Assets/ and Packages/ folders and all paths to local packages specified in the Packages/manifest.json are already covered.
"""
additionalSourceDirectories: [String!]
"""
The file paths to project files that Hot Reload should ignore.
This is only needed when you add additional project files to the unity project solution.
Paths shall be specified relative to the unity project path.
Consider this example:
UnityProject
|_ UnityProject.sln
src
|_ ExternalSlnDir
|_ External.sln
|_ UnitTests
|_ UnitTests.csproj
here the path would be '../src/ExternalSlnDir/UnitTests/UnitTests.csproj'
"""
projectBlacklist: [String!]
"""
The file paths to source files that should get added to all unity .csproj files.
Use this is you e.g. use a csc.rsp to include polyfill csharp files when compiling the script assemblies
Paths shall be specified relative to the unity project path.
Consider this example:
UnityProject
|_ UnityProject.sln
PolyFills
|_ IndexRange.cs
here the path would be 'PolyFills/IndexRange.cs'
"""
polyfillSourceFiles: [String!]
}
scalar String

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1860afd846d14904e8e3b2ef393b11a2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fdab353f2769bba47aa3bf92f09515c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
#!/bin/sh
set -e
CLIARGUMENTS_FILE=""
EXECUTABLESOURCEDIR=""
EXECUTABLETARGETDIR=""
TITLE=""
METHODPATCHDIR=""
PIDFILE=""
while [ "$1" != "" ]; do
case $1 in
-c | --cli-arguments-file )
shift
CLIARGUMENTS_FILE="$1"
;;
--executables-source-dir )
shift
EXECUTABLESOURCEDIR="$1"
;;
--executable-taget-dir )
shift
EXECUTABLETARGETDIR="$1"
;;
--title )
shift
TITLE="$1"
;;
--create-no-window )
shift
CREATENOWINDOW="$1"
;;
-p | --pidfile )
shift
PIDFILE="$1"
;;
-m | --method-patch-dir )
shift
METHODPATCHDIR="$1"
;;
esac
shift
done
if [ -z "/tmp/HotReloadTemp" ] || [ -z "$CLIARGUMENTS_FILE" ] || [ -z "$EXECUTABLESOURCEDIR" ] || [ -z "$EXECUTABLETARGETDIR" ] || [ -z "$TITLE" ] || [ -z "$PIDFILE" ] || [ -z "$METHODPATCHDIR" ] || [ -z "$CREATENOWINDOW" ]; then
echo "Missing arguments"
exit 1
fi
CLIARGUMENTS=$(cat "$CLIARGUMENTS_FILE")
rm "$CLIARGUMENTS_FILE"
# Needs be removed if you have multiple unities
pgrep CodePatcherCLI | xargs -I {} kill {}
rm -rf "$METHODPATCHDIR"
SERVER="$EXECUTABLETARGETDIR/CodePatcherCLI"
TERMINALRUNSCRIPT="$EXECUTABLESOURCEDIR/terminal-run.sh"
sed -i 's/\r//g' "$TERMINALRUNSCRIPT"
chmod +x "$TERMINALRUNSCRIPT"
chmod +x "$SERVER"
HAVETERMINAL=""
"$TERMINALRUNSCRIPT" && HAVETERMINAL="yes"
INTERNALSCRIPT="$EXECUTABLETARGETDIR/hotreload-internal-start"
# see doc/linux-system-freeze.org why I put the nice
cat << EOF > "$INTERNALSCRIPT"
#!/bin/sh
echo \$\$ > "$PIDFILE"
nice -n 5 "$SERVER" $CLIARGUMENTS || read
EOF
chmod +x "$INTERNALSCRIPT"
if [[ -n "$HAVETERMINAL" && "$CREATENOWINDOW" != "True" ]]; then
"$TERMINALRUNSCRIPT" "$TITLE" "$INTERNALSCRIPT"
else
printf "Don't have a terminal to run, printing to unity console instead. Consider hacking:\n%s\n" "$TERMINALRUNSCRIPT"
exec "$INTERNALSCRIPT"
fi

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 69a1a07fd70ddb97f9c75ee89579d1ea
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
#!/bin/bash
# Run a terminal with title and command
# User can already hack this file with their own terminal etc.
# I didn't check the other ones
# TODO: User can provide a "terminal-program" in the settings, say you can get inspired by Packages/CodePatcher/Server/linux-x64/terminal-run.sh
# the script is run with 2 args, a title and a command script to run.
# If called with 0 args, signal the capability to start a terminal.
# If you add your own terminal, make sure to also return 0 when called with 0 args.
TITLE="$1"
COMMAND="$2"
if [ -z "$1" ]; then
[ -x "$(command -v gnome-terminal)" ] && exit 0
[ -x "$(command -v xterm)" ] && exit 0
[ -x "$(command -v konsole)" ] && exit 0
[ -x "$(command -v terminator)" ] && exit 0
[ -x "$(command -v urxvt)" ] && exit 0
[ -x "$(command -v Alacritty)" ] && exit 0
exit 1
fi
if [ -x "$(command -v gnome-terminal)" ]; then
gnome-terminal --title="$TITLE" -- "$SHELL" -c "$COMMAND"
elif [ -x "$(command -v xterm)" ]; then
xterm -title "$TITLE" -e "$SHELL -c '$COMMAND'"
elif [ -x "$(command -v konsole)" ]; then
konsole --title "$TITLE" --noclose -e "$SHELL -c '$COMMAND'"
elif [ -x "$(command -v terminator)" ]; then
terminator --title="$TITLE" --command="$SHELL -c '$COMMAND'"
elif [ -x "$(command -v urxvt)" ]; then
urxvt -title "$TITLE" -e "$SHELL" -c "clear && $COMMAND"
elif [ -x "$(command -v Alacritty)" ]; then
alacritty -t "$TITLE" -e "$SHELL -c '$COMMAND'"
fi

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c3a7f96ba696eb649b581af931f26247
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: