Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 310fb4a

Browse files
Improving reliability of the package command and making sure variables don't leak outside the script scope
1 parent 8b331ed commit 310fb4a

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

package.cmd

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,33 @@ if not exist "%Unity%" (
3131
exit /b 1
3232
) else (
3333
cd unity\PackageProject\Assets
34-
git clean -xdf
34+
call git clean -xdf
3535
cd ..\..\..
3636

3737
cd src
38-
git clean -xdf
38+
call git clean -xdf
3939
cd ..
4040

41-
common\nuget.exe restore GitHub.Unity.sln
42-
xbuild GitHub.Unity.sln /property:Configuration=%Configuration%
41+
call common\nuget.exe restore GitHub.Unity.sln
42+
call xbuild GitHub.Unity.sln /property:Configuration=%Configuration%
4343

4444
del /Q unity/PackageProject/Assets/Editor/GitHub/deleteme*
4545
del /Q unity/PackageProject/Assets/Editor/GitHub/*.pdb
4646
del /Q unity/PackageProject/Assets/Editor/GitHub/*.pdb.meta
4747
del /Q unity/PackageProject/Assets/Editor/GitHub/*.xml
4848

49-
for /f tokens^=^2^ usebackq^ delims^=^" %%G in (`find "const string Version" common\SolutionInfo.cs`) do (
50-
set Version=%%G
51-
set GITHUB_UNITY_DISABLE=1
52-
"%Unity%" -batchmode -projectPath "%~dp0unity\PackageProject" -exportPackage Assets/Editor/GitHub github-for-unity-%Version%-alpha.unitypackage -force-free -quit
53-
)
54-
)
49+
for /f tokens^=^2^ usebackq^ delims^=^" %%G in (`find "const string Version" common\SolutionInfo.cs`) do call :Package %%G
50+
51+
goto End
52+
53+
:Package
54+
set Version=%1
55+
set GITHUB_UNITY_DISABLE=1
56+
echo "%Unity%" -batchmode -projectPath "%~dp0unity\PackageProject" -exportPackage Assets/Editor/GitHub github-for-unity-%Version%-alpha.unitypackage -force-free -quit
57+
call "%Unity%" -batchmode -projectPath "%~dp0unity\PackageProject" -exportPackage Assets/Editor/GitHub github-for-unity-%Version%-alpha.unitypackage -force-free -quit
58+
goto:eof
59+
60+
:End
61+
echo Completed
62+
)
63+
ENDLOCAL

0 commit comments

Comments
 (0)