Skip to content

Commit 8e10e3d

Browse files
committed
update: snap
1 parent 2734615 commit 8e10e3d

File tree

6 files changed

+112
-52
lines changed

6 files changed

+112
-52
lines changed

bin/wechat-devtools

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ APP_NAME=${APP_NAME//\",\"main/}
2323
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
2424
export APPDATA="$DATA_DIR/$APP_NAME"
2525
export PATH="$root_dir/node/bin:$root_dir/nwjs:$PATH"
26-
export USERPROFILE=$DATA_DIR
26+
export USERPROFILE=$APPDATA
27+
28+
# SNAP
29+
# if [ -n $SNAP ];then
30+
# if [ ! -f $DATA_DIR/nacl_irt_x86_64.nexe ];then
31+
# # 解压
32+
# tar -zxf $root_dir/nwjs/nacl_irt_x86_64.nexe.tar.gz -C $APPDATA/nacl_irt_x86_64.nexe
33+
# fi
34+
# fi
2735

2836
clean_cache() {
2937
echo "清理缓存";

docs/snap.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 需要额外审查的接口
2+
3+
block-devices

snap/gui/wechat-devtools.desktop

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
[Desktop Entry]
22
Name=WeChat Dev Tools
3-
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
3+
Name[zh_CN]=微信开发者工具
4+
Comment=The development tools for wechat projects
5+
Comment[zh_CN]=提供微信开发相关项目的开发IDE支持
6+
Categories=Development;WebDevelopment;IDE;
7+
Exec=wechat-devtools %U
8+
Icon=${SNAP}/meta/gui/wechat-devtools.png
9+
Type=Application
10+
Terminal=false
11+
MimeType=x-scheme-handler/wechatide

snap/gui/wechat-devtools.png

342 KB
Loading

snap/snapcraft.yaml

Lines changed: 86 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wechat-devtools # you probably want to 'snapcraft register <name>'
22
base: core18 # the base snap is the execution environment for this snap
3-
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
3+
version: '1.05.2203070-9' # just for humans, typically '1.2+git' or '1.3.2'
44
summary: WeChat Devtools for Linux # 79 char long summary
55
description: |
66
WeChat Devtools for Linux.
@@ -19,28 +19,34 @@ architectures:
1919
# snap
2020
# /root/parts/my-part/src/nw
2121
parts:
22-
# compiler:
23-
# plugin: nil
24-
# source: https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.6/compiler.tar.xz
25-
2622
node-js:
2723
plugin: dump
2824
source: https://npmmirror.com/mirrors/node/v16.4.2/node-v16.4.2-linux-x64.tar.gz
29-
# source: './cache/node-v16.4.2-linux-x64.tar.gz'
25+
# source: cache/node-v16.4.2-linux-x64.tar.gz
3026
organize:
31-
"*": nodejs/
32-
stage:
33-
- nodejs/*
34-
35-
devtools:
27+
"*": node/
28+
override-build: |
29+
mkdir -p $SNAPCRAFT_STAGE/node
30+
cp -r * $SNAPCRAFT_STAGE/node
31+
ls -l
32+
ls -l $SNAPCRAFT_PART_INSTALL
33+
package-nw:
3634
plugin: dump
3735
source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203070&version_type=1
38-
# source: ./cache/wechat_devtools_1.05.2201240_x64.exe
36+
# source: cache/wechat_devtools_1.05.2203070_x64.exe
3937
source-type: 7z
40-
source-subdir: ./code
38+
source-subdir: code
39+
override-build: |
40+
chmod -R 755 code/package.nw
41+
cp -r code/package.nw $SNAPCRAFT_STAGE
42+
# after 会执行到stage
43+
44+
build-node:
45+
plugin: nil
4146
build-environment:
42-
- PATH: "$SNAPCRAFT_STAGE/nodejs/bin:$PATH"
47+
- PATH: "$SNAPCRAFT_STAGE/node/bin:$PATH"
4348
- NW_VERSION: 0.55.0
49+
- NO_WINE: 'true'
4450
# - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw"
4551
# - srcdir: "$SNAPCRAFT_PROJECT_DIR"
4652
build-packages:
@@ -53,71 +59,104 @@ parts:
5359
- make
5460
- openssl
5561
- libssh2-1-dev
62+
override-pull: |
63+
ls -l
5664
override-build: |
5765
env
58-
echo "3"
59-
ls -l $SNAPCRAFT_STAGE
66+
echo "=============3============"
67+
ls -l $SNAPCRAFT_PART_SRC
68+
ls -l $SNAPCRAFT_PART_BUILD
69+
ls -l $SNAPCRAFT_PART_INSTALL
70+
ls -l $SNAPCRAFT_PRIME
6071
ls -l $SNAPCRAFT_PROJECT_DIR
72+
ls -l $SNAPCRAFT_STAGE
73+
ls -l
74+
75+
# 准备文件
76+
cp -r $SNAPCRAFT_STAGE/package.nw package.nw
77+
chmod -R 755 package.nw
78+
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" tools
79+
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" compiler
6180
6281
# 执行构建脚本
63-
chmod -R 755 $SNAPCRAFT_PART_BUILD/code/package.nw
6482
npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org
6583
node-gyp install --registry=https://registry.npm.taobao.org
6684
67-
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" "$SNAPCRAFT_PART_BUILD/code/tools"
68-
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" "$SNAPCRAFT_PART_BUILD/code/compiler"
6985
for script in fix-package-name.js fix-cli.sh fix-core.sh fix-other.sh; do
7086
echo -e "\e[1;34mrun ${script}\e[0m"
71-
"${SNAPCRAFT_PART_BUILD}/code/tools/${script}"
87+
tools/${script}
7288
done
7389
# 构建模块
74-
"${SNAPCRAFT_PART_BUILD}/code/tools/rebuild-node-modules.sh" $NW_VERSION
75-
rm -rf "${SNAPCRAFT_PART_BUILD}/code/tools"
76-
77-
snapcraftctl build
90+
tools/rebuild-node-modules.sh $NW_VERSION
91+
rm -rf tools
92+
cp -r package.nw $SNAPCRAFT_PART_INSTALL
93+
chmod -R 755 $SNAPCRAFT_PART_INSTALL/package.nw
7894
7995
stage-packages:
8096
- libxkbfile1
8197
- git-core
82-
override-prime: |
83-
snapcraftctl prime
84-
rm -rf node node.exe
85-
cp "$SNAPCRAFT_PRIME/nodejs/bin/node" "$SNAPCRAFT_PRIME/node"
86-
ln -s "node" "node.exe"
98+
- libssh2-1-dev
8799

88100
after:
89101
- node-js
90-
# - compiler
102+
- package-nw
91103
# - desktop-gnome-platform
92104

93105
nw-js:
94106
plugin: dump
95107
source: https://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz
96108
# source: ./cache/nwjs-sdk-v0.55.0-linux-x64.tar.gz
109+
organize:
110+
"*": nwjs/
97111
stage-packages:
98112
- libnss3
99113
- libnspr4
114+
override-pull: |
115+
ls -l
116+
ls -l $SNAPCRAFT_PART_SRC
117+
ls -l $SNAPCRAFT_PART_BUILD
118+
snapcraftctl pull
119+
ls -l
120+
ls -l $SNAPCRAFT_PART_SRC
121+
ls -l $SNAPCRAFT_PART_BUILD
122+
rm -rf nacl_irt_x86_64.nexe
123+
# chmod 644 nacl_irt_x86_64.nexe
124+
# tar -zcf nacl_irt_x86_64.nexe.tar.gz nacl_irt_x86_64.nexe
125+
# ln -s $SNAP/nacl_irt_x86_64.nexe nacl_irt_x86_64.nexe
126+
ls -l
127+
ls -l $SNAPCRAFT_PART_SRC
128+
ls -l $SNAPCRAFT_PART_BUILD
129+
ls -l $SNAPCRAFT_PART_INSTALL
130+
ls -l $SNAPCRAFT_STAGE
131+
132+
override-build: |
133+
ls -l
134+
rm -rf $SNAPCRAFT_PART_INSTALL/nwjs/node $SNAPCRAFT_PART_INSTALL/nwjs/node.exe
135+
install -Dm755 $SNAPCRAFT_STAGE/node/bin/node $SNAPCRAFT_PART_INSTALL/nwjs/node
136+
cd $SNAPCRAFT_PART_INSTALL/nwjs && ln -s node node.exe
137+
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
138+
snapcraftctl build
139+
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
140+
after:
141+
- build-node
100142

101143
run-script:
102144
plugin: nil
103145
override-build: |
104146
snapcraftctl build
105-
cp "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-snap" "$SNAPCRAFT_PART_INSTALL/wechat-devtools-snap"
147+
ls
148+
install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools"
149+
install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-cli" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools-cli"
150+
106151
stage:
107-
- wechat-devtools-snap
108-
109-
zzz:
110-
plugin: nil
111-
# source: https://npmmirror.com/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz
112-
override-stage: |
113-
echo "6"
114-
env
115-
ls -l $SNAPCRAFT_STAGE
152+
- bin/wechat-devtools
153+
- bin/wechat-devtools-cli
154+
- usr/*
116155

117156
apps:
118157
wechat-devtools:
119158
# autostart: wechat-devtools.desktop
120-
command: desktop-launch $SNAP/wechat-devtools-snap
159+
command: bin/wechat-devtools
121160
environment:
122161
WECHAT_DEVTOOLS_DIR: $SNAP/nwjs
123162
APPDATA: "$SNAP_USER_DATA/wechat_devtools"
@@ -132,13 +171,18 @@ apps:
132171
- desktop-legacy
133172
- opengl
134173
- mount-observe
174+
- adb-support
135175
- x11
136176
- wayland
137177
- network
138178
- network-bind
139179
- gsettings
140180
- browser-support
141-
- password-manager-service
181+
- home
182+
- system-observe
183+
- removable-media
184+
- udisks2
185+
- unity7
142186

143187
plugs:
144188
gtk-3-themes:
@@ -153,7 +197,3 @@ plugs:
153197
interface: content
154198
target: $SNAP/data-dir/sounds
155199
default-provider: gtk-common-themes
156-
# platform_snap:
157-
# interface: content
158-
# target: $SNAP/gnome-platform
159-
# default-provider: gnome-3-34-1804

test/snap.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -e
3-
cd "/mnt/disk1/GitHub/wechat-devtools-linux"
4-
snapcraft #--http-proxy="http://192.168.249.236:7890" --https-proxy="http://192.168.249.236:7890"
5-
snap install wechat-devtools_0.1_amd64.snap --devmode
6-
wechat-devtools
3+
root_dir=$(cd `dirname $0`/.. && pwd -P)
4+
cd $root_dir
5+
snapcraft #--http-proxy="http://192.168.1.232:7890" --https-proxy="http://192.168.1.232:7890"
6+
snap install wechat-devtools_*_amd64.snap --devmode
7+
# snap run wechat-devtools

0 commit comments

Comments
 (0)