fix: [workaround] Avoid crash when build app with batchmode on command-line (#742)
* fix * workaround * export YAMATO_JOB_ID (cherry picked from commit cbdcf105ec97b79f2804e059c3fa164ec0d60cca)
This commit is contained in:
parent
0cfb5fad8b
commit
dbe91c7483
|
|
@ -4,6 +4,7 @@
|
|||
# python version is random on each VM
|
||||
export PATH=$PATH:/usr/local/bin:/Users/bokken/Library/Python/3.7/bin:/Users/bokken/Library/Python/3.8/bin
|
||||
export ARTIFACT_DIR=${PWD}/test-results
|
||||
export YAMATO_JOB_ID=${YAMATO_JOB_ID}
|
||||
|
||||
# TEST_TARGET = `ios` or `macos`
|
||||
# TEST_PLATFORM = `editmode` or `playmode` or `standalone`
|
||||
|
|
@ -93,4 +94,4 @@ else
|
|||
fi
|
||||
|
||||
# return exit-code
|
||||
exit $result
|
||||
exit $result
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# BOKKEN_DEVICE_IP:
|
||||
# TEMPLATE_FILE:
|
||||
# BOKKEN_DEVICE_IP:
|
||||
# TEMPLATE_FILE:
|
||||
# TEST_TARGET:
|
||||
# TEST_PLATFORM:
|
||||
# SCRIPTING_BACKEND:
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
# TEST_RESULT_DIR:
|
||||
# EDITOR_VERSION:
|
||||
#
|
||||
#
|
||||
#
|
||||
# brew install gettext
|
||||
#
|
||||
|
||||
|
|
@ -33,7 +33,8 @@ envsubst ' \
|
|||
$TEST_TARGET \
|
||||
$TEST_PLATFORM \
|
||||
$TEST_ARCHITECTURE \
|
||||
$EDITOR_VERSION' \
|
||||
$EDITOR_VERSION \
|
||||
$YAMATO_JOB_ID' \
|
||||
< ${TEMPLATE_FILE} \
|
||||
> ~/remote.sh
|
||||
chmod +x ~/remote.sh
|
||||
|
|
@ -49,7 +50,7 @@ then
|
|||
fi
|
||||
|
||||
# copy package to remote machine
|
||||
scp -i ${IDENTITY} -r ${YAMATO_SOURCE_DIR} bokken@${BOKKEN_DEVICE_IP}:~/${PACKAGE_DIR}
|
||||
scp -i ${IDENTITY} -r ${YAMATO_SOURCE_DIR} bokken@${BOKKEN_DEVICE_IP}:~/${PACKAGE_DIR}
|
||||
|
||||
set +e
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ set -e
|
|||
mkdir -p ${TEST_RESULT_DIR}
|
||||
scp -i ${IDENTITY} -r bokken@${BOKKEN_DEVICE_IP}:~/test-results ${TEST_RESULT_DIR}
|
||||
|
||||
# return ssh commend results
|
||||
# return ssh commend results
|
||||
if [ $result -ne 0 ]; then
|
||||
exit $result
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -45,10 +45,27 @@ namespace Unity.RenderStreaming
|
|||
[InitializeOnLoadMethod]
|
||||
static void InitializeOnEditor()
|
||||
{
|
||||
/// todo(kazuki):: This is workaround.
|
||||
/// When kicking the Unity Editor with batchmode flag on command line, The Unity Editor crashes
|
||||
/// caused by not unloading WebRTC native plugin. By this workaround, Some static methods of this
|
||||
/// package don't work correctly when batchmode. These static methods depend on WebRTC API,
|
||||
/// therefore the package initialization must be completed just after launching Editor.
|
||||
/// In the future, we will remove this workaround after improving the initialization of the
|
||||
/// WebRTC package.
|
||||
if(!IsYamato)
|
||||
{
|
||||
if (Application.isBatchMode)
|
||||
return;
|
||||
}
|
||||
RenderStreamingInternal.DomainUnload();
|
||||
RenderStreamingInternal.DomainLoad();
|
||||
EditorApplication.quitting += RenderStreamingInternal.DomainUnload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executed from the auto testing environment or not.
|
||||
/// </summary>
|
||||
static bool IsYamato => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("YAMATO_JOB_ID"));
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
static void InitializeOnRuntime()
|
||||
|
|
@ -59,19 +76,23 @@ namespace Unity.RenderStreaming
|
|||
}
|
||||
#endif
|
||||
|
||||
static Type GetType(string typeName) {
|
||||
static Type GetType(string typeName)
|
||||
{
|
||||
var type = Type.GetType(typeName);
|
||||
if (type != null) return type;
|
||||
foreach (var assembly in System.AppDomain.CurrentDomain.GetAssemblies()) {
|
||||
foreach (var assembly in System.AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
type = assembly.GetType(typeName);
|
||||
if (type != null) return type;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static ISignaling CreateSignaling(string type, string url, float interval, SynchronizationContext context) {
|
||||
static ISignaling CreateSignaling(string type, string url, float interval, SynchronizationContext context)
|
||||
{
|
||||
Type _type = GetType(type);
|
||||
if (_type == null) {
|
||||
if (_type == null)
|
||||
{
|
||||
throw new ArgumentException($"Signaling type is undefined. {type}");
|
||||
}
|
||||
object[] args = { url, interval, context };
|
||||
|
|
@ -83,7 +104,7 @@ namespace Unity.RenderStreaming
|
|||
if (!runOnAwake || m_running)
|
||||
return;
|
||||
|
||||
RTCConfiguration conf = new RTCConfiguration {iceServers = iceServers};
|
||||
RTCConfiguration conf = new RTCConfiguration { iceServers = iceServers };
|
||||
ISignaling signaling = CreateSignaling(
|
||||
signalingType, urlSignaling, interval, SynchronizationContext.Current);
|
||||
_Run(conf, signaling, handlers.ToArray());
|
||||
|
|
|
|||
Loading…
Reference in New Issue