Add full CI and Support for linux (#3)

* fix: release to tauri branch

* fix: release to tauri branch

* fix: release to tauri branch

* fix: release to tauri

* fix: fix app not loading on linux builds

- update tauri
- fix dist directory path

BREAKING CHANGES

* fix: update readme

* fix: semantic-release

* Update .releaserc

* Update ci.yaml

* fix: Update .releaserc

* fix: remove repo from package.json

* chore(major): 1.0.0-tauri.1 [skip ci]

## 1.0.0-tauri.1 (2023-05-09)

### ⚠ BREAKING CHANGES

* CHANGES

### 🍕 Features

* add setup scripts for setting up tauri dev environment ([0c41a33](0c41a33d0e))
* **dxf:** add support for dimensions in dxf. ([56c884c](56c884ccfd))
* add support for dxf blocks ([#200](https://github.com/ZanzyTHEbar/jsketcher/issues/200)) ([322d47f](322d47f802))
* add support for dxf files import ([2fa2866](2fa2866296))
* finish up CI system ([5a688d1](5a688d1a9e))
* initial cir release ([2f94a6e](2f94a6eb82))
* initial tauri commit ([0a0bb54](0a0bb5485e))
* update tauri version ([90168da](90168da42c))

### 🐛 Bug Fixes

* .releasesrc file not having a main branch ([04f2e2c](04f2e2c6b7))
* .releasesrc file not having a main branch ([25ae8a4](25ae8a464b))
* **dxf:** add dimLayers to the export. ([#183](https://github.com/ZanzyTHEbar/jsketcher/issues/183)) ([a3349b5](a3349b5da4))
* fix app not loading on linux builds ([9ef599d](9ef599ddc9))
* fix release asset types ([8f73410](8f73410c74))
* release to tauri ([0ba5387](0ba5387601))
* release to tauri branch ([11fcf2e](11fcf2e87a))
* release to tauri branch ([e8486a5](e8486a5e65))
* release to tauri branch ([6076573](6076573c98))
* remove caching of pnpm in ci ([96165f3](96165f3e1e))
* remove old path ([f0b426c](f0b426c14f))
* remove repo from package.json ([dd099b8](dd099b8ad8))
* script for linux ([46bda82](46bda82726))
* semantic-release ([3edb4cf](3edb4cf635))
* Update .releaserc ([3343d2c](3343d2cb4a))
* update readme ([b00299d](b00299d5c1))
* windows failing to build ([def0782](def0782b76))

* fix: appimage failing to build

* fix: test ubuntu 18.04

* fix: test ubuntu 18.04

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* feat: update ci to use docker container

* chore(minor): 1.0.0-tauri.2 [skip ci]

## [1.0.0-tauri.2](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.1...v1.0.0-tauri.2) (2023-05-11)

### 🐛 Bug Fixes

* appimage failing to build ([8dc6217](8dc62170a9))
* test ubuntu 18.04 ([8f55f4d](8f55f4d1c1))
* test ubuntu 18.04 ([0afd146](0afd14642b))

### 🍕 Features

* update ci to use docker container ([7bcacb0](7bcacb0251))
* update ci to use docker container ([98de939](98de93981f))
* update ci to use docker container ([0750c00](0750c006f3))
* update ci to use docker container ([715780f](715780f8f6))
* update ci to use docker container ([ccbacdb](ccbacdba32))
* update ci to use docker container ([60aa80d](60aa80d636))
* update ci to use docker container ([f629258](f629258426))
* update ci to use docker container ([278cf82](278cf82cea))
* update ci to use docker container ([02ec38c](02ec38c1b7))
* update ci to use docker container ([8fb7924](8fb7924dc2))
* update ci to use docker container ([d0493b3](d0493b3e0c))
* update ci to use docker container ([09fbb4f](09fbb4f9b9))
* update ci to use docker container ([c7e39b9](c7e39b92f7))
* update ci to use docker container ([d9221a7](d9221a77fe))
* update ci to use docker container ([9e96489](9e96489eb7))
* update ci to use docker container ([765b708](765b708a19))
* update ci to use docker container ([484b722](484b722a49))
* update ci to use docker container ([1023d90](1023d90529))
* update ci to use docker container ([1d9fd84](1d9fd84aa2))

* feat: update rust deps

* chore(minor): 1.0.0-tauri.3 [skip ci]

## [1.0.0-tauri.3](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.2...v1.0.0-tauri.3) (2023-05-11)

### 🍕 Features

* update rust deps ([b809c28](b809c28b8c))

* fix: wasm not loading in webkit

* chore(patch): 1.0.0-tauri.4 [skip ci]

## [1.0.0-tauri.4](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.3...v1.0.0-tauri.4) (2023-05-11)

### 🐛 Bug Fixes

* wasm not loading in webkit ([0e74582](0e74582848))

* feat: add windows binary

* fix: windows ci

---------

Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
This commit is contained in:
DaOfficialWizard 2023-05-11 23:24:38 +01:00 committed by GitHub
parent 62620001d7
commit e36f11a804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 161 additions and 198 deletions

View file

@ -5,6 +5,7 @@
"env": {
"browser": true,
"commonjs": true,
"node": true,
"es6": true
},
"parser": "@babel/eslint-parser",

View file

@ -4,6 +4,7 @@ on:
push:
branches:
- tauri
- feature/tauri
#- master
#- main
@ -33,31 +34,62 @@ jobs:
node-version: [18.x]
#, macos-latest
#windows-latest,
platform: [ubuntu-18.04]
platform: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
#- os: windows-latest
# rust_target: x86_64-pc-windows-msvc
#- os: macos-latest
# rust_target: x86_64-apple-darwin
#- os: macos-latest
# rust_target: aarch64-apple-darwin
#- os: ubuntu-18.04
# rust_target: x86_64-unknown-linux-gnu
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
#- os: macos-latest
# rust_target: x86_64-apple-darwin
#- os: macos-latest
# rust_target: aarch64-apple-darwin
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ env.GITHUB_TOKEN }}
- name: Build the App (Linux)
if: matrix.platform == 'ubuntu-latest'
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/zanzythebar/tauridocker:latest
options: -v ${{ github.workspace }}:/workspace
run: |
echo "::group::install node dependencies"
npm install -g pnpm
npm install -g typescript
pnpm install
echo "::group::tauri build"
pnpm tauri build
echo "::endgroup::"
- name: Archive the App (Linux)
if: matrix.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: production-files
path: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
retention-days: 5
if-no-files-found: error
- name: Verify build (Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
ls -la src-tauri/target/release/bundle/appimage
ls -la src-tauri/target/release/bundle/deb
- name: Node.js setup ${{ matrix.node-version }}
- name: Node.js setup ${{ matrix.node-version }} (Windows & MacOS)
if: matrix.platform == 'windows-latest' || matrix.platform == 'macos-latest'
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
#cache: "pnpm"
# node-version-file: '.nvmrc'
- name: "Setup Rust"
- name: Setup Rust (Windows & MacOS)
if: matrix.platform == 'windows-latest' || matrix.platform == 'macos-latest'
uses: actions-rs/toolchain@v1
with:
default: true
@ -65,23 +97,16 @@ jobs:
profile: minimal
toolchain: stable
target: ${{ matrix.platform.rust_target }}
- uses: Swatinem/rust-cache@v2
- name: Cache Rust (Windows & MacOS)
if: matrix.platform == 'windows-latest' || matrix.platform == 'macos-latest'
uses: Swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Install dependencies (PNPM)
run: |
npm install -g pnpm
npm install -g typescript
pnpm install
- uses: JonasKruckenberg/tauri-build@v1.2.3
- name: Build the app (Windows & MacOS)
if: matrix.platform == 'windows-latest' || matrix.platform == 'macos-latest'
uses: JonasKruckenberg/tauri-build@v1.2.3
id: tauri_build
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
@ -94,25 +119,13 @@ jobs:
with:
target: ${{ matrix.platform.rust_target }}
- uses: actions/upload-artifact@v3
- name: Archive the App (Windows & MacOS)
if: matrix.platform == 'windows-latest' || matrix.platform == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: production-files
path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"
#- name: Build the app
# uses: tauri-apps/tauri-action@v0
# env:
# GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
# TAURI_PRIVATE_KEY: ${{ env.TAURI_PRIVATE_KEY }}
# TAURI_KEY_PASSWORD: ${{ env.TAURI_KEY_PASSWORD }}
# with:
# # tauri-action replaces \_\_VERSION\_\_ with the app version
# tagName: eyetrackvr-v__VERSION__
# releaseName: "EyeTrackApp v__VERSION__" # name of the release
# releaseBody: "See the assets to download this version and install." # message to include in the release
# releaseDraft: true # set to false to publish the release as a finished product
# prerelease: false # set to true to mark the release as a pre-release
deploy:
runs-on: ubuntu-latest
name: Deploy

View file

@ -3,6 +3,52 @@
[![semantic versioning](https://img.shields.io/badge/semantic%20versioning-2.0.0-green.svg)](https://semver.org)
> All notable changes to this project will be documented in this file
## [1.0.0-tauri.4](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.3...v1.0.0-tauri.4) (2023-05-11)
### 🐛 Bug Fixes
* wasm not loading in webkit ([0e74582](https://github.com/ZanzyTHEbar/jsketcher/commit/0e7458284831c946c6a0b0b4e4ded96bd4ceffa7))
## [1.0.0-tauri.3](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.2...v1.0.0-tauri.3) (2023-05-11)
### 🍕 Features
* update rust deps ([b809c28](https://github.com/ZanzyTHEbar/jsketcher/commit/b809c28b8cba7a3354cf1f8f8f9917d1f1c9e653))
## [1.0.0-tauri.2](https://github.com/ZanzyTHEbar/jsketcher/compare/v1.0.0-tauri.1...v1.0.0-tauri.2) (2023-05-11)
### 🐛 Bug Fixes
* appimage failing to build ([8dc6217](https://github.com/ZanzyTHEbar/jsketcher/commit/8dc62170a9be15f1ab1f20d9b7db5f3fa8e371b5))
* test ubuntu 18.04 ([8f55f4d](https://github.com/ZanzyTHEbar/jsketcher/commit/8f55f4d1c1a0bc036441453266c5c5d3ea9c4c65))
* test ubuntu 18.04 ([0afd146](https://github.com/ZanzyTHEbar/jsketcher/commit/0afd14642bb12107622bc39db41417c6f7d23c61))
### 🍕 Features
* update ci to use docker container ([7bcacb0](https://github.com/ZanzyTHEbar/jsketcher/commit/7bcacb0251eb934bd020022433641475782c240e))
* update ci to use docker container ([98de939](https://github.com/ZanzyTHEbar/jsketcher/commit/98de93981f3cb6bda3763a4eb4ce85b201145c78))
* update ci to use docker container ([0750c00](https://github.com/ZanzyTHEbar/jsketcher/commit/0750c006f3f49f5f22205f4a6303e33627ddcbe2))
* update ci to use docker container ([715780f](https://github.com/ZanzyTHEbar/jsketcher/commit/715780f8f6b106b6f1e0e5f19f6145d940aa79ec))
* update ci to use docker container ([ccbacdb](https://github.com/ZanzyTHEbar/jsketcher/commit/ccbacdba32268fb8990d2b5455329014ef04d3ca))
* update ci to use docker container ([60aa80d](https://github.com/ZanzyTHEbar/jsketcher/commit/60aa80d636affd2334526cc4569940cf9ceb77c5))
* update ci to use docker container ([f629258](https://github.com/ZanzyTHEbar/jsketcher/commit/f629258426c7b3a52b4cdce2a120652d3e9727f6))
* update ci to use docker container ([278cf82](https://github.com/ZanzyTHEbar/jsketcher/commit/278cf82ceaae8e76231780ab571e53e8658a3463))
* update ci to use docker container ([02ec38c](https://github.com/ZanzyTHEbar/jsketcher/commit/02ec38c1b7f9ef6b2af5df22ca4b7ae9ceb86151))
* update ci to use docker container ([8fb7924](https://github.com/ZanzyTHEbar/jsketcher/commit/8fb7924dc295aad48f798fd024f8a9394a53d4ba))
* update ci to use docker container ([d0493b3](https://github.com/ZanzyTHEbar/jsketcher/commit/d0493b3e0ca956b2a5ade8c3c2deac0f78b7d16a))
* update ci to use docker container ([09fbb4f](https://github.com/ZanzyTHEbar/jsketcher/commit/09fbb4f9b9b714a013207133963cc5de5934ca3e))
* update ci to use docker container ([c7e39b9](https://github.com/ZanzyTHEbar/jsketcher/commit/c7e39b92f79f6d6d8fa5553e36008eb82f1da8be))
* update ci to use docker container ([d9221a7](https://github.com/ZanzyTHEbar/jsketcher/commit/d9221a77fe581532de86b9f05a198ccca447781a))
* update ci to use docker container ([9e96489](https://github.com/ZanzyTHEbar/jsketcher/commit/9e96489eb762a06f5256a838af90cb6e7035f387))
* update ci to use docker container ([765b708](https://github.com/ZanzyTHEbar/jsketcher/commit/765b708a19fb8fbcb1c2c98395c0570a6b3eef0a))
* update ci to use docker container ([484b722](https://github.com/ZanzyTHEbar/jsketcher/commit/484b722a49be1c8259e93121b6cea5e1b438f865))
* update ci to use docker container ([1023d90](https://github.com/ZanzyTHEbar/jsketcher/commit/1023d905291e6d92dd19f23c1abd031fe2ae242b))
* update ci to use docker container ([1d9fd84](https://github.com/ZanzyTHEbar/jsketcher/commit/1d9fd84aa23984ae9450f940bc2533447ef46d95))
## 1.0.0-tauri.1 (2023-05-09)

View file

@ -4,11 +4,11 @@ const webpackConfig = require('./webpack.config');
const del = require('del');
const libAssets = require("./build/libAssets");
const glob = require("glob");
const {marked} = require("marked");
const { marked } = require("marked");
const Handlebars = require("handlebars");
const exec = require('child_process').exec;
module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
@ -44,11 +44,11 @@ module.exports = function(grunt) {
},
resources: {
expand: true,
cwd: 'web',
src: '**',
dest: 'dist/',
filter: dirFilter(['web/app', 'web/test'])
expand: true,
cwd: 'web',
src: '**',
dest: 'dist/',
filter: dirFilter(['web/app', 'web/test'])
},
docs: {
@ -59,12 +59,12 @@ module.exports = function(grunt) {
},
}
});
grunt.registerTask('clean', function() {
grunt.registerTask('clean', function () {
del.sync('dist');
});
grunt.registerTask('build', function() {
grunt.registerTask('build', function () {
const done = this.async();
webpack(webpackConfig, function (error) {
if (error) {
@ -75,17 +75,18 @@ module.exports = function(grunt) {
});
});
grunt.registerTask('show-revision', function() {
grunt.registerTask('show-revision', function () {
const done = this.async();
exec('git rev-parse --short HEAD', (err, stdout, stderr) => {
if (process.env.CI_BUILD_REF) exec('git rev-parse --short HEAD', (err, stdout, stderr) => {
grunt.log.writeln(stdout);
done();
});
});
grunt.registerTask('mark-revision', function() {
grunt.registerTask('mark-revision', function () {
const done = this.async();
exec('git rev-parse HEAD > dist/.rev', function (err, stdout, stderr) {
if (process.env.CI_BUILD_REF) exec('git rev-parse HEAD > dist/.rev', function (err, stdout, stderr) {
done(err);
});
});
@ -94,7 +95,7 @@ module.exports = function(grunt) {
grunt.registerTask('gen-docs', ['copy:docs', 'process-markdown']);
grunt.registerTask('process-markdown', function() {
grunt.registerTask('process-markdown', function () {
const done = this.async();
const mainTemplate = Handlebars.compile(grunt.file.read("modules/doc/doc-layout.handlebars"));
@ -120,7 +121,7 @@ module.exports = function(grunt) {
let link = file.substring(file.indexOf('/') + 1); //drop web prefix
workbench.operations.push({
operationName,
href: '../../../../../../' + convertMdPathToHtml(link)
href: '../../../../../../' + convertMdPathToHtml(link)
});
});
@ -138,7 +139,7 @@ module.exports = function(grunt) {
grunt.file.write(dest, htmlContent);
console.log("generated "+ dest);
console.log("generated " + dest);
})
done();
});
@ -148,11 +149,11 @@ module.exports = function(grunt) {
};
function convertMdPathToHtml(mdPath) {
return mdPath.substring(0, mdPath.length-('.md'.length)) + '.html';
return mdPath.substring(0, mdPath.length - ('.md'.length)) + '.html';
}
function fixLinks(htmlContent) {
return htmlContent.replace(/href=['"](.+)['"]/g, function(expr, link){
return htmlContent.replace(/href=['"](.+)['"]/g, function (expr, link) {
return 'href="' + convertMdPathToHtml(link) + '"';
});
}

View file

@ -1,93 +0,0 @@
{
"folders": [
{
"name": "modules",
"path": "./modules"
},
{
"name": "web",
"path": "./web"
},
{
"name": "repo",
"path": "."
}
],
"settings": {
"files.autoSave": "afterDelay",
"rust-analyzer.checkOnSave.enable": true,
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.checkOnSave.allTargets": true,
"rust-analyzer.files.watcher": "client",
"rust-analyzer.files.excludeDirs": [
"**/target",
"**/node_modules",
"**/dist",
"**/build",
"**/public",
"**/assets",
"**/src-tauri/target",
"**/scripts",
"**/src/components",
"**/src/interfaces",
"**/src/pages",
"**/src/static",
"**/src/styles",
"**/src/utils"
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"liveServer.settings.multiRootWorkspaceName": "ETVR",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"[shellscript]": {
"editor.defaultFormatter": "shakram02.bash-beautify"
},
"cSpell.words": [
"APPCONFIG",
"APPDATA",
"clippy",
"clsx",
"Coeff",
"dnsquery",
"esbenp",
"eyetrack",
"fullname",
"hashset",
"hookable",
"Iinternal",
"iocp",
"kobalte",
"nanos",
"notif",
"notififcation",
"notifs",
"partytown",
"ratelimit",
"reqwest",
"shakram",
"solidjs",
"soundfile",
"tamasfe",
"undici",
"vorbis",
"webserial",
"Xmark"
]
}
}

46
src-tauri/Cargo.lock generated
View file

@ -58,7 +58,7 @@ checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
[[package]]
name = "app"
version = "0.1.0"
version = "1.0.0"
dependencies = [
"serde",
"serde_json",
@ -162,9 +162,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.12.1"
version = "3.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8"
checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b"
[[package]]
name = "bytemuck"
@ -1376,9 +1376,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "js-sys"
version = "0.3.61"
version = "0.3.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5"
dependencies = [
"wasm-bindgen",
]
@ -2232,18 +2232,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.162"
version = "1.0.163"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6"
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.162"
version = "1.0.163"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6"
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
dependencies = [
"proc-macro2",
"quote",
@ -2865,9 +2865,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.28.0"
version = "1.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f"
checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105"
dependencies = [
"autocfg",
"bytes",
@ -3124,9 +3124,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.84"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -3134,24 +3134,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.84"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.15",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.84"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -3159,22 +3159,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.84"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.15",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.84"
version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb"
[[package]]
name = "webkit2gtk"

View file

@ -1,16 +1,14 @@
import {GenericWASMEngine_V1} from "engine/impl/wasm/GenericWASMEngine_V1";
import {CraftEngine} from "./craftEngine";
import {createOCCService, OCCService} from "cad/craft/e0/occService";
import { GenericWASMEngine_V1 } from "engine/impl/wasm/GenericWASMEngine_V1";
import { CraftEngine } from "./craftEngine";
import { createOCCService, OCCService } from "cad/craft/e0/occService";
export interface OCCBundleContext {
craftEngine: CraftEngine; // to be removed
occService: OCCService;
}
export function activate(ctx) {
loadWasm(ctx);
const wasmEngine = new GenericWASMEngine_V1();
@ -22,42 +20,39 @@ export function activate(ctx) {
ctx.occService = createOCCService(ctx);
}
function instantiateEngine(importObject, callback) {
const url = './lib-assets/jsketcher-occ-engine/occt.wasm';
//* work around until tauri v2
async function instantiateEngine(importObject, callback) {
const url = "./lib-assets/jsketcher-occ-engine/occt.wasm";
WebAssembly.instantiateStreaming(fetch(url), importObject).then(results => {
callback(results.instance);
});
const response = await fetch(url);
const buffer = await response.arrayBuffer();
const obj = await WebAssembly.instantiate(buffer, importObject);
callback(obj.instance);
}
function loadWasm(ctx) {
ctx.services.lifecycle.startAsyncInitializingJob('e0:loader');
ctx.services.lifecycle.startAsyncInitializingJob("e0:loader");
// @ts-ignore
window.Module = {
// locateFile: function(file) {
// return SERVER_PATH + file;
// },
onRuntimeInitialized: function() {
onRuntimeInitialized: function () {
Module._InitCommands();
ctx.services.lifecycle.finishAsyncInitializingJob('e0:loader');
ctx.services.lifecycle.finishAsyncInitializingJob("e0:loader");
},
instantiateWasm: function (importObject, fncReceiveInstance) {
instantiateEngine(importObject, fncReceiveInstance);
return {};
}
},
} as any;
const mainScript = document.createElement('script');
mainScript.setAttribute('src', './lib-assets/jsketcher-occ-engine/occt.js');
mainScript.setAttribute('async', 'async');
const mainScript = document.createElement("script");
mainScript.setAttribute("src", "./lib-assets/jsketcher-occ-engine/occt.js");
mainScript.setAttribute("async", "async");
document.head.appendChild(mainScript);
}
export const BundleName = "@OCCT";