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

Clean up, ready to new dev cycle #85

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.vscode

.flatpak-builder
builddir
build
export
*~
/subprojects/blueprint-compiler
/subprojects/libcsv

subprojects/*
!subprojects/*.wrap
/.cache

/build-aux
Expand Down
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
// Debug with CoreLLDB extension
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Launch",
"program": "${workspaceFolder}/build/src/${workspaceFolderBasename}",
"cwd": "${workspaceFolder}",
"preLaunchTask": "Compile"
}
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"mesonbuild.configureOnOpen": true,
"lldb.showDisassembly": "never",
"lldb.dereferencePointers": true,
"lldb.consoleMode": "commands"
}
22 changes: 22 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Compile",
"type": "shell",
"command": "meson compile -C build",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Setup",
"type": "shell",
"command": "meson setup build --reconfigure",
}
]
}
43 changes: 20 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# Psequel
# Dependencies

Remind future me:
```
 .
├──  application.vala
├──  gtk -> blue print, will compile to .ui files (2)
│ ├──  box.blp
│ ├──  help-overlay.ui
│ └──  window.blp
├── 謹 psequel.gresource.xml <- List the ui files in this file (3)
├──  main.vala
├──  meson.build <- List the blue prints in this files to make the compiler running. (1)
├──  ui <- Create a class (.vala file) to load template in this file (4)
└──  window.vala
```sh
# Install gtk4, vala, meson and postgresql (provide libpq)
## ArchLinux since I use arch btw

yay -S gtk4 vala meson postgresql flatpak-builder
```

Remind me 2:
Please install the schema for each change.
`ninja install`

Prefer setting:
- Editor font
- Color scheme
# Psequel

```sh
# config meson

cd psequel/
meson setup build/

# install glib schema (rerun each time change setting schemas)
cd build
sudo ninja install

- Connection timeout
- Query timeout
- Query limit.
# back to the project dir and run
cd ..
make debug
```
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This is just a file for me to type command faster, not the build file.

SHELL := /bin/bash
VALA_FILES := $(shell find $(SRC_DIR) -name '*.vala')
PROJECT_NAME := psequel

debug:
rm -rf build/resources/gtk
meson configure -Dbuildtype=debug build
Expand All @@ -9,14 +13,18 @@ release:
meson configure -Dbuildtype=release build
ninja -C build/ && G_MESSAGES_DEBUG=Psequel ./build/src/psequel

format:
@echo "Formatting Vala files..."
uncrustify -l VALA -c uncrustify.cfg --replace --no-backup $(VALA_FILES)

clean:
rm -rf build/resources

test:
ninja -C build/ && ./build/test/psequel-test

flatpak:
flatpak-builder --install-deps-from=flathub build-aux/ me.ppvan.psequel.json --force-clean
flatpak-builder --install-deps-from=flathub build-aux/ pkgs/flatpak/me.ppvan.psequel.yml --force-clean
flatpak build-export export build-aux
flatpak build-bundle export ./build-aux/me.ppvan.psequel.flatpak me.ppvan.psequel --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

Expand Down
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,15 @@ Next, it can be installed by `meson install`.
# Dependencies
If you use GNOME Builder or Flatpak, dependencies will be installed automatically. If you use pure Meson, dependencies will be:
- vala >= 0.56
- gtk >= 4.10
- gtk >= 4.16
- gtksourceview >= 5.0
- gio >= 2.74
- gio >= 2.80
- json-glib >= 1.6
- libadwaita >= 1.4
- postgres-libs >= 15.3
- libadwaita >= 1.6
- postgres-libs >= 16.2
- libcsv >= 3.0 (built as subproject if missing)
- pgquery-vala

```
pg_dump -s --no-comments -t "actor" -O -x --dbname "user=postgres password=postgres port=5432 dbname=dvdrental"| grep -v '^$' | grep -v '^(--\s*|SET\s+\w+\s*=).*$'
SELECT pg_catalog.set_config('search_path', '', false);
CREATE TABLE public.actor (
actor_id integer DEFAULT nextval('public.actor_actor_id_seq'::regclass) NOT NULL,
first_name character varying(45) NOT NULL,
last_name character varying(45) NOT NULL,
last_update timestamp without time zone DEFAULT now() NOT NULL
);
ALTER TABLE ONLY public.actor
ADD CONSTRAINT actor_pkey PRIMARY KEY (actor_id);
CREATE INDEX idx_actor_last_name ON public.actor USING btree (last_name);
CREATE TRIGGER last_updated BEFORE UPDATE ON public.actor FOR EACH ROW EXECUTE FUNCTION public.last_updated();

```


# Contributions
Contributions are welcome.

Expand Down
97 changes: 0 additions & 97 deletions me.ppvan.psequel.json

This file was deleted.

63 changes: 63 additions & 0 deletions pkgs/flatpak/me.ppvan.psequel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
app-id: me.ppvan.psequel
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: psequel
finish-args:
- --share=network
- --share=ipc
- --socket=fallback-x11
- --device=dri
- --socket=wayland
build-options:
append-path: /usr/lib/sdk/vala/bin
prepend-ld-library-path: /usr/lib/sdk/vala/lib
cleanup:
- /include
- /lib/pkgconfig
- /man
- /share/doc
- /share/gtk-doc
- /share/man
- /share/pkgconfig
- /share/vala
- '*.la'
- '*.a'
modules:
- name: psequel
buildsystem: meson
sources:
- type: dir
path: ../../
modules:
- name: blueprint-compiler
buildsystem: meson
sources:
- type: git
url: https://gitlab.gnome.org/jwestman/blueprint-compiler
tag: v0.14.0
cleanup:
- '*'
- name: postgresql-libs
buildsystem: simple
build-commands:
- ./configure --prefix=/app --with-ssl=openssl
- make -C src/include install
- make -C src/interfaces/libpq install
- make -C src/bin/pg_dump install
sources:
- type: archive
url: https://ftp.postgresql.org/pub/source/v17.0/postgresql-17.0.tar.bz2
sha256: 7e276131c0fdd6b62588dbad9b3bb24b8c3498d5009328dba59af16e819109de
- name: libcsv
buildsystem: meson
sources:
- type: git
url: https://github.com/ppvan/libcsv
commit: c8f01b8b4aa8d8156a624405b8a4c646e3f6efaa
- name: libquery-vala
buildsystem: meson
sources:
- type: git
url: https://github.com/ppvan/pg_query_vala
commit: 1672a38f04d4c8ba61f0ddc11e1203c824e704e9
7 changes: 0 additions & 7 deletions script/formater.sh

This file was deleted.

Loading
Loading