Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed debug script #702

Merged
merged 12 commits into from
Nov 6, 2023
29 changes: 21 additions & 8 deletions scripts/debug-publish-to-unity-package.bat
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
@ECHO OFF


SET SCRIPT_DIR=%~dp0

echo Building project...
pushd src/ChainSafe.Gaming.Unity
pushd "%SCRIPT_DIR%\..\src\ChainSafe.Gaming.Unity"

del obj /F /Q
del bin /F /Q
dotnet restore
dotnet publish -c debug -f netstandard2.1 /property:Unity=true
if %errorlevel% neq 0 exit /b %errorlevel%

echo Restoring non-Unity packages...

pushd ..\..
dotnet restore
popd

echo Moving files to Unity package...

pushd bin\debug\netstandard2.1\publish
del Newtonsoft.Json.dll
del UnityEngine.dll

if exist "..\..\..\..\..\..\Packages\io.chainsafe.web3-unity.lootboxes" (
echo Directory exists, performing actions...
rmdir /s /q "..\..\..\..\..\..\Packages\io.chainsafe.web3-unity.lootboxes\Chainlink\Runtime\Libraries"
mkdir "..\..\..\..\..\..\Packages\io.chainsafe.web3-unity.lootboxes\Chainlink\Runtime\Libraries"
copy Chainsafe.Gaming.Chainlink.dll "..\..\..\..\..\..\Packages\io.chainsafe.web3-unity.lootboxes\Chainlink\Runtime\Libraries"
copy Chainsafe.Gaming.LootBoxes.Chainlink.dll "..\..\..\..\..\..\Packages\io.chainsafe.web3-unity.lootboxes\Chainlink\Runtime\Libraries"
) else (
echo Directory does not exist, skipping actions.
)

del Chainsafe.Gaming.Chainlink.dll
del Chainsafe.Gaming.LootBoxes.Chainlink.dll

del Microsoft.CSharp.dll
if not exist ..\..\..\..\..\..\Packages\io.chainsafe.web3-unity\Runtime\Libraries mkdir ..\..\..\..\..\..\Packages\io.chainsafe.web3-unity\Runtime\Libraries\
del ..\..\..\..\..\..\Packages\io.chainsafe.web3-unity\Runtime\Libraries\* /F /Q
copy *.dll ..\..\..\..\..\..\Packages\io.chainsafe.web3-unity\Runtime\Libraries
copy *.pdb ..\..\..\..\..\..\Packages\io.chainsafe.web3-unity\Runtime\Libraries
RyRy79261 marked this conversation as resolved.
Show resolved Hide resolved

RyRy79261 marked this conversation as resolved.
Show resolved Hide resolved
popd
popd
echo Done

echo Done
24 changes: 18 additions & 6 deletions scripts/debug-publish-to-unity-package.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#! /usr/bin/env sh

set -e

echo Building project...
scripts_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

pushd "$scripts_dir"/../src/ChainSafe.Gaming.Unity

rm -rf obj
Expand All @@ -12,19 +12,31 @@ dotnet publish -c debug -f netstandard2.1 /property:Unity=true

echo Restoring non-Unity packages...

pushd ../..
dotnet restore
popd

echo Moving files to Unity package...

cd bin/debug/netstandard2.1/publish
pushd bin/debug/netstandard2.1/publish
rm Newtonsoft.Json.dll
rm UnityEngine.dll

# Check if io.chainsafe.web3-unity.lootboxes directory exists
if [ -d "../../../../../../Packages/io.chainsafe.web3-unity.lootboxes" ]; then
rm -rf ../../../../../../Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries
mkdir -p ../../../../../../Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries
cp Chainsafe.Gaming.Chainlink.dll ../../../../../../Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries
cp Chainsafe.Gaming.LootBoxes.Chainlink.dll ../../../../../../Packages/io.chainsafe.web3-unity.lootboxes/Chainlink/Runtime/Libraries
fi

# Delete those DLLs so they don't get copied in the next step
rm Chainsafe.Gaming.Chainlink.dll
rm Chainsafe.Gaming.LootBoxes.Chainlink.dll

rm Microsoft.CSharp.dll
rm -rf ../../../../../../Packages/io.chainsafe.web3-unity/Runtime/Libraries
mkdir -p ../../../../../../Packages/io.chainsafe.web3-unity/Runtime/Libraries
rm -f ../../../../../../Packages/io.chainsafe.web3-unity/Runtime/Libraries/*
cp *.dll ../../../../../../Packages/io.chainsafe.web3-unity/Runtime/Libraries
cp *.pdb ../../../../../../Packages/io.chainsafe.web3-unity/Runtime/Libraries

popd
popd
echo Done
Loading