name: wechat-devtools # you probably want to 'snapcraft register ' base: core18 # the base snap is the execution environment for this snap version: '1.05.2204180-1' # just for humans, typically '1.2+git' or '1.3.2' summary: WeChat Devtools for Linux # 79 char long summary description: | WeChat Devtools for Linux. grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots architectures: - build-on: [amd64] run-on: [amd64] # pull # build # stage # prime # snap # /root/parts/my-part/src/nw parts: node-js: plugin: dump 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 organize: "*": node/ override-build: | mkdir -p $SNAPCRAFT_STAGE/node cp -r * $SNAPCRAFT_STAGE/node ls -l ls -l $SNAPCRAFT_PART_INSTALL package-nw: plugin: dump source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052204180&version_type=1 # source: cache/wechat_devtools_1.05.2204180_x64.exe source-type: 7z 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: - PATH: "$SNAPCRAFT_STAGE/node/bin:$PATH" - NW_VERSION: 0.55.0 - NO_WINE: 'true' # - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw" # - srcdir: "$SNAPCRAFT_PROJECT_DIR" build-packages: - python2.7 - libxkbfile-dev - pkg-config - libkrb5-dev - gcc - g++ - make - openssl - libssh2-1-dev override-pull: | ls -l override-build: | env echo "=============3============" 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_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 # 执行构建脚本 npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org node-gyp install --registry=https://registry.npm.taobao.org 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" tools/${script} done # 构建模块 tools/rebuild-node-modules.sh $NW_VERSION rm -rf tools cp -r package.nw $SNAPCRAFT_PART_INSTALL chmod -R 755 $SNAPCRAFT_PART_INSTALL/package.nw stage-packages: - libxkbfile1 - git-core - libssh2-1-dev after: - node-js - package-nw # - desktop-gnome-platform nw-js: plugin: dump 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 organize: "*": nwjs/ stage-packages: - libnss3 - 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: plugin: nil override-build: | snapcraftctl build ls install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools" install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-cli" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools-cli" stage: - bin/wechat-devtools - bin/wechat-devtools-cli - usr/* apps: wechat-devtools: # autostart: wechat-devtools.desktop command: bin/wechat-devtools environment: WECHAT_DEVTOOLS_DIR: $SNAP/nwjs APPDATA: "$SNAP_USER_DATA/wechat_devtools" PATH: "$SNAP/node/bin:$SNAP/nwjs:$PATH" USERPROFILE: $SNAP_USER_DATA GIT_EXEC_PATH: $SNAP/usr/lib/git-core extensions: - gnome-3-34 plugs: - desktop - desktop-legacy - opengl - mount-observe - adb-support - x11 - wayland - network - network-bind - gsettings - browser-support - home - system-observe - removable-media - udisks2 - unity7 plugs: gtk-3-themes: interface: content target: $SNAP/data-dir/themes default-provider: gtk-common-themes icon-themes: interface: content target: $SNAP/data-dir/icons default-provider: gtk-common-themes sound-themes: interface: content target: $SNAP/data-dir/sounds default-provider: gtk-common-themes