X Tutup
Skip to content

Commit 730b884

Browse files
author
Justin McPherson
committed
Changes for remote execution
1 parent 26ef157 commit 730b884

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

ReactUbuntu/runtime/src/reactnetexecutor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ ReactNetExecutor::ReactNetExecutor(QObject* parent)
1414
: ReactExecutor(parent)
1515
, m_socket(new QTcpSocket(this))
1616
{
17-
m_socket->connectToHost("localhost", 5000);
17+
QString serverHost = qgetenv("REACT_SERVER_HOST");
18+
if (serverHost.isEmpty())
19+
serverHost = "localhost";
20+
m_socket->connectToHost(serverHost, 5000);
1821
// connect(m_socket, SIGNAL(connected()), SLOT(connected()));
1922
// connect(m_socket, SIGNAL(disconnected()), SLOT(disconnected()));
2023
connect(m_socket, SIGNAL(readyRead()), SLOT(readReply()));
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
#!/bin/bash
22

3+
args=""
4+
ondevice=0
5+
6+
for arg in "$@"
7+
do
8+
if [ $arg == "--on-device" ]
9+
then
10+
ondevice=1
11+
else
12+
args=$args" $arg"
13+
fi
14+
done
15+
316
(node ${CMAKE_SOURCE_DIR}/../node_modules/react-native/ubuntu-server.js 2>&1 > /dev/null) &
4-
${CMAKE_BINARY_DIR}/bin/${APP_NAME} $*
17+
18+
if [[ $ondevice = 1 ]]
19+
then
20+
react_host=`hostname -I`
21+
adb push ${CMAKE_BINARY_DIR}/bin/${APP_NAME} /home/phablet
22+
# adb reverse --no-rebind tcp:8081 tcp:8081
23+
adb shell REACT_SERVER_HOST=$react_host /home/phablet/${APP_NAME} --host $react_host $args -- --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop
24+
else
25+
${CMAKE_BINARY_DIR}/bin/${APP_NAME} $args
26+
fi
527

0 commit comments

Comments
 (0)
X Tutup