Skip to content

Commit

Permalink
Restructure the repository (#10796)
Browse files Browse the repository at this point in the history
* Restructure the repository

* lock file

* fmt

* fix bench

* fix cli template test

* remove accidental file

* fix mv command

* clippy

* upgrade paths-filter github action

* fix cli migration tests

* lockfile

* license headers

* clippy

* scope test-core to tauri crate

* license header

* correct --manifest-path usage

* lockfile

* fix tauri-driver on macOS [skip ci]

* build target ios

* try downgrade env_logger

* downgrade 0.1.7

* try to fix bench

* bench overflow

* revert overflow fix, fix tauri_root_path

* revert env_logger downgrade

* fmt

* raise msrv to 1.71

* fmt

* delete .cargo/config.toml [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
  • Loading branch information
amrbashir and lucasfernog authored Aug 27, 2024
1 parent 22d2afa commit 36eee37
Show file tree
Hide file tree
Showing 859 changed files with 11,205 additions and 28,397 deletions.
38 changes: 19 additions & 19 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
},
"packages": {
"@tauri-apps/api": {
"path": "./tooling/api",
"path": "./packages/api",
"manager": "javascript",
"publish": [
{
Expand All @@ -149,61 +149,61 @@
]
},
"tauri-utils": {
"path": "./core/tauri-utils",
"path": "./crates/tauri-utils",
"manager": "rust"
},
"tauri-macos-sign": {
"path": "./tooling/macos-sign",
"path": "./crates/tauri-macos-sign",
"manager": "rust"
},
"tauri-bundler": {
"path": "./tooling/bundler",
"path": "./crates/tauri-bundler",
"manager": "rust",
"dependencies": ["tauri-utils", "tauri-macos-sign"]
},
"tauri-runtime": {
"path": "./core/tauri-runtime",
"path": "./crates/tauri-runtime",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-runtime-wry": {
"path": "./core/tauri-runtime-wry",
"path": "./crates/tauri-runtime-wry",
"manager": "rust",
"dependencies": ["tauri-utils", "tauri-runtime"]
},
"tauri-codegen": {
"path": "./core/tauri-codegen",
"path": "./crates/tauri-codegen",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-macros": {
"path": "./core/tauri-macros",
"path": "./crates/tauri-macros",
"manager": "rust",
"dependencies": ["tauri-codegen", "tauri-utils"]
},
"tauri-plugin": {
"path": "./core/tauri-plugin",
"path": "./crates/tauri-plugin",
"manager": "rust",
"dependencies": ["tauri-utils"],
"postversion": "node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"tauri-build": {
"path": "./core/tauri-build",
"path": "./crates/tauri-build",
"manager": "rust",
"dependencies": ["tauri-codegen", "tauri-utils"],
"postversion": [
"node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../tauri-schema-generator/Cargo.toml"
],
"assets": [
{
"path": "./tooling/cli/schema.json",
"name": "schema.json"
"path": "./crates/tauri-schema-generator/schemas/config.schema.json",
"name": "config.schema.json"
}
]
},
"tauri": {
"path": "./core/tauri",
"path": "./crates/tauri",
"manager": "rust",
"dependencies": [
"tauri-macros",
Expand All @@ -215,28 +215,28 @@
"postversion": "node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"@tauri-apps/cli": {
"path": "./tooling/cli/node",
"path": "./packages/cli",
"manager": "javascript",
"dependencies": ["tauri-cli"],
"postversion": [
"node ../../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../../crates/tauri-schema-generator/Cargo.toml"
],
"prepublish": [],
"publish": [],
"postpublish": []
},
"tauri-cli": {
"path": "./tooling/cli",
"path": "./crates/tauri-cli",
"manager": "rust",
"dependencies": ["tauri-bundler", "tauri-utils", "tauri-macos-sign"],
"postversion": [
"cargo check",
"cargo build --manifest-path ../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../crates/tauri-schema-generator/Cargo.toml"
]
},
"tauri-driver": {
"path": "./tooling/webdriver",
"path": "./crates/tauri-driver",
"manager": "rust",
"postversion": "cargo check"
}
Expand Down
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Hi! We, the maintainers, are really excited that you are interested in contribut

First, [join our Discord server](https://discord.gg/SpmNs4S) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.

To set up your machine for development, follow the [Tauri setup guide](https://tauri.app/v1/guides/getting-started/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [PNPM](https://pnpm.io/), it is only required if you are developing the Node CLI or API packages (`tooling/cli/node` and `tooling/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
To set up your machine for development, follow the [Tauri setup guide](https://tauri.app/v1/guides/getting-started/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [PNPM](https://pnpm.io/), it is only required if you are developing the Node CLI or API packages (`packages/cli` and `packages/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.

Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To build these automatically, run the `.scripts/setup.sh` (Linux and macOS) or `.scripts/setup.ps1` (Windows) script. This will install the Rust and Node.js CLI and build the JS API. After that, you should be able to run all the examples. Note that the setup script should be executed from the root folder of the repository in order to run correctly.

Expand All @@ -58,15 +58,15 @@ See [Architecture](../ARCHITECTURE.md#major-components) for an overview of the p

### Developing Tauri Bundler and Rust CLI

The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of `@tauri-apps/cli` (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
The code for the bundler is located in `[Tauri repo root]/crates/tauri-bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/crates/tauri-cli`. If you are using your local copy of `@tauri-apps/cli` (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.

### Developing The Node.js CLI (`@tauri-apps/cli`)

`@tauri-apps/cli` is a wrapper to `tauri-cli` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
`@tauri-apps/cli` is a wrapper to `tauri-cli` so most changes should be written on the Rust CLI. The `[Tauri repo root]/crates/tauri-cli` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.

### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)

The code for the Rust crates, including the Core, Macros, Utils, WRY runtime, and a few more are located in `[Tauri repo root]/core/tauri-(macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `cargo run --example helloworld` after making changes to test them out.
The code for the Rust crates, including the Core, Macros, Utils, WRY runtime, and a few more are located in `[Tauri repo root]/crates/tauri-(macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `cargo run --example helloworld` after making changes to test them out.

#### Building the documentation locally

Expand All @@ -78,7 +78,7 @@ $ RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --open

### Developing the JS API

The JS API provides bindings between the developer's JS in the Webview and the builtin Tauri APIs, written in Rust. Its code is located in `[Tauri repo root]/tooling/api`. After making changes to the code, run `pnpm build` to build it. To test your changes, we recommend using the API example app, located in `[Tauri repo root]/examples/api`. It will automatically use your local copy of the JS API and provides a helpful UI to test the various commands.
The JS API provides bindings between the developer's JS in the Webview and the builtin Tauri APIs, written in Rust. Its code is located in `[Tauri repo root]/packages/api`. After making changes to the code, run `pnpm build` to build it. To test your changes, we recommend using the API example app, located in `[Tauri repo root]/examples/api`. It will automatically use your local copy of the JS API and provides a helpful UI to test the various commands.

## Financial Contribution

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: 💡 Feature Request
title: '[feat] '
description: Suggest an idea
labels: 'type: feature request'
labels: ['type: feature request']

body:
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Before submitting a PR, please read https://github.com/tauri-apps/tauri/blob/dev
Examples of good title:
- fix(windows): fix race condition in event loop
- docs: update docstrings
- docs: update example for `App::show`
- feat: add `Window::set_fullscreen`
Examples of bad title:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: 'lts/*'
- run: pnpm audit
16 changes: 7 additions & 9 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:
push:
branches:
- dev
- 1.x
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/bench.yml'
- 'bench/**'

env:
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -55,23 +55,21 @@ jobs:
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libwebkit2gtk-4.1-dev libayatana-appindicator3-dev \
webkit2gtk-4.1 libayatana-appindicator3-dev \
xvfb \
at-spi2-core
wget https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine_1.18.0_amd64.deb
sudo dpkg -i hyperfine_1.18.0_amd64.deb
pip install memory_profiler
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/bench/tests

- name: run benchmarks
run: |
cargo build --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }} --manifest-path tooling/bench/tests/Cargo.toml
xvfb-run --auto-servernum cargo run --manifest-path tooling/bench/Cargo.toml --bin run_benchmark
cargo build --manifest-path bench/tests/cpu_intensive/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
cargo build --manifest-path bench/tests/files_transfer/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
cargo build --manifest-path bench/tests/helloworld/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
xvfb-run --auto-servernum cargo run --manifest-path bench/Cargo.toml --bin run_benchmark
- name: clone benchmarks_results
if: github.repository == 'tauri-apps/tauri' && github.ref == 'refs/heads/dev'
Expand All @@ -84,7 +82,7 @@ jobs:
- name: push new benchmarks
if: github.repository == 'tauri-apps/tauri' && github.ref == 'refs/heads/dev'
run: |
cargo run --manifest-path tooling/bench/Cargo.toml --bin build_benchmark_jsons
cargo run --manifest-path bench/Cargo.toml --bin build_benchmark_jsons
cd gh-pages
git pull
git config user.name "tauri-bench"
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/check-change-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v2
- name: check change files end with .md
run: |
for file in .changes
do
if [[ ! "$file" =~ \.(md|json)$ ]]; then
echo ".changes directory should only contain files that end with .md"
echo "found an invalid file in .changes directory:"
echo "$file"
exit 1
fi
end
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
Expand Down
40 changes: 18 additions & 22 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:
pull_request:
paths:
- '.github/workflows/check-generated-files.yml'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'packages/api/src/**'
- 'crates/tauri/scripts/bundle.global.js'
- 'crates/tauri-utils/src/config.rs'
- 'crates/tauri-cli/config.schema.json'
- 'crates/tauri-schema-generator/schemas/*.json'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -26,18 +26,17 @@ jobs:
schema: ${{ steps.filter.outputs.schema }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
api:
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'packages/api/src/**'
- 'crates/tauri/scripts/bundle.global.js'
schema:
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'core/tauri-acl-schema/*.json'
- 'crates/tauri-utils/src/config.rs'
- 'crates/tauri-cli/config.schema.json'
- 'crates/tauri-schema-generator/schemas/*.json'
api:
runs-on: ubuntu-latest
Expand All @@ -51,9 +50,11 @@ jobs:
node-version: 'lts/*'
cache: 'pnpm'

- name: install deps
run: pnpm i --frozen-lockfile
- name: build api
working-directory: tooling/api
run: pnpm i --frozen-lockfile && pnpm build
run: pnpm build
working-directory: packages/api
- name: check api
run: ./.scripts/ci/has-diff.sh

Expand All @@ -73,14 +74,9 @@ jobs:
sudo apt-get install -y libgtk-3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: core -> ../target

- name: generate config schema
run: cargo build --manifest-path ./core/tauri-config-schema/Cargo.toml

- name: generate ACL schema
run: cargo build --manifest-path ./core/tauri-acl-schema/Cargo.toml
- name: generate schemas
run: cargo build --manifest-path ./crates/tauri-schema-generator/Cargo.toml

- name: check schema
- name: check schemas
run: ./.scripts/ci/has-diff.sh
2 changes: 1 addition & 1 deletion .github/workflows/check-license-header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
Expand Down
Loading

0 comments on commit 36eee37

Please sign in to comment.