Skip to content

Update make tools: add help , support windows#667

Merged
JiepengTan merged 1 commit intogoplus:devfrom
JiepengTan:pr_fix_windows_tool_chain
May 26, 2025
Merged

Update make tools: add help , support windows#667
JiepengTan merged 1 commit intogoplus:devfrom
JiepengTan:pr_fix_windows_tool_chain

Conversation

@JiepengTan
Copy link
Copy Markdown
Contributor

@JiepengTan JiepengTan commented May 23, 2025

make tools support windows platform

Utility Commands:
  init        - Initialize the user environment
  initdev     - Initialize the development environment
  download    - Download engines
  cmd         - Install spx command
  wasm        - Install spx command and build wasm
  wasmopt     - Install spx command and build wasm with optimization
  fmt         - Format code
  gen         - Generate code

Build Commands:
  pce         - Build current platform's engine (editor mode)
  pc          - Build current platform's engine template
  web         - Build web engine template
  android     - Build Android engine template
  ios         - Build iOS engine template

Export Commands:
  exportpack  - Export runtime engine pck file
  exportweb   - Export web engine for xbuilder

Run Commands:
  run         - Run demo on PC (default: tutorial/01-Weather)
  rune        - Run demo on PC editor mode (default: tutorial/01-Weather)
  runweb      - Run demo on web (default: tutorial/01-Weather)
  runtest     - Run tests

Usage Examples:
  make pc                      - Build for current platform
  make run path=demos/demo1    - Run specific demo on PC (default: tutorial/01-Weather)
  make runweb path=demos/demo1 - Run specific demo on web (default: tutorial/01-Weather)
  make runtest                 - Run tests

@JiepengTan JiepengTan requested a review from nighca May 23, 2025 07:50
spx exportweb
cd ./project/.builds/web
rm -f game.zip
zip -r "$CURRENT_PATH/spx_web.zip" *
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Use ./glob or -- glob so names with dashes won't become options. [SC2035]

Details

lint 解释

这个lint结果提示你使用 ./*glob*-- *glob* 来匹配文件名,这样可以避免包含连字符的文件名被误认为是命令行选项。

错误用法

ls *.txt

在这个例子中,如果当前目录下有一个名为 file-name.txt 的文件,使用 ls *.txt 会导致 file-name.txt 被误解为一个选项而不是文件名。

正确用法

ls ./*.txt

或者

ls -- *.txt

这两种方式都可以确保包含连字符的文件名被正确识别为文件名,而不是命令行选项。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

}

# Execute the exportpack commands
cd "$CURRENT_PATH/.tmp/web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. [SC2164]

Details

lint 解释

这个lint结果表明在脚本中使用了cd ...命令,但没有处理可能的失败情况。如果cd命令执行失败,脚本将继续执行后续的代码,这可能会导致意外的行为。

错误用法

cd /path/to/directory
# 如果 cd 失败,脚本会继续执行
echo "Directory changed"

正确用法

cd /path/to/directory || exit 1
# 或者
cd /path/to/directory || return 1
# 如果 cd 失败,脚本会退出或返回错误码
echo "Directory changed"

💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

# Define a function for the exportpack functionality
do_extra_webtemplate() {
do_prepare_export
dstdir="$GOPATH/bin/gdspxrt"$TEMP_VERSION"_web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: The surrounding quotes actually unquote this. Remove or escape them. [SC2027]

Details

lint 解释

这个lint结果表明在脚本中使用了反引号(`)来执行命令,但周围的引号导致反引号内的内容被解释为普通字符串而不是命令。这通常是因为反引号和引号的嵌套使用不当。

错误用法

echo "The current date is `date`"

在这个例子中,反引号内的date命令被错误地解释为普通字符串,而不是执行日期命令并输出结果。

正确用法

echo "The current date is $(date)"

在这个例子中,使用了$(...)语法来正确地嵌套命令和引号。这样,date命令会被执行,并且其输出会被插入到字符串中。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

@@ -261,7 +261,35 @@ ensure_emsdk() {
if [[ "$(uname -o 2>/dev/null)" == "Msys" ]] || [[ "$(uname -o 2>/dev/null)" == "Cygwin" ]]; then
# Windows
source ./emsdk_env.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Not following: ./emsdk_env.sh was not specified as input (see shellcheck -x). [SC1091]

Details

lint 解释

这个lint结果表明在脚本中引用了./emsdk_env.sh文件,但该文件没有被指定为输入。ShellCheck工具(shellcheck)通过-x选项来检查脚本的执行情况,并且会提示未指定的输入文件。

错误用法

source ./emsdk_env.sh

在这个示例中,./emsdk_env.sh被引用但没有被指定为输入。

正确用法

要解决这个问题,可以使用ShellCheck提供的-x选项来指定输入文件。例如:

shellcheck -x ./emsdk_env.sh

这样,ShellCheck会检查./emsdk_env.sh文件的执行情况,并提供相应的lint结果。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

fi
else
# Linux and macOS
source ./emsdk_env.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Not following: ./emsdk_env.sh was not specified as input (see shellcheck -x). [SC1091]

Details

lint 解释

这个lint结果表明在脚本中引用了./emsdk_env.sh文件,但该文件没有被指定为输入。ShellCheck工具(shellcheck)通过-x选项来检查脚本的执行情况,并且会提示未指定的输入文件。

错误用法

source ./emsdk_env.sh

在这个示例中,./emsdk_env.sh被引用但没有被指定为输入。

正确用法

要解决这个问题,可以使用ShellCheck提供的-x选项来指定输入文件。例如:

shellcheck -x ./emsdk_env.sh

这样,ShellCheck会检查./emsdk_env.sh文件的执行情况,并提供相应的lint结果。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

spx exportweb
cd ./project/.builds/web
rm -f game.zip
zip -r "$PROJ_DIR/spx_web.zip" *
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Use ./glob or -- glob so names with dashes won't become options. [SC2035]

Details

lint 解释

这个lint结果提示你使用 ./*glob*-- *glob* 来匹配文件名,这样可以避免包含连字符的文件名被误认为是命令行选项。

错误用法

ls *.txt

在这个例子中,如果当前目录下有一个名为 file-name.txt 的文件,使用 ls *.txt 会导致 file-name.txt 被误解为一个命令行选项,而不是一个文件名。

正确用法

ls ./*.txt

或者

ls -- *.txt

这两种方式都可以确保包含连字符的文件名被正确识别为文件名,而不是命令行选项。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

}

# Execute the exportpack commands
cd "$PROJ_DIR/.tmp/web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. [SC2164]

Details

lint 解释

这个lint结果表明在脚本中使用了cd ...命令,但没有处理可能的失败情况。如果cd命令执行失败,脚本将继续执行后续的命令,这可能会导致意外的行为。

错误用法

cd /path/to/directory
# 如果 cd 失败,脚本会继续执行
echo "Directory changed"

正确用法

cd /path/to/directory || exit 1
# 或者
cd /path/to/directory || return 1
# 如果 cd 失败,脚本会退出或返回错误码
echo "Directory changed"

💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流


echo "exporting web runtime..."
spx exportwebruntime
dstdir="$GOPATH/bin/gdspxrt"$TEMP_VERSION"_web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: The surrounding quotes actually unquote this. Remove or escape them. [SC2027]

Details

lint 解释

这个lint结果表明在脚本中使用了反引号(`)来执行命令,但反引号内部的字符串被错误地用双引号或单引号包围。这会导致反引号无法正确解析内部的变量或命令。

错误用法

result=`echo "Hello, $USER"`

在这个例子中,$USER 被错误地用双引号包围,导致反引号无法正确解析 $USER 变量。

正确用法

result=$(echo "Hello, $USER")

在这个例子中,使用了 $() 语法来执行命令,这样可以正确解析内部的变量。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

@JiepengTan JiepengTan force-pushed the pr_fix_windows_tool_chain branch from 3f424c2 to 8283ba2 Compare May 23, 2025 09:05
@JiepengTan JiepengTan force-pushed the pr_fix_windows_tool_chain branch from 8283ba2 to f0bdf9f Compare May 26, 2025 01:56
@JiepengTan JiepengTan merged commit 4228a33 into goplus:dev May 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants