Jenkins_Pipeline_Library/vars/execUnityMethod_Windows.groovy
2025-12-25 19:15:49 +08:00

31 lines
1.4 KiB
Groovy

//=================================================================
// Byway Studios Inc. Confidential Information.
// Copyright Byway Studios Inc. All rights reserved
//=================================================================
@groovy.transform.Field gUnityVersion_Windows = ""
def call(clearPackageCache,methodName)
{
if(gUnityVersion_Windows.isEmpty())
{
gUnityVersion_Windows = detectUnityVersion "${WORKSPACE}/ProjectSettings/ProjectVersion.txt"
}
// if (clearPackageCache || params.CLEAN)
// {
// bat label: 'Clearing Unity Cache', script: """
// if exist "${WORKSPACE}\\unity\\Library\\PackageCache" del /F /S /Q "${WORKSPACE}\\unity\\Library\\PackageCache"
// if exist "${WORKSPACE}\\unity\\Library\\ScriptAssemblies" del /F /S /Q "${WORKSPACE}\\unity\\Library\\ScriptAssemblies"
// if "%CLEAN%" == "true" (
// echo ">>> CLEAN ENABLED -- DELETING LIBRARY"
// del /S /Q "${WORKSPACE}\\unity\\Library"
// )
// """
// }
//open unity and execute unity method
bat label: "Executing Unity method: ${methodName}", script: """
set UNITY_PATH=C:\\Unity\\Editor\\${gUnityVersion_Windows}\\Editor\\Unity.exe
"%UNITY_PATH%" -quit -batchmode -nographics -projectPath "${WORKSPACE}" -executeMethod "${methodName}" -buildTarget Android -stackTraceLogType None -logFile -
"""
}