win 10 LTSC 搭建App Inventor 2 离线服务器

FsTy 提交于 周一, 04/06/2020 - 23:25

 复制命令运行出错,可能是空格被替换为 了。

1.下载安装

   chrome                    https://www.google.com/chrome/browser/desktop/index.html?system=true&standalone=1
   google-cloud-sdk   https://cloud.google.com/sdk/docs/quickstart-windows
                                               https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe
   openjdk 1.8             https://developers.redhat.com/products/openjdk/download 
                                              https://developers.redhat.com/download-manager/file/java-1.8.0-openjdk-1.8.0.242-3.b08.redhat.windows.x86_64.msi
    git                           https://git-scm.com/download/win
                                              https://github.com/git-for-windows/git/releases/download/v2.26.0.windows.1/Git-2.26.0-64-bit.exe
    ant                          https://ant.apache.org/bindownload.cgi
                                                https://downloads.apache.org//ant/binaries/apache-ant-1.10.7-bin.zip

    把ant的解压目录添加到系统path中.

    

 

验证一下:

ant -version
git --version
java -version
gcloud components list
gcloud components install  app-engine-java
gcloud components update

3.管理员cmd操作:

cd c:\
mkdir ai2
cd ai2
chcp 65001
set JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
git clone https://github.com/mit-cml/appinventor-sources.git
cd appinventor-sources
copy sample-.gitignore .gitignore
git submodule update --init
cd appinventor
ant MakeAuthKey
ant

4. 测试一下:

java_dev_appserver.cmd --port=8888 --address=0.0.0.0 --disable_update_check appengine/build/war/

          Ctrl +C  终止运行.

5.移动

move /y  "appinventor-sources\appinventor\buildserver\build\run\lib"  BuildServer
move /y "appinventor-sources\appinventor\appengine\build\war"  DevServer

6.Ai2Rundev.bat

@echo off ?
%1(start /min cmd.exe /c %0 :&exit)
chcp 65001
echo "Starting App Inventor 2 DevAppServer..."
title DevAppServer
cd %~dp0

SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"

for /f "tokens=1-5" %%i in ('netstat -ano^|findstr "8888"') do (
   echo kill the process %%m ?use the port 8888
   taskkill /F /T /pid %%m
)

java_dev_appserver.cmd --port=8888 --disable_update_check --address=0.0.0.0 DevServer

7.Ai2Runbud.bat

@echo off
%1(start /min cmd.exe /c %0 :&exit)
chcp 65001
echo "Starting App Inventor 2 BuildServer..."
title BuildServer
cd %~dp0

SET _JAVA_OPTIONS= -Xms64m -Xmx1024m
SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":9990"') do (
  echo kill the process %%m ?use the port 9990
  taskkill /F /T /pid %%m
)

cd BuildServer

java -cp "*" com.google.appinventor.buildserver.BuildServer

 

8.update.bat

@echo off

chcp 65001
SET JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
cd %~dp0

cd appinventor-sources
title git code
git reset --hard 
git pull
git submodule update --init

cd appinventor
title ant
call ant clean
call ant 
cd ../..

rem  pause

for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":9990"') do (
    echo kill the process %%m  use the port 9990
    taskkill /F /T /pid %%m
)

for /f "tokens=1-5" %%i in ('netstat -ano^|findstr "8888"') do (
    echo kill the process %%m  use the port 8888
    taskkill /F /T /pid %%m
)

xcopy /e /s /y "DevServer\WEB-INF\appengine-generated"  .\appengine-generated\

move /y  "appinventor-sources\appinventor\buildserver\build\run\lib"  BuildServer
move /y "appinventor-sources\appinventor\appengine\build\war"  DevServer

xcopy /e /s /y .\appengine-generated  "DevServer\WEB-INF\appengine-generated\"  

start Ai2Runbud.bat
start Ai2Rundev.bat