update: snap

This commit is contained in:
msojocs 2022-04-21 12:18:09 +08:00
parent 2734615ac2
commit 8e10e3ddab
6 changed files with 112 additions and 52 deletions

View File

@ -23,7 +23,15 @@ APP_NAME=${APP_NAME//\",\"main/}
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs" export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
export APPDATA="$DATA_DIR/$APP_NAME" export APPDATA="$DATA_DIR/$APP_NAME"
export PATH="$root_dir/node/bin:$root_dir/nwjs:$PATH" export PATH="$root_dir/node/bin:$root_dir/nwjs:$PATH"
export USERPROFILE=$DATA_DIR export USERPROFILE=$APPDATA
# SNAP
# if [ -n $SNAP ];then
# if [ ! -f $DATA_DIR/nacl_irt_x86_64.nexe ];then
# # 解压
# tar -zxf $root_dir/nwjs/nacl_irt_x86_64.nexe.tar.gz -C $APPDATA/nacl_irt_x86_64.nexe
# fi
# fi
clean_cache() { clean_cache() {
echo "清理缓存"; echo "清理缓存";

3
docs/snap.md Normal file
View File

@ -0,0 +1,3 @@
## 需要额外审查的接口
block-devices

View File

@ -1,3 +1,11 @@
[Desktop Entry] [Desktop Entry]
Name=WeChat Dev Tools Name=WeChat Dev Tools
Exec=env APPDATA=${SNAP_USER_DATA} USERPROFILE=~ ${SNAP}/nw --load-extension=${SNAP}/package.nw/js/ideplugin --custom-devtools-frontend=file://${SNAP}/package.nw/js/ideplugin/inspector %U Name[zh_CN]=
Comment=The development tools for wechat projects
Comment[zh_CN]=IDE
Categories=Development;WebDevelopment;IDE;
Exec=wechat-devtools %U
Icon=${SNAP}/meta/gui/wechat-devtools.png
Type=Application
Terminal=false
MimeType=x-scheme-handler/wechatide

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

View File

@ -1,6 +1,6 @@
name: wechat-devtools # you probably want to 'snapcraft register <name>' name: wechat-devtools # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap base: core18 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' version: '1.05.2203070-9' # just for humans, typically '1.2+git' or '1.3.2'
summary: WeChat Devtools for Linux # 79 char long summary summary: WeChat Devtools for Linux # 79 char long summary
description: | description: |
WeChat Devtools for Linux. WeChat Devtools for Linux.
@ -19,28 +19,34 @@ architectures:
# snap # snap
# /root/parts/my-part/src/nw # /root/parts/my-part/src/nw
parts: parts:
# compiler:
# plugin: nil
# source: https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.6/compiler.tar.xz
node-js: node-js:
plugin: dump plugin: dump
source: https://npmmirror.com/mirrors/node/v16.4.2/node-v16.4.2-linux-x64.tar.gz source: https://npmmirror.com/mirrors/node/v16.4.2/node-v16.4.2-linux-x64.tar.gz
# source: './cache/node-v16.4.2-linux-x64.tar.gz' # source: cache/node-v16.4.2-linux-x64.tar.gz
organize: organize:
"*": nodejs/ "*": node/
stage: override-build: |
- nodejs/* mkdir -p $SNAPCRAFT_STAGE/node
cp -r * $SNAPCRAFT_STAGE/node
devtools: ls -l
ls -l $SNAPCRAFT_PART_INSTALL
package-nw:
plugin: dump plugin: dump
source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203070&version_type=1 source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203070&version_type=1
# source: ./cache/wechat_devtools_1.05.2201240_x64.exe # source: cache/wechat_devtools_1.05.2203070_x64.exe
source-type: 7z source-type: 7z
source-subdir: ./code source-subdir: code
override-build: |
chmod -R 755 code/package.nw
cp -r code/package.nw $SNAPCRAFT_STAGE
# after 会执行到stage
build-node:
plugin: nil
build-environment: build-environment:
- PATH: "$SNAPCRAFT_STAGE/nodejs/bin:$PATH" - PATH: "$SNAPCRAFT_STAGE/node/bin:$PATH"
- NW_VERSION: 0.55.0 - NW_VERSION: 0.55.0
- NO_WINE: 'true'
# - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw" # - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw"
# - srcdir: "$SNAPCRAFT_PROJECT_DIR" # - srcdir: "$SNAPCRAFT_PROJECT_DIR"
build-packages: build-packages:
@ -53,71 +59,104 @@ parts:
- make - make
- openssl - openssl
- libssh2-1-dev - libssh2-1-dev
override-pull: |
ls -l
override-build: | override-build: |
env env
echo "3" echo "=============3============"
ls -l $SNAPCRAFT_STAGE ls -l $SNAPCRAFT_PART_SRC
ls -l $SNAPCRAFT_PART_BUILD
ls -l $SNAPCRAFT_PART_INSTALL
ls -l $SNAPCRAFT_PRIME
ls -l $SNAPCRAFT_PROJECT_DIR ls -l $SNAPCRAFT_PROJECT_DIR
ls -l $SNAPCRAFT_STAGE
ls -l
# 准备文件
cp -r $SNAPCRAFT_STAGE/package.nw package.nw
chmod -R 755 package.nw
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" tools
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" compiler
# 执行构建脚本 # 执行构建脚本
chmod -R 755 $SNAPCRAFT_PART_BUILD/code/package.nw
npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org
node-gyp install --registry=https://registry.npm.taobao.org node-gyp install --registry=https://registry.npm.taobao.org
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" "$SNAPCRAFT_PART_BUILD/code/tools"
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" "$SNAPCRAFT_PART_BUILD/code/compiler"
for script in fix-package-name.js fix-cli.sh fix-core.sh fix-other.sh; do for script in fix-package-name.js fix-cli.sh fix-core.sh fix-other.sh; do
echo -e "\e[1;34mrun ${script}\e[0m" echo -e "\e[1;34mrun ${script}\e[0m"
"${SNAPCRAFT_PART_BUILD}/code/tools/${script}" tools/${script}
done done
# 构建模块 # 构建模块
"${SNAPCRAFT_PART_BUILD}/code/tools/rebuild-node-modules.sh" $NW_VERSION tools/rebuild-node-modules.sh $NW_VERSION
rm -rf "${SNAPCRAFT_PART_BUILD}/code/tools" rm -rf tools
cp -r package.nw $SNAPCRAFT_PART_INSTALL
snapcraftctl build chmod -R 755 $SNAPCRAFT_PART_INSTALL/package.nw
stage-packages: stage-packages:
- libxkbfile1 - libxkbfile1
- git-core - git-core
override-prime: | - libssh2-1-dev
snapcraftctl prime
rm -rf node node.exe
cp "$SNAPCRAFT_PRIME/nodejs/bin/node" "$SNAPCRAFT_PRIME/node"
ln -s "node" "node.exe"
after: after:
- node-js - node-js
# - compiler - package-nw
# - desktop-gnome-platform # - desktop-gnome-platform
nw-js: nw-js:
plugin: dump plugin: dump
source: https://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz source: https://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz
# source: ./cache/nwjs-sdk-v0.55.0-linux-x64.tar.gz # source: ./cache/nwjs-sdk-v0.55.0-linux-x64.tar.gz
organize:
"*": nwjs/
stage-packages: stage-packages:
- libnss3 - libnss3
- libnspr4 - libnspr4
override-pull: |
ls -l
ls -l $SNAPCRAFT_PART_SRC
ls -l $SNAPCRAFT_PART_BUILD
snapcraftctl pull
ls -l
ls -l $SNAPCRAFT_PART_SRC
ls -l $SNAPCRAFT_PART_BUILD
rm -rf nacl_irt_x86_64.nexe
# chmod 644 nacl_irt_x86_64.nexe
# tar -zcf nacl_irt_x86_64.nexe.tar.gz nacl_irt_x86_64.nexe
# ln -s $SNAP/nacl_irt_x86_64.nexe nacl_irt_x86_64.nexe
ls -l
ls -l $SNAPCRAFT_PART_SRC
ls -l $SNAPCRAFT_PART_BUILD
ls -l $SNAPCRAFT_PART_INSTALL
ls -l $SNAPCRAFT_STAGE
override-build: |
ls -l
rm -rf $SNAPCRAFT_PART_INSTALL/nwjs/node $SNAPCRAFT_PART_INSTALL/nwjs/node.exe
install -Dm755 $SNAPCRAFT_STAGE/node/bin/node $SNAPCRAFT_PART_INSTALL/nwjs/node
cd $SNAPCRAFT_PART_INSTALL/nwjs && ln -s node node.exe
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
snapcraftctl build
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
after:
- build-node
run-script: run-script:
plugin: nil plugin: nil
override-build: | override-build: |
snapcraftctl build snapcraftctl build
cp "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-snap" "$SNAPCRAFT_PART_INSTALL/wechat-devtools-snap" ls
stage: install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools"
- wechat-devtools-snap install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-cli" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools-cli"
zzz: stage:
plugin: nil - bin/wechat-devtools
# source: https://npmmirror.com/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz - bin/wechat-devtools-cli
override-stage: | - usr/*
echo "6"
env
ls -l $SNAPCRAFT_STAGE
apps: apps:
wechat-devtools: wechat-devtools:
# autostart: wechat-devtools.desktop # autostart: wechat-devtools.desktop
command: desktop-launch $SNAP/wechat-devtools-snap command: bin/wechat-devtools
environment: environment:
WECHAT_DEVTOOLS_DIR: $SNAP/nwjs WECHAT_DEVTOOLS_DIR: $SNAP/nwjs
APPDATA: "$SNAP_USER_DATA/wechat_devtools" APPDATA: "$SNAP_USER_DATA/wechat_devtools"
@ -132,13 +171,18 @@ apps:
- desktop-legacy - desktop-legacy
- opengl - opengl
- mount-observe - mount-observe
- adb-support
- x11 - x11
- wayland - wayland
- network - network
- network-bind - network-bind
- gsettings - gsettings
- browser-support - browser-support
- password-manager-service - home
- system-observe
- removable-media
- udisks2
- unity7
plugs: plugs:
gtk-3-themes: gtk-3-themes:
@ -153,7 +197,3 @@ plugs:
interface: content interface: content
target: $SNAP/data-dir/sounds target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes default-provider: gtk-common-themes
# platform_snap:
# interface: content
# target: $SNAP/gnome-platform
# default-provider: gnome-3-34-1804

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd "/mnt/disk1/GitHub/wechat-devtools-linux" root_dir=$(cd `dirname $0`/.. && pwd -P)
snapcraft #--http-proxy="http://192.168.249.236:7890" --https-proxy="http://192.168.249.236:7890" cd $root_dir
snap install wechat-devtools_0.1_amd64.snap --devmode snapcraft #--http-proxy="http://192.168.1.232:7890" --https-proxy="http://192.168.1.232:7890"
wechat-devtools snap install wechat-devtools_*_amd64.snap --devmode
# snap run wechat-devtools