Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support analysis / types with Rust Analyzer #883

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e06a7a3
Support analysis / types with Rust Analyzer
Hofer-Julian Feb 14, 2024
13d87db
Python Previewer: Initialize Shumate (#884)
theCapypara Feb 16, 2024
dc07ef7
String fixes (#888)
Feb 17, 2024
47e50e1
Use async enumerate_children (#889)
sonnyp Feb 17, 2024
1d7fdad
flatpak: Remove `/app/include` from cleanup (#886)
Diego-Ivan Feb 18, 2024
74d2f4b
Add Bart Gravendeel to contributors (#890)
Feb 18, 2024
6f125ca
Update modules (#891)
sonnyp Feb 18, 2024
0c94b36
Open Workbench windows maximized
sonnyp Feb 18, 2024
535bd21
Fix extensions detection (#892)
sonnyp Feb 18, 2024
fff4b72
Solve brwap dangling process (#893)
sonnyp Feb 19, 2024
e40c779
docs: Extend contributing section (#895)
Hofer-Julian Feb 21, 2024
04f65cd
46 beta (#896)
sonnyp Feb 21, 2024
2a321be
about: Add as contributor (#898)
BharatAtbrat Feb 29, 2024
7e8400a
Fix appstream to make new Flathub validation pass
sonnyp Feb 21, 2024
74c3204
Use Flathub beta
sonnyp Mar 1, 2024
b879513
Add pylsp as the python LSP (#857)
janvhs Mar 3, 2024
f776ae1
Use an AdwDialog for Extensions (#900)
sonnyp Mar 3, 2024
07ab7ca
Replace Black with Ruff, add LSP plugin for Ruff (#902)
theCapypara Mar 3, 2024
e79b06a
cli: Add proper Python support (#903)
sonnyp Mar 4, 2024
d0601d2
Add myself to to the about section (#904)
janvhs Mar 4, 2024
6a435fe
Adapt to demos moving to src
sonnyp Mar 7, 2024
26fef95
Update dependencies and release notes (#905)
sonnyp Mar 8, 2024
2de5259
Add Rirusha to about.js (#907)
Rirusha Mar 15, 2024
e3d00d9
cli: Ignore Gtk.TreeIter deprecation in Text Fields
sonnyp Mar 16, 2024
f8dd103
Do not build separate locales
sonnyp Mar 16, 2024
bc630e3
pre 46 maintenance (#909)
sonnyp Mar 17, 2024
e52f29a
46
sonnyp Mar 20, 2024
3e4440f
Update VTE 0.76 (#911)
sonnyp Mar 20, 2024
759f15b
Clear own logs on start
sonnyp Mar 20, 2024
3641c2c
rust: Enable GNOME 46 (#910)
sonnyp Mar 20, 2024
3cc9e0e
Update Blueprint to 0.12.0
sonnyp Mar 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ __pycache__

# IDEs / editors
.idea

target
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"prince781.vala",
"bodil.blueprint-gtk",
"dbaeumer.vscode-eslint",
"ms-python.black-formatter"
"charliermarsh.ruff"
]
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ We provide a couple of tools to make the development process pleasant.

```sh
# Ubuntu requirements
# sudo apt install flatpak flatpak-builder nodejs make
# sudo apt install flatpak flatpak-builder nodejs make gcc g++

# Fedora requirements
# sudo dnf install flatpak flatpak-builder nodejs make
# sudo dnf install flatpak flatpak-builder nodejs make gcc gcc-c++

cd Workbench
make setup
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ SHELL:=/bin/bash -O globstar

setup:
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak install --or-update --user --noninteractive gnome-nightly org.gnome.Sdk//master
flatpak install --or-update --user --noninteractive flathub org.flatpak.Builder org.freedesktop.Sdk.Extension.rust-stable//23.08 org.freedesktop.Sdk.Extension.vala//23.08 org.freedesktop.Sdk.Extension.llvm16//23.08
# flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install --or-update --user --noninteractive flathub org.gnome.Sdk//46 org.flatpak.Builder org.freedesktop.Sdk.Extension.rust-stable//23.08 org.freedesktop.Sdk.Extension.vala//23.08 org.freedesktop.Sdk.Extension.llvm16//23.08
npm install
make build

Expand All @@ -23,7 +22,8 @@ lint:
# Rust
./build-aux/fun rustfmt --check --edition 2021 src/**/*.rs
# Python
./build-aux/fun black --check src/**/*.py
./build-aux/fun ruff check --config=src/langs/python/ruff.toml src/**/*.py
./build-aux/fun ruff format --config=src/langs/python/ruff.toml --check src/**/*.py
# Blueprint
./build-aux/fun blueprint-compiler format src/**/*.blp
./build-aux/fun workbench-cli check blueprint src/**/*.blp
Expand All @@ -49,10 +49,10 @@ unit:
# flatpak run --env=G_DEBUG=fatal-criticals --command=appstream-util org.flatpak.Builder validate data/app.metainfo.xml

test: unit lint
./build-aux/fun workbench-cli ci demos/demos/Welcome
./build-aux/fun workbench-cli ci demos/src/Welcome

ci: setup test
./build-aux/fun workbench-cli ci demos/demos/**
./build-aux/fun workbench-cli ci demos/src/*

# Note that if you have Sdk extensions installed they will be used
# make sure to test without the sdk extensions installed
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Among other things, Workbench comes with

| | Formatter | Linter | Library demos[1] |
| ---------- | --------- | ------ | ---------------- |
| JavaScript | ✅ | ✅ | 94 |
| Python | ✅ | | 64 |
| Vala | ✅ | ✅ | 54 |
| Rust | ✅ | | 45 |
| JavaScript | ✅ | ✅ | 95 |
| Python | ✅ | | 89 |
| Vala | ✅ | ✅ | 59 |
| Rust | ✅ | | 45 |
| Blueprint | ✅ | ✅ | |
| CSS | ✅ | ✅ | |

[1] As of 2024-01-14 <!--counted with `~/go/bin/scc demos/demos`-->
[1] As of 2024-01-14 <!--counted with `~/go/bin/scc demos/src`-->

## Tips and tricks

Expand Down
27 changes: 20 additions & 7 deletions build-aux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,37 @@ cd gst-plugin-gtk4-0.11.1/
# cp generated-sources.json to gst-plugin-gtk4-sources.json
```

### Python Black Dependency
### Python Modules

`modules/python-black.json` contains the Flatpak modules to install [https://github.com/psf/black](black), the
uncompromising Python code formatter.
The `modules/python-*.json` files contain Flatpak modules to install Python dependencies.

This file is partially auto-generated. Here is how to generate it:
These files are (sometimes partially, see below) auto-generated. Here is how to generate it:

1. Obtain an up-to-date copy of [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools).
2. Make sure you have a Python virtualenv activated with the dependencies for the `pip` generator from the repo above.
3. Run `python3 <...>/flatpak-builder-tools/pip/flatpak-pip-generator black -o modules/python-black --build-isolation`
3. Run `python3 <...>/flatpak-builder-tools/pip/flatpak-pip-generator <package> -o modules/python-<package> --build-isolation`

You will notice that Workbench will now not build. This is due to these issues:
You will notice that Workbench will not build after auto-generating these files as described above.
This is due to these issues:

- https://github.com/flatpak/flatpak-builder-tools/issues/380
- https://github.com/pypa/pip/issues/7863

This means that the generated JSON file now needs its build dependencies manually added. Check the build dependencies
of black and their dependencies and add them to the JSON as well. Brute-forcing the build to obtain missing packages
of the package and their dependencies and add them to the JSON as well. Brute-forcing the build to obtain missing packages
may help as does referencing old commits of the file. You can also use the generator command to generate dependencies
for them and then merge it into the file by hand, but note that you will also need to manually collect their build
dependencies too.

In some cases you may also need to manually remove some packages the generator adds (such as `packaging` with `rope`,
as the SDK and Runtime already contain a version of these packages that can not be replaced. Make sure the package
you want to install is actually compatible with the version of that dependency in the SDK/Runtime.

#### Python packages with Maturin as build system

Python packages with Maturin as build system need some additional manual steps to get working. You will have to have
Rust enabled for compilation and pull in additional dependencies. See `modules/python-ruff.json` for example.

You can generate Maturin's dependencies with another generator provided by the Flatpak Builder Tools. Clone
the Maturin repo in the corresponding version you need and run:
`python3 <...>/flatpak-builder-tools/cargo/flatpak-cargo-generator.py <...>/Cargo.lock -o modules/cargo-sources-maturin.json`
14 changes: 8 additions & 6 deletions build-aux/library-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ Gio._promisify(

const demos_dir = Gio.File.new_for_path(
GLib.getenv("MESON_SOURCE_ROOT"),
).get_child("demos/demos");
).get_child("demos/src");
const demos = [];

for (const file_info of demos_dir.enumerate_children(
"",
const enumerator = await demos_dir.enumerate_children_async(
`${Gio.FILE_ATTRIBUTE_STANDARD_NAME},${Gio.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN}`,
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
GLib.PRIORITY_DEFAULT,
null,
)) {
);
for (const file_info of enumerator) {
if (file_info.get_is_hidden()) continue;
if (file_info.get_file_type() !== Gio.FileType.DIRECTORY) continue;

const demo_name = file_info.get_name();
const demo_dir = demos_dir.get_child(demo_name);
const demo_dir = enumerator.get_child(file_info);

let str;
try {
Expand Down
2 changes: 1 addition & 1 deletion build-aux/modules/GTKCssLanguageServer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"type": "git",
"url": "https://github.com/JCWasmx86/GTKCssLanguageServer",
"commit": "6475047e6d2632467838769332bc849941ab2aaa"
"commit": "dcbe75012d2d26fbca2729cee014e4860e31fa53"
}
],
"modules": [
Expand Down
8 changes: 4 additions & 4 deletions build-aux/modules/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"type": "file",
"dest-filename": "biome",
"only-arches": ["aarch64"],
"url": "https://github.com/biomejs/biome/releases/download/cli%2Fv1.4.1/biome-linux-arm64",
"sha256": "8f2712e303877594a9401ce392724f8b8c94d533b6f5902d9cbdd149e4fbd794"
"url": "https://github.com/biomejs/biome/releases/download/cli%2Fv1.6.0/biome-linux-arm64",
"sha256": "e25968d3cc7df0e8e36ecf99d87296c0dca394d18ada7e75cbe22cec149e4549"
},
{
"type": "file",
"dest-filename": "biome",
"only-arches": ["x86_64"],
"url": "https://github.com/biomejs/biome/releases/download/cli%2Fv1.4.1/biome-linux-x64",
"sha256": "2995159aebcb7ddd116b098a1a0a459d1a8681aaa878623fb5390cc0dd0e414a"
"url": "https://github.com/biomejs/biome/releases/download/cli%2Fv1.6.0/biome-linux-x64",
"sha256": "207ae06f84e4d4f0958837fa8e8c97a347af2217a4c55f5c6b53fba521095696"
}
]
}
3 changes: 2 additions & 1 deletion build-aux/modules/blueprint-compiler.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler.git",
"commit": "d47955c5a20b2f7cf85ff25a00b02160883aa0b1"
"commit": "66b43c36cf1017c878762007373964a096b3d2a5",
"tag": "v0.12.0"
}
]
}
Loading
Loading