├── .clang-format ├── .clang-tidy ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── sweep-template.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── Build.yml │ ├── Coverage.yml │ ├── Lint.yml │ ├── ReleaseUpload.yml │ ├── Sonar.yml │ ├── codeql.yml │ ├── dependency-review.yml │ └── scorecard.yml ├── .gitignore ├── .pre-commit-config.yaml ├── Benchmarks ├── .gitignore ├── 4.1.0.json ├── Makefile ├── README.md ├── c++-1.json ├── c++-2.json ├── c++-3.json ├── c++-4.json ├── c++-5.json ├── c++-6.json ├── c++-7.json ├── chart.js ├── extract_git_data.sh ├── extract_tuples.py ├── index.html ├── prec++.json ├── quick │ ├── chart.js │ ├── index.html │ ├── script.js │ └── styles.css ├── script.js ├── style.css ├── v1.0.json ├── v1.1.json ├── v1.2.json ├── v1.3.json ├── v1.4.1.json ├── v1.4.json ├── v1.5.1.json ├── v1.5.json ├── v1.6.json ├── v2.0.json ├── v2.1.json ├── v2.2.json ├── v2.3.1.json ├── v2.3.json ├── v2.4.1.json ├── v2.4.2.json ├── v2.4.4.json ├── v2.4.json ├── v3.0.0.json ├── v3.1.0.json ├── v3.1.2.json ├── v4.2.2.json └── v4.3.0.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYING ├── Dockerfile ├── LSPTests ├── Fixture │ └── meson.build ├── meson.build └── test.py ├── PROGRESS.md ├── README.md ├── RELEASING.md ├── SECURITY.md ├── codecov.yml ├── docker ├── Dockerfile.debiansid └── Dockerfile.debiantrixie ├── docs ├── BuilderNightly.md ├── Configuration.md ├── Distribution.md ├── Kate.md ├── Neovim.md ├── PackageInstall.md ├── README.md ├── ReleaseInstall.md ├── SourceInstall.md ├── VSCode.md └── img │ ├── auto-completion.png │ ├── diags.png │ ├── hover.png │ ├── hover2.png │ ├── inlay.png │ └── pkgconfig.png ├── meson.build ├── meson.options ├── mesonlsp.spec ├── scripts ├── ci_create_zip.sh ├── collect_perf_data.py ├── create_license_file.sh ├── do_meson_tests.sh ├── fast_collect_data.py ├── release_update_vscode.py └── run_regression_tests.sh ├── sonar-project.properties ├── src ├── README.md ├── benchmarks │ ├── benchmark.cpp │ ├── lexing.cpp │ ├── meson.build │ └── parsing.cpp ├── libanalyze │ ├── analysisoptions.hpp │ ├── meson.build │ ├── mesonmetadata.hpp │ ├── mesontree.cpp │ ├── mesontree.hpp │ ├── options │ │ ├── mesonoption.hpp │ │ ├── optiondiagnosticvisitor.cpp │ │ ├── optiondiagnosticvisitor.hpp │ │ ├── optionextractor.cpp │ │ ├── optionextractor.hpp │ │ ├── optionstate.cpp │ │ └── optionstate.hpp │ ├── subprojects │ │ ├── subproject.cpp │ │ ├── subproject.hpp │ │ ├── subprojectstate.cpp │ │ └── subprojectstate.hpp │ └── typeanalyzer │ │ ├── partialinterpreter.cpp │ │ ├── partialinterpreter.hpp │ │ ├── scope.hpp │ │ ├── typeanalyzer.cpp │ │ └── typeanalyzer.hpp ├── libast │ ├── ini.cpp │ ├── ini.hpp │ ├── location.hpp │ ├── meson.build │ ├── node.cpp │ ├── node.hpp │ ├── sourcefile.cpp │ └── sourcefile.hpp ├── libcxathrow │ ├── backtrace_execinfo.cpp │ ├── backtrace_libunwind.cpp │ ├── backtrace_null.cpp │ ├── backtrace_stacktrace.cpp │ ├── handle_darwin_clang.cpp │ ├── handle_linux_clang.cpp │ ├── handle_linux_gcc.cpp │ ├── handle_linux_static_clang.cpp │ ├── handle_linux_static_gcc.cpp │ ├── handle_null.cpp │ ├── meson.build │ ├── shared.cpp │ └── shared.hpp ├── libjsonrpc │ ├── jsonrpc.cpp │ ├── jsonrpc.hpp │ └── meson.build ├── liblangserver │ ├── codeactionvisitor.cpp │ ├── codeactionvisitor.hpp │ ├── completion.cpp │ ├── completion.hpp │ ├── documentsymbolvisitor.cpp │ ├── documentsymbolvisitor.hpp │ ├── foldingrangevisitor.cpp │ ├── foldingrangevisitor.hpp │ ├── formatting.cpp │ ├── formatting.hpp │ ├── hover.cpp │ ├── hover.hpp │ ├── inlayhintvisitor.cpp │ ├── inlayhintvisitor.hpp │ ├── langserver.cpp │ ├── langserver.hpp │ ├── langserveroptions.hpp │ ├── langserverutils.hpp │ ├── meson.build │ ├── semantictokensvisitor.cpp │ ├── semantictokensvisitor.hpp │ ├── task.cpp │ ├── task.hpp │ ├── workspace.cpp │ └── workspace.hpp ├── liblog │ ├── log.cpp │ ├── log.hpp │ └── meson.build ├── libls │ ├── ls.cpp │ ├── ls.hpp │ └── meson.build ├── liblsptypes │ ├── lsptypes.hpp │ └── meson.build ├── libobjects │ ├── argument.hpp │ ├── deprecationstate.hpp │ ├── function.cpp │ ├── function.hpp │ ├── meson.build │ ├── type.hpp │ └── version.hpp ├── libparsing │ ├── lexer.cpp │ ├── lexer.hpp │ ├── lexerstats.cpp │ ├── lexingtool.cpp │ ├── meson.build │ ├── parser.cpp │ ├── parser.hpp │ ├── parserbench.cpp │ ├── parserstats.cpp │ └── parsingtool.cpp ├── libtypenamespace │ ├── addedData.csv │ ├── deprecations.csv │ ├── functiondocs.def │ ├── functions.def │ ├── genfunctions.py │ ├── genmethods.py │ ├── genobjectdocs.py │ ├── meson.build │ ├── methoddocs.def │ ├── methods.def │ ├── objectdocs.def │ ├── shared.py │ ├── typenamespace.cpp │ └── typenamespace.hpp ├── libutils │ ├── meson.build │ ├── utils.cpp │ └── utils.hpp ├── libwrap │ ├── filewrap.cpp │ ├── gitwrap.cpp │ ├── hgwrap.cpp │ ├── meson.build │ ├── svnwrap.cpp │ ├── vcswrap.cpp │ ├── wrap.cpp │ └── wrap.hpp ├── lint │ ├── linter.cpp │ ├── linter.hpp │ ├── lintingconfig.cpp │ ├── lintingconfig.hpp │ ├── main.cpp │ └── meson.build ├── main.cpp ├── meson.build ├── polyfill │ ├── meson.build │ └── polyfill.hpp └── vcs_version.h.in ├── subprojects ├── .gitignore ├── ada.wrap ├── google-benchmark.wrap ├── gtest.wrap ├── mimalloc.wrap ├── muon.wrap ├── nlohmann_json.wrap ├── packagefiles │ ├── ada │ │ └── meson.build │ ├── sha256 │ │ └── meson.build │ ├── tree-sitter-0.20.8 │ │ └── meson.build │ ├── tree-sitter-ini │ │ └── meson.build │ └── tree-sitter-meson │ │ └── meson.build ├── pkgconf.wrap ├── sha256.wrap ├── tomlplusplus.wrap ├── tree-sitter-ini.wrap ├── tree-sitter-meson.wrap └── tree-sitter.wrap └── tests ├── integration ├── meson.build ├── partial-interpreter-test │ ├── dict+iter.meson │ ├── dict+join_path.meson │ ├── foreach.meson │ ├── format.meson │ ├── gdkpixbuf.meson │ ├── goa.meson │ ├── grilo.meson │ ├── harfbuzz.meson │ ├── imgui-options.meson │ ├── imgui.meson │ ├── replace.meson │ ├── underscorify.meson │ ├── vpx2.meson │ ├── vpx8.meson │ └── wayland.meson ├── partial-interpreter-tester.cpp ├── subproj │ ├── meson.build │ ├── test │ │ ├── add_test.cpp │ │ └── meson.build │ └── vendor │ │ └── catch2.wrap ├── type-analyzer-test │ ├── assignment.meson │ ├── basictests.meson │ ├── binaryexpression.meson │ ├── build_target.meson │ ├── get_method_improved.meson │ ├── options.meson │ ├── options_options.meson │ └── selectionstatement.meson ├── type-analyzer-tester.cpp ├── workspace-test │ ├── meson.build │ ├── meson.options │ └── subdir │ │ └── meson.build ├── workspace-tester.cpp ├── wrap-test │ ├── libswiftdemangle.wrap │ ├── libswiftdemangle2.wrap │ ├── miniz.wrap │ ├── packagefiles │ │ ├── miniz │ │ │ └── meson.build │ │ ├── pango-1.50.12 │ │ │ └── 0001-meson-Fix-pangoft2.pc-when-using-freetype-and-fontco.patch │ │ └── turtle │ │ │ └── meson.build │ ├── pango.wrap │ ├── pidgin.wrap │ ├── rubberband.wrap │ ├── rustc-demangle.wrap │ ├── sqlite.wrap │ ├── turtle.wrap │ ├── turtle2.wrap │ ├── turtle3.wrap │ └── vorbis.wrap └── wrap-tester.cpp ├── libanalyze ├── meson.build └── optiondiagnostics.cpp ├── libast ├── meson.build └── test.cpp ├── libcxathrow ├── meson.build └── test.cpp ├── libjsonrpc ├── meson.build └── test.cpp ├── liblog ├── meson.build └── test.cpp ├── libparsing ├── lextest.cpp └── meson.build ├── libtypenamespace ├── meson.build └── test.cpp ├── libutils ├── meson.build ├── processtest.cpp └── test.cpp └── meson.build /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | InsertNewlineAtEOF: true 3 | InsertBraces: true 4 | IncludeBlocks: Regroup 5 | SeparateDefinitionBlocks: Always 6 | SortIncludes: CaseSensitive 7 | Standard: Latest 8 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: | 2 | bugprone-*, 3 | cert-*, 4 | clang-analyzer-*, 5 | concurrency-*, 6 | misc-*, 7 | modernize-*, 8 | performance-*, 9 | readability-*, 10 | -performance-avoid-endl, 11 | -misc-no-recursion, 12 | -modernize-use-trailing-return-type, 13 | -misc-non-private-member-variables-in-classes, 14 | -bugprone-easily-swappable-parameters, 15 | -misc-use-anonymous-namespace, 16 | -readability-function-cognitive-complexity 17 | WarningsAsErrors: "" 18 | HeaderFilterRegex: "" 19 | FormatStyle: none 20 | 21 | CheckOptions: 22 | - { key: readability-identifier-naming.NamespaceCase, value: lower_case } 23 | - { key: readability-identifier-naming.StructCase, value: CamelCase } 24 | - { key: readability-identifier-naming.ClassCase, value: CamelCase } 25 | - { key: readability-identifier-naming.ClassMethodCase, value: camelBack } 26 | - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } 27 | - { key: readability-identifier-naming.ClassMemberCase, value: camelBack } 28 | - { key: readability-identifier-naming.EnumCase, value: CamelCase } 29 | - { 30 | key: readability-identifier-naming.ScopedEnumConstantCase, 31 | value: UPPER_CASE, 32 | } 33 | - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase } 34 | - { key: readability-identifier-naming.FunctionCase, value: camelBack } 35 | - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } 36 | - { key: readability-identifier-naming.LocalConstantCase, value: camelBack } 37 | - { key: readability-identifier-naming.LocalVariableCase, value: camelBack } 38 | - { 39 | key: readability-identifier-naming.MacroDefinitionCase, 40 | value: UPPER_CASE, 41 | } 42 | - { key: readability-identifier-naming.ParameterCase, value: camelBack } 43 | - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } 44 | - { key: readability-identifier-naming.VariableCase, value: camelBack } 45 | - { 46 | key: readability-implicit-bool-conversion.AllowPointerConditions, 47 | value: true, 48 | } 49 | - { 50 | key: readability-identifier-length.IgnoredVariableNames, 51 | value: "al|fe|me|sl|be|ce|il|ns|bd|op", 52 | } 53 | - { 54 | key: readability-identifier-length.IgnoredParameterNames, 55 | value: "al|fe|me|sl|be|ce|il|ns|bd|op", 56 | } 57 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Clone $URL 16 | 2. Open the project in $EDITOR 17 | 3. Do stuff at the file foo at line bar, column baz 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots/Screencasts** 24 | If applicable, add screenshots/screencasts to help explain your problem. 25 | 26 | **System info** 27 | - OS: For Linux please add your distribution and how you installed Swift-MesonLSP 28 | - Editor: 29 | - Version: 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Will you write a patch?** 20 | 21 | **Will you maintain it, if you submit a patch?** 22 | 23 | **Additional context** 24 | Add any other context or screenshots about the feature request here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/sweep-template.yml: -------------------------------------------------------------------------------- 1 | name: Sweep Issue 2 | title: 'Sweep: ' 3 | description: For small bugs, features, refactors, and tests to be handled by Sweep, an AI-powered junior developer. 4 | labels: sweep 5 | body: 6 | - type: textarea 7 | id: description 8 | attributes: 9 | label: Details 10 | description: Tell Sweep where and what to edit and provide enough context for a new developer to the codebase 11 | placeholder: | 12 | Unit Tests: Write unit tests for . Test each function in the file. Make sure to test edge cases. 13 | Bugs: The bug might be in . Here are the logs: ... 14 | Features: the new endpoint should use the ... class from because it contains ... logic. 15 | Refactors: We are migrating this function to ... version because ... 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Replace this paragraph with a description of your changes and rationale. 2 | 3 | Checklist: 4 | - [ ] Did you update the CHANGELOG? 5 | - [ ] If you introduced dependencies: Did you update the `mesonlsp.spec`, `scripts/create_license_file.sh` and *all* GitHub Actions files? 6 | - [ ] Did you run a profiler, if you inserted a lot of C++ code, especially in the Lexer, Parser or the Type Analyzer? 7 | 8 | Fixes #NNNN 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | 13 | - package-ecosystem: docker 14 | directory: / 15 | schedule: 16 | interval: daily 17 | -------------------------------------------------------------------------------- /.github/workflows/Coverage.yml: -------------------------------------------------------------------------------- 1 | name: Collect Coverage 2 | on: 3 | push: 4 | branches: ["main"] 5 | pull_request: 6 | branches: ["main"] 7 | workflow_dispatch: 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | coverage: 13 | runs-on: ubuntu-latest 14 | container: 15 | image: fedora:39 16 | steps: 17 | - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 18 | - name: Collecting coverage 19 | shell: bash 20 | env: 21 | CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} 22 | run: | 23 | sudo dnf install lcov zip ninja-build google-benchmark-devel gcc g++ git pip libcurl-devel glibc-static libarchive-devel gtest gtest-devel libpkgconf-devel libuuid-devel uuid python3-pip pkgconf-pkg-config mercurial subversion -y 24 | pip install meson pygls lsprotocol 25 | sudo dnf clean all 26 | meson _build -Db_coverage=true 27 | ninja -C _build test 28 | echo "ignore_errors=mismatch,negative" > ~/.lcovrc 29 | ninja -C _build coverage || true 30 | cp _build/meson-logs/coverage.info out.lcov 31 | bash <(curl -s https://codecov.io/bash) 32 | -------------------------------------------------------------------------------- /.github/workflows/Sonar.yml: -------------------------------------------------------------------------------- 1 | name: SonarCloud 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | build: 10 | name: Build and analyze 11 | runs-on: ubuntu-latest 12 | container: 13 | image: fedora:latest 14 | env: 15 | BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory 16 | steps: 17 | - name: Harden Runner 18 | uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 19 | with: 20 | egress-policy: audit 21 | 22 | - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 23 | with: 24 | fetch-depth: 0 25 | - name: Install deps 26 | run: | 27 | dnf install -y unzip zip ninja-build gcc google-benchmark-devel g++ git python3-pip libcurl-devel glibc-static libarchive-devel gtest gtest-devel libpkgconf-devel libuuid-devel pkgconf-pkg-config 28 | pip install meson pygls lsprotocol 29 | dnf clean all 30 | - name: Install sonar-scanner and build-wrapper 31 | uses: SonarSource/sonarcloud-github-c-cpp@816b1822d71776ee0d32bc012e95024ec52ac1fc # v3.1.0 32 | - name: Run build-wrapper 33 | run: | 34 | meson _build 35 | build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} meson compile -C _build 36 | - name: Extract branch name 37 | shell: bash 38 | run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT 39 | id: extract_branch 40 | - name: Run sonar-scanner 41 | env: 42 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 43 | run: | 44 | sonar-scanner -X -Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }} -Dsonar.projectSettings=sonar-project.properties --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" 45 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | # Dependency Review Action 2 | # 3 | # This Action will scan dependency manifest files that change as part of a Pull Request, 4 | # surfacing known-vulnerable versions of the packages declared or updated in the PR. 5 | # Once installed, if the workflow run is marked as required, 6 | # PRs introducing known-vulnerable packages will be blocked from merging. 7 | # 8 | # Source repository: https://github.com/actions/dependency-review-action 9 | name: 'Dependency Review' 10 | on: [pull_request] 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | dependency-review: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Harden Runner 20 | uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 21 | with: 22 | egress-policy: audit 23 | 24 | - name: 'Checkout Repository' 25 | uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 26 | - name: 'Dependency Review' 27 | uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | .gdb_history 3 | .vscode/ 4 | 3rdparty.txt 5 | failures.txt 6 | subprojects/ada/ 7 | subprojects/benchmark-1.7.1/ 8 | subprojects/googletest-1.14.0/ 9 | subprojects/mimalloc/ 10 | subprojects/muon/ 11 | subprojects/nlohmann_json-3.11.2/ 12 | subprojects/pkgconf-2.1.1/ 13 | subprojects/sha256/ 14 | subprojects/tinyjson.wrap 15 | subprojects/tomlplusplus-3.4.0/ 16 | subprojects/tree-sitter-0.20.8/ 17 | subprojects/tree-sitter-ini/ 18 | subprojects/tree-sitter-meson/ 19 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/gitleaks/gitleaks 3 | rev: v8.16.3 4 | hooks: 5 | - id: gitleaks 6 | - repo: https://github.com/jumanjihouse/pre-commit-hooks 7 | rev: 3.0.0 8 | hooks: 9 | - id: shellcheck 10 | - repo: https://github.com/pre-commit/pre-commit-hooks 11 | rev: v4.4.0 12 | hooks: 13 | - id: end-of-file-fixer 14 | - id: trailing-whitespace 15 | - repo: https://github.com/pecigonzalo/pre-commit-shfmt 16 | rev: v2.1.0 17 | hooks: 18 | - id: shell-fmt 19 | args: 20 | - -i 21 | - "0" 22 | exclude: "tests/integration/wrap-test/packagefiles/pango-1.50.12/.*" 23 | -------------------------------------------------------------------------------- /Benchmarks/.gitignore: -------------------------------------------------------------------------------- 1 | generated.js 2 | -------------------------------------------------------------------------------- /Benchmarks/4.1.0.json: -------------------------------------------------------------------------------- 1 | {"time": 1710399679.1449068, "commit": "4.1.0", "size": 63995056, "stripped_size": 5226088, "quick": {"bsdutils": 240.875, "bubblewrap": 62.818, "budgie-desktop": 342.282, "bzip2": 51.647999999999996, "cglm": 24.398, "cinnamon-desktop": 59.596999999999994, "code": 106.724, "dbus-broker": 78.248, "dxvk": 108.49000000000001, "evince": 234.921, "frida-core": 256.685, "fwupd": 1124.182, "gitg": 140.935, "gjs": 187.493, "glib": 1171.214, "gnome-shell": 200.98499999999999, "hexchat": 224.24099999999999, "igt-gpu-tools": 284.879, "knot-resolver": 276.45300000000003, "le": 145.57600000000002, "libswiftdemangle": 25.37, "libvips": 281.281, "libvirt": 1301.3799999999999, "lxc": 397.205, "miniz": 20.325, "mpv": 371.536, "pipewire": 634.78, "rustc-demangle": 23.253, "scipy": 558.24, "systemd": 1588.2920000000001, "vte": 215.65, "xts": 375.26300000000003, "zrythm": 716.401, "gnome-builder": 893.2520000000001, "GNOME-Builder-Plugins": 136.92399999999998, "gtk": 833.914, "mesa": 2699.661, "postgres": 1931.276, "qemu": 2174.5879999999997}, "misc": {"parsing": 11454.712000000001, "memory_allocations": 100578983, "temporary_memory_allocations": 2486904, "peak_heap": "8.66M", "peak_rss": "38.79M"}, "projects": [{"name": "gnome-builder", "parsing": 9373.775, "memory_allocations": 7271225, "temporary_memory_allocations": 221250, "peak_heap": "4.59M", "peak_rss": "19.74M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1572.269, "memory_allocations": 1134769, "temporary_memory_allocations": 24746, "peak_heap": "1.52M", "peak_rss": "15.60M"}, {"name": "gtk", "parsing": 9108.980000000001, "memory_allocations": 7500136, "temporary_memory_allocations": 177753, "peak_heap": "4.67M", "peak_rss": "22.68M"}, {"name": "mesa", "parsing": 29981.834, "memory_allocations": 22043743, "temporary_memory_allocations": 371253, "peak_heap": "11.07M", "peak_rss": "31.99M"}, {"name": "postgres", "parsing": 20188.773, "memory_allocations": 15183943, "temporary_memory_allocations": 420451, "peak_heap": "8.55M", "peak_rss": "28.02M"}, {"name": "qemu", "parsing": 23352.540999999997, "memory_allocations": 17841245, "temporary_memory_allocations": 673754, "peak_heap": "11.08M", "peak_rss": "32.09M"}], "floss": {"elementary": {"parsing": 3022.54, "memory_allocations": 21257194, "temporary_memory_allocations": 659838, "peak_heap": "2.11M", "peak_rss": "17.52M"}, "gnome": {"parsing": 26644.625, "memory_allocations": 202088389, "temporary_memory_allocations": 5532587, "peak_heap": "6.04M", "peak_rss": "38.19M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/README.md: -------------------------------------------------------------------------------- 1 | ### Benchmarking Website 2 | This is a small website showing some stats about each version. 3 | 4 | Run using 5 | ``` 6 | make serve 7 | ``` 8 | and open the browser at [http://0.0.0.0:8000/](http://0.0.0.0:8000/) 9 | -------------------------------------------------------------------------------- /Benchmarks/c++-2.json: -------------------------------------------------------------------------------- 1 | {"time": 1705080569.5567024, "commit": "c++-2", "size": 54963224, "stripped_size": 4219456, "quick": {"bsdutils": 746.043, "bubblewrap": 163.692, "budgie-desktop": 1381.288, "bzip2": 131.75, "cglm": 58.234, "cinnamon-desktop": 199.306, "code": 354.209, "dbus-broker": 253.48199999999997, "dxvk": 341.42499999999995, "evince": 891.953, "frida-core": 1053.879, "fwupd": 3850.006, "gitg": 483.76000000000005, "gjs": 735.271, "glib": 6285.855, "gnome-shell": 787.705, "hexchat": 702.037, "igt-gpu-tools": 1211.0149999999999, "knot-resolver": 1006.327, "le": 474.9, "libswiftdemangle": 37.593, "libvips": 1160.425, "libvirt": 6512.815, "lxc": 1632.535, "miniz": 21.774, "mpv": 1639.954, "pipewire": 3067.866, "rustc-demangle": 30.511, "scipy": 2479.801, "systemd": 9973.864000000001, "vte": 866.574, "xts": 1691.154, "zrythm": 3195.872, "gnome-builder": 4106.133, "GNOME-Builder-Plugins": 314.409, "gtk": 4249.634, "mesa": 19548.864999999998, "postgres": 9759.575, "qemu": 12601.085}, "misc": {"parsing": 53071.65, "memory_allocations": 361438131, "temporary_memory_allocations": 2946282, "peak_heap": "8.78M", "peak_rss": "39.22M"}, "projects": [{"name": "gnome-builder", "parsing": 42533.149000000005, "memory_allocations": 27575864, "temporary_memory_allocations": 255916, "peak_heap": "5.07M", "peak_rss": "21.11M"}, {"name": "GNOME-Builder-Plugins", "parsing": 3136.79, "memory_allocations": 1614585, "temporary_memory_allocations": 26393, "peak_heap": "1.45M", "peak_rss": "16.12M"}, {"name": "gtk", "parsing": 44448.874, "memory_allocations": 26847991, "temporary_memory_allocations": 218139, "peak_heap": "5.12M", "peak_rss": "22.81M"}, {"name": "mesa", "parsing": 187925.17799999999, "memory_allocations": 154259109, "temporary_memory_allocations": 661846, "peak_heap": "12.72M", "peak_rss": "34.26M"}, {"name": "postgres", "parsing": 100010.719, "memory_allocations": 69468215, "temporary_memory_allocations": 536152, "peak_heap": "9.49M", "peak_rss": "28.99M"}, {"name": "qemu", "parsing": 121842.398, "memory_allocations": 82255208, "temporary_memory_allocations": 586743, "peak_heap": "11.69M", "peak_rss": "33.53M"}], "floss": {"elementary": {"parsing": 8492.305999999999, "memory_allocations": 43905548, "temporary_memory_allocations": 694220, "peak_heap": "2.18M", "peak_rss": "18.44M"}, "gnome": {"parsing": 103932.542, "memory_allocations": 560680853, "temporary_memory_allocations": 6629769, "peak_heap": "6.71M", "peak_rss": "40.21M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/c++-3.json: -------------------------------------------------------------------------------- 1 | {"time": 1705255092.3972933, "commit": "c++-3", "size": 54940680, "stripped_size": 4211296, "quick": {"bsdutils": 671.5759999999999, "bubblewrap": 163.57399999999998, "budgie-desktop": 1279.816, "bzip2": 126.226, "cglm": 56.501999999999995, "cinnamon-desktop": 195.618, "code": 345.886, "dbus-broker": 239.578, "dxvk": 325.724, "evince": 782.417, "frida-core": 898.883, "fwupd": 3104.605, "gitg": 490.47400000000005, "gjs": 693.573, "glib": 4225.539000000001, "gnome-shell": 729.6859999999999, "hexchat": 645.965, "igt-gpu-tools": 1036.979, "knot-resolver": 891.068, "le": 423.554, "libswiftdemangle": 36.785, "libvips": 1016.499, "libvirt": 4382.675, "lxc": 1469.9, "miniz": 21.96, "mpv": 1518.267, "pipewire": 2307.374, "rustc-demangle": 28.902, "scipy": 2373.129, "systemd": 6748.058, "vte": 750.655, "xts": 1806.2959999999998, "zrythm": 2535.408, "gnome-builder": 3467.829, "GNOME-Builder-Plugins": 339.12, "gtk": 3745.483, "mesa": 11606.819, "postgres": 6813.728, "qemu": 8688.447999999999}, "misc": {"parsing": 42150.949, "memory_allocations": 175797830, "temporary_memory_allocations": 2238680, "peak_heap": "8.55M", "peak_rss": "36.50M"}, "projects": [{"name": "gnome-builder", "parsing": 33655.087, "memory_allocations": 12663065, "temporary_memory_allocations": 205316, "peak_heap": "4.96M", "peak_rss": "20.97M"}, {"name": "GNOME-Builder-Plugins", "parsing": 3184.723, "memory_allocations": 1400886, "temporary_memory_allocations": 20793, "peak_heap": "1.44M", "peak_rss": "16.24M"}, {"name": "gtk", "parsing": 35824.142, "memory_allocations": 14185092, "temporary_memory_allocations": 156439, "peak_heap": "4.95M", "peak_rss": "22.20M"}, {"name": "mesa", "parsing": 111591.28, "memory_allocations": 39638110, "temporary_memory_allocations": 384346, "peak_heap": "12.01M", "peak_rss": "32.19M"}, {"name": "postgres", "parsing": 74233.144, "memory_allocations": 26424216, "temporary_memory_allocations": 425252, "peak_heap": "9.16M", "peak_rss": "27.59M"}, {"name": "qemu", "parsing": 89811.746, "memory_allocations": 32244508, "temporary_memory_allocations": 428142, "peak_heap": "11.32M", "peak_rss": "31.65M"}], "floss": {"elementary": {"parsing": 8600.664, "memory_allocations": 37283548, "temporary_memory_allocations": 524119, "peak_heap": "2.15M", "peak_rss": "17.90M"}, "gnome": {"parsing": 90442.104, "memory_allocations": 367168750, "temporary_memory_allocations": 5202765, "peak_heap": "6.47M", "peak_rss": "36.52M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/c++-4.json: -------------------------------------------------------------------------------- 1 | {"time": 1705728011.80159, "commit": "c++-4", "size": 56217640, "stripped_size": 4228128, "quick": {"bsdutils": 631.092, "bubblewrap": 148.418, "budgie-desktop": 1167.716, "bzip2": 126.437, "cglm": 55.239999999999995, "cinnamon-desktop": 182.115, "code": 309.516, "dbus-broker": 223.105, "dxvk": 316.52599999999995, "evince": 706.072, "frida-core": 804.0469999999999, "fwupd": 2597.04, "gitg": 438.739, "gjs": 582.943, "glib": 3665.128, "gnome-shell": 653.008, "hexchat": 581.693, "igt-gpu-tools": 973.8599999999999, "knot-resolver": 877.522, "le": 371.49100000000004, "libswiftdemangle": 35.794, "libvips": 886.448, "libvirt": 4057.7360000000003, "lxc": 1149.6219999999998, "miniz": 20.845, "mpv": 1311.97, "pipewire": 1961.868, "rustc-demangle": 28.222, "scipy": 1997.626, "systemd": 5769.208, "vte": 701.0079999999999, "xts": 1523.235, "zrythm": 2417.3399999999997, "gnome-builder": 2726.489, "GNOME-Builder-Plugins": 303.92999999999995, "gtk": 2746.752, "mesa": 8870.08, "postgres": 5951.849, "qemu": 6974.04}, "misc": {"parsing": 36102.559, "memory_allocations": 175697421, "temporary_memory_allocations": 1855347, "peak_heap": "8.69M", "peak_rss": "36.36M"}, "projects": [{"name": "gnome-builder", "parsing": 30842.037, "memory_allocations": 12701968, "temporary_memory_allocations": 176792, "peak_heap": "5.00M", "peak_rss": "19.92M"}, {"name": "GNOME-Builder-Plugins", "parsing": 3016.7799999999997, "memory_allocations": 1400110, "temporary_memory_allocations": 17288, "peak_heap": "1.45M", "peak_rss": "15.19M"}, {"name": "gtk", "parsing": 33111.238999999994, "memory_allocations": 14066477, "temporary_memory_allocations": 123395, "peak_heap": "4.92M", "peak_rss": "21.09M"}, {"name": "mesa", "parsing": 95665.632, "memory_allocations": 39312588, "temporary_memory_allocations": 234295, "peak_heap": "11.96M", "peak_rss": "31.95M"}, {"name": "postgres", "parsing": 64268.141, "memory_allocations": 26451890, "temporary_memory_allocations": 397093, "peak_heap": "9.27M", "peak_rss": "26.85M"}, {"name": "qemu", "parsing": 81529.538, "memory_allocations": 32261089, "temporary_memory_allocations": 397497, "peak_heap": "11.35M", "peak_rss": "31.42M"}], "floss": {"elementary": {"parsing": 9682.681, "memory_allocations": 37293338, "temporary_memory_allocations": 485980, "peak_heap": "2.15M", "peak_rss": "16.89M"}, "gnome": {"parsing": 86369.889, "memory_allocations": 366815230, "temporary_memory_allocations": 4475629, "peak_heap": "6.49M", "peak_rss": "35.55M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/c++-5.json: -------------------------------------------------------------------------------- 1 | {"time": 1707400303.1385932, "commit": "c++-5", "size": 62089696, "stripped_size": 4547336, "quick": {"bsdutils": 354.149, "bubblewrap": 75.685, "budgie-desktop": 539.2289999999999, "bzip2": 62.085, "cglm": 27.551, "cinnamon-desktop": 87.93299999999999, "code": 150.79999999999998, "dbus-broker": 103.30799999999999, "dxvk": 146.891, "evince": 372.49100000000004, "frida-core": 374.218, "fwupd": 1656.531, "gitg": 201.877, "gjs": 294.42600000000004, "glib": 1855.345, "gnome-shell": 301.94300000000004, "hexchat": 284.685, "igt-gpu-tools": 449.85999999999996, "knot-resolver": 388.256, "le": 195.23399999999998, "libswiftdemangle": 21.529, "libvips": 443.587, "libvirt": 1872.742, "lxc": 558.217, "miniz": 14.578000000000001, "mpv": 585.176, "pipewire": 1006.117, "rustc-demangle": 19.503, "scipy": 954.822, "systemd": 2625.712, "vte": 333.383, "xts": 580.387, "zrythm": 1145.221, "gnome-builder": 1375.324, "GNOME-Builder-Plugins": 149.634, "gtk": 1411.98, "mesa": 4498.984, "postgres": 3024.473, "qemu": 3715.164}, "misc": {"parsing": 17947.748, "memory_allocations": 131754440, "temporary_memory_allocations": 1799991, "peak_heap": "9.02M", "peak_rss": "41.52M"}, "projects": [{"name": "gnome-builder", "parsing": 13870.153, "memory_allocations": 9569787, "temporary_memory_allocations": 158971, "peak_heap": "4.85M", "peak_rss": "20.75M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1593.893, "memory_allocations": 1040431, "temporary_memory_allocations": 17388, "peak_heap": "1.44M", "peak_rss": "15.56M"}, {"name": "gtk", "parsing": 14309.512, "memory_allocations": 10478768, "temporary_memory_allocations": 112995, "peak_heap": "4.69M", "peak_rss": "22.51M"}, {"name": "mesa", "parsing": 46737.03, "memory_allocations": 30019505, "temporary_memory_allocations": 412552, "peak_heap": "11.24M", "peak_rss": "34.61M"}, {"name": "postgres", "parsing": 30731.065000000002, "memory_allocations": 19955605, "temporary_memory_allocations": 371116, "peak_heap": "9.11M", "peak_rss": "30.32M"}, {"name": "qemu", "parsing": 37350.108, "memory_allocations": 23990807, "temporary_memory_allocations": 381196, "peak_heap": "11.32M", "peak_rss": "36.43M"}], "floss": {"elementary": {"parsing": 4213.669000000001, "memory_allocations": 27140556, "temporary_memory_allocations": 526822, "peak_heap": "2.15M", "peak_rss": "17.86M"}, "gnome": {"parsing": 38940.022, "memory_allocations": 266730281, "temporary_memory_allocations": 4536500, "peak_heap": "6.42M", "peak_rss": "38.38M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/c++-6.json: -------------------------------------------------------------------------------- 1 | {"time": 1707813799.7042806, "commit": "c++-6", "size": 61037064, "stripped_size": 4530904, "quick": {"bsdutils": 285.185, "bubblewrap": 71.909, "budgie-desktop": 433.131, "bzip2": 59.773, "cglm": 25.136, "cinnamon-desktop": 71.926, "code": 126.801, "dbus-broker": 93.955, "dxvk": 128.792, "evince": 294.842, "frida-core": 315.71700000000004, "fwupd": 1314.6119999999999, "gitg": 173.49200000000002, "gjs": 230.118, "glib": 1531.8609999999999, "gnome-shell": 247.072, "hexchat": 251.88100000000003, "igt-gpu-tools": 368.905, "knot-resolver": 329.732, "le": 167.36, "libswiftdemangle": 27.206999999999997, "libvips": 338.923, "libvirt": 1508.9109999999998, "lxc": 444.217, "miniz": 21.769000000000002, "mpv": 440.282, "pipewire": 785.653, "rustc-demangle": 25.606, "scipy": 782.124, "systemd": 2014.4860000000003, "vte": 268.67600000000004, "xts": 459.476, "zrythm": 868.742, "gnome-builder": 1103.194, "GNOME-Builder-Plugins": 133.677, "gtk": 1125.096, "mesa": 3802.987, "postgres": 2470.548, "qemu": 2827.681}, "misc": {"parsing": 14266.242999999999, "memory_allocations": 124833040, "temporary_memory_allocations": 1696669, "peak_heap": "8.68M", "peak_rss": "39.27M"}, "projects": [{"name": "gnome-builder", "parsing": 11008.409, "memory_allocations": 8751487, "temporary_memory_allocations": 158801, "peak_heap": "4.55M", "peak_rss": "19.89M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1374.5890000000002, "memory_allocations": 988831, "temporary_memory_allocations": 15688, "peak_heap": "1.42M", "peak_rss": "15.70M"}, {"name": "gtk", "parsing": 11601.198, "memory_allocations": 9890808, "temporary_memory_allocations": 111381, "peak_heap": "4.67M", "peak_rss": "21.76M"}, {"name": "mesa", "parsing": 38159.337999999996, "memory_allocations": 28095505, "temporary_memory_allocations": 192657, "peak_heap": "11.07M", "peak_rss": "32.32M"}, {"name": "postgres", "parsing": 23707.925, "memory_allocations": 18816905, "temporary_memory_allocations": 351507, "peak_heap": "8.54M", "peak_rss": "28.90M"}, {"name": "qemu", "parsing": 28771.7, "memory_allocations": 22979907, "temporary_memory_allocations": 372596, "peak_heap": "11.10M", "peak_rss": "33.41M"}], "floss": {"elementary": {"parsing": 3369.696, "memory_allocations": 25399256, "temporary_memory_allocations": 444731, "peak_heap": "2.12M", "peak_rss": "17.43M"}, "gnome": {"parsing": 32401.091, "memory_allocations": 250162776, "temporary_memory_allocations": 4122783, "peak_heap": "6.05M", "peak_rss": "38.24M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/c++-7.json: -------------------------------------------------------------------------------- 1 | {"time": 1709222431.2108984, "commit": "c++-7", "size": 63726960, "stripped_size": 5209352, "quick": {"bsdutils": 275.646, "bubblewrap": 66.998, "budgie-desktop": 372.498, "bzip2": 53.284, "cglm": 28.644, "cinnamon-desktop": 66.741, "code": 115.929, "dbus-broker": 85.68199999999999, "dxvk": 124.637, "evince": 315.682, "frida-core": 279.34, "fwupd": 1203.215, "gitg": 152.977, "gjs": 215.78300000000002, "glib": 1326.504, "gnome-shell": 209.85500000000002, "hexchat": 222.83800000000002, "igt-gpu-tools": 307.69800000000004, "knot-resolver": 298.252, "le": 151.738, "libswiftdemangle": 26.759, "libvips": 313.82300000000004, "libvirt": 1358.782, "lxc": 370.576, "miniz": 21.296, "mpv": 405.51300000000003, "pipewire": 689.065, "rustc-demangle": 24.125, "scipy": 614.2800000000001, "systemd": 1764.235, "vte": 233.084, "xts": 399.486, "zrythm": 770.512, "gnome-builder": 970.155, "GNOME-Builder-Plugins": 127.37799999999999, "gtk": 924.283, "mesa": 2924.7909999999997, "postgres": 2092.237, "qemu": 2373.828}, "misc": {"parsing": 13777.454, "memory_allocations": 100455783, "temporary_memory_allocations": 2486804, "peak_heap": "8.66M", "peak_rss": "38.54M"}, "projects": [{"name": "gnome-builder", "parsing": 10430.613, "memory_allocations": 7182925, "temporary_memory_allocations": 218650, "peak_heap": "4.55M", "peak_rss": "20.15M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1339.402, "memory_allocations": 881469, "temporary_memory_allocations": 19446, "peak_heap": "1.43M", "peak_rss": "15.60M"}, {"name": "gtk", "parsing": 10103.543, "memory_allocations": 7493136, "temporary_memory_allocations": 177753, "peak_heap": "4.67M", "peak_rss": "23.03M"}, {"name": "mesa", "parsing": 31912.726, "memory_allocations": 22017543, "temporary_memory_allocations": 371253, "peak_heap": "11.07M", "peak_rss": "31.97M"}, {"name": "postgres", "parsing": 22295.907, "memory_allocations": 15155643, "temporary_memory_allocations": 420451, "peak_heap": "8.55M", "peak_rss": "27.82M"}, {"name": "qemu", "parsing": 25483.298000000003, "memory_allocations": 17898545, "temporary_memory_allocations": 673754, "peak_heap": "11.07M", "peak_rss": "32.79M"}], "floss": {"elementary": {"parsing": 3130.093, "memory_allocations": 21200294, "temporary_memory_allocations": 659838, "peak_heap": "2.11M", "peak_rss": "17.38M"}, "gnome": {"parsing": 28637.27, "memory_allocations": 201675689, "temporary_memory_allocations": 5529887, "peak_heap": "6.04M", "peak_rss": "37.51M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/extract_git_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo "DIFFS = [" 3 | tags=$(git tag | grep -v v1.2.1 | grep -v v2.3.3 | grep -v v2.3.4 | grep -v v2.3.5 | grep -v v2.3.6 | grep -v 2.3.7 | grep -v 2.3.8 | grep -v 2.3.9 | grep -v 2.3.10 | grep -v 2.3.11 | grep -v 2.3.12 | grep -v 2.3.13 | grep -v 2.3.14 | grep -v 2.3.15 | grep -v 2.4.3) 4 | previous_tag="" 5 | for tag in $tags; do 6 | if [[ $tag == "v1.0" ]]; then 7 | diff_output=$(git diff --shortstat "$tag") 8 | else 9 | diff_output=$(git diff --shortstat "$previous_tag" "$tag") 10 | fi 11 | files_changed=$(echo "$diff_output" | awk '{print $1}') 12 | insertions=$(echo "$diff_output" | awk '{print $4}') 13 | deletions=$(echo "$diff_output" | awk '{print $6}') 14 | if [[ $tag == "v1.0" ]]; then 15 | commit_count=$(git rev-list --count "$tag") 16 | else 17 | commit_count=$(git rev-list --count "$previous_tag".."$tag") 18 | fi 19 | echo "[$files_changed, $insertions, $deletions, $commit_count]," 20 | previous_tag=$tag 21 | done 22 | echo "]" 23 | 24 | echo "HOURS = [" 25 | git log --format=%aD | sed s/...,.......//g | sed 's/^ //g' | cut -d ' ' -f2 | cut -d ':' -f1 | sort | uniq -c | sed 's/^ *//g' | sed s/\ 0/\ /g | sed s/^/[/g | sed s/\ /,/g | sed s/$/],/g 26 | echo "]" 27 | 28 | echo "DAYS = [" 29 | git log --format=%aD | sort | sed s/,.*//g | sort | uniq -c | sort -h | sed s/^\ *//g | sed 's/ /, \"/g' | sed s/$/\"],/g | sed s/^/[/g 30 | echo "]" 31 | -------------------------------------------------------------------------------- /Benchmarks/extract_tuples.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import subprocess 3 | import datetime 4 | import sys 5 | import json 6 | 7 | 8 | def extract_day_hour(date_str): 9 | date = datetime.datetime.strptime(date_str, '"%a %b %d %H:%M:%S %Y %z"') 10 | return date.strftime("%A"), date.strftime("%H") 11 | 12 | 13 | if __name__ == "__main__": 14 | try: 15 | git_log = subprocess.check_output( 16 | ["git", "log", '--pretty=format:"%ad"'], stderr=subprocess.STDOUT 17 | ).decode("utf-8") 18 | except subprocess.CalledProcessError as e: 19 | print(f"Error executing command: {e.returncode}") 20 | print(e.output.decode("utf-8")) 21 | sys.exit(1) 22 | commit_entries = git_log.split("\n") 23 | commit_data = {} 24 | for entry in commit_entries: 25 | if entry: 26 | day, hour = extract_day_hour(entry) 27 | if (day, hour) not in commit_data: 28 | commit_data[(day, hour)] = 1 29 | else: 30 | commit_data[(day, hour)] += 1 31 | json_data = [] 32 | days_of_week = [ 33 | "Monday", 34 | "Tuesday", 35 | "Wednesday", 36 | "Thursday", 37 | "Friday", 38 | "Saturday", 39 | "Sunday", 40 | ] 41 | 42 | for day in days_of_week: 43 | for hour in range(24): 44 | hour_str = str(hour).zfill(2) 45 | if (day, hour_str) in commit_data: 46 | json_data.append( 47 | { 48 | "day": day, 49 | "hour": hour_str, 50 | "commits": commit_data[(day, hour_str)], 51 | } 52 | ) 53 | else: 54 | json_data.append( 55 | { 56 | "day": day, 57 | "hour": hour_str, 58 | "commits": 0, 59 | } 60 | ) 61 | json_output = json.dumps(json_data, indent=2) 62 | print(json_output) 63 | -------------------------------------------------------------------------------- /Benchmarks/quick/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JSON File Uploader 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |

JSON File Uploader

17 | 18 |
19 |
20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Benchmarks/quick/styles.css: -------------------------------------------------------------------------------- 1 | .container { 2 | margin: 50px auto; 3 | width: 80%; 4 | text-align: center; 5 | } 6 | 7 | #fileContent { 8 | margin-top: 20px; 9 | border: 1px solid #ccc; 10 | padding: 10px; 11 | } 12 | 13 | .chart-container { 14 | display: inline-block; 15 | width: 33%; 16 | margin: 0; 17 | padding: 0; 18 | box-sizing: border-box; 19 | } 20 | -------------------------------------------------------------------------------- /Benchmarks/style.css: -------------------------------------------------------------------------------- 1 | .tab { 2 | overflow: hidden; 3 | background-color: #deddda; 4 | } 5 | 6 | /* Style the buttons that are used to open the tab content */ 7 | .tab button { 8 | background-color: inherit; 9 | float: left; 10 | border: none; 11 | outline: none; 12 | cursor: pointer; 13 | padding: 14px 16px; 14 | transition: 0.3s; 15 | } 16 | 17 | /* Change background color of buttons on hover */ 18 | .tab button:hover { 19 | background-color: #c0bfbc; 20 | } 21 | 22 | /* Create an active/current tablink class */ 23 | .tab button.active { 24 | background-color: #c0bfbc; 25 | } 26 | 27 | /* Style the tab content */ 28 | .tabcontent { 29 | display: none; 30 | padding: 6px 12px; 31 | border-top: none; 32 | } 33 | 34 | .tabcontent { 35 | animation: fadeEffect 1s; /* Fading effect takes 1 second */ 36 | } 37 | 38 | /* Go from zero to full opacity */ 39 | @keyframes fadeEffect { 40 | from { 41 | opacity: 0; 42 | } 43 | to { 44 | opacity: 1; 45 | } 46 | } 47 | 48 | .horizontal { 49 | display: flex; 50 | flex-direction: row; 51 | flex-wrap: nowrap; 52 | align-items: stretch; 53 | } 54 | 55 | .vertical { 56 | display: flex; 57 | flex-direction: column; 58 | flex-wrap: nowrap; 59 | align-items: stretch; 60 | } 61 | 62 | .child { 63 | flex: 1; 64 | } 65 | 66 | table { 67 | font-family: arial, sans-serif; 68 | border-collapse: collapse; 69 | width: 100%; 70 | } 71 | 72 | td, 73 | th { 74 | border: 1px solid #deddda; 75 | text-align: left; 76 | padding: 8px; 77 | } 78 | 79 | tr:nth-child(even) { 80 | background-color: #deddda; 81 | } 82 | 83 | #chart-container { 84 | display: flex; 85 | flex-wrap: wrap; 86 | justify-content: center; 87 | } 88 | 89 | #heatmap-container { 90 | display: grid; 91 | grid-template-columns: repeat(1, 1fr); 92 | grid-template-rows: repeat(7, 1fr); 93 | gap: 1px; 94 | } 95 | #heatmap { 96 | display: grid; 97 | grid-template-columns: repeat(24, 1fr); 98 | grid-template-rows: repeat(8, 1fr); 99 | gap: 1px; 100 | } 101 | 102 | .heatmap-cell { 103 | width: 100%; 104 | height: 100%; 105 | display: flex; 106 | min-width: 10px; 107 | align-items: center; 108 | justify-content: center; 109 | font-size: 14px; 110 | border: 1px solid #deddda; 111 | } 112 | -------------------------------------------------------------------------------- /Benchmarks/v1.1.json: -------------------------------------------------------------------------------- 1 | {"time": 1679964926.2000315, "commit": "v1.1", "size": 86592352, "stripped_size": 54934992, "quick": {"bsdutils": 3520.801, "bubblewrap": 656.9960399999999, "budgie-desktop": 5474.604, "bzip2": 492.1559, "cglm": 198.8659, "cinnamon-desktop": 743.72074, "code": 1511.3410000000001, "dbus-broker": 994.02034, "dxvk": 1400.73534, "evince": 3641.113, "frida-core": 4171.085, "fwupd": 6197.002, "gitg": 2048.495, "gjs": 2860.63, "glib": 22309.273, "gnome-shell": 2966.6800000000003, "hexchat": 3097.14, "igt-gpu-tools": 4698.612, "knot-resolver": 4123.389, "le": 2025.5960000000002, "libswiftdemangle": 152.16252, "libvips": 4851.1759999999995, "libvirt": 23167.748, "lxc": 6501.934, "miniz": 66.83594, "mpv": 5818.577, "pipewire": 10298.309, "rustc-demangle": 118.09554, "scipy": 9984.508, "systemd": 32537.236999999997, "vte": 3974.1, "xts": 6854.3, "zrythm": 13575.514, "gnome-builder": 17265.466, "GNOME-Builder-Plugins": 999.5959999999999, "gtk": 13734.99, "mesa": 60314.169, "postgres": 37417.131, "qemu": 41127.778}, "misc": {"parsing": 187268.68300000002, "memory_allocations": 451276910, "temporary_memory_allocations": 45866139, "peak_heap": "17.51M", "peak_rss": "83.85M"}, "projects": [{"name": "gnome-builder", "parsing": 174004.424, "memory_allocations": 47494589, "temporary_memory_allocations": 4790872, "peak_heap": "11.70M", "peak_rss": "40.44M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10094.498, "memory_allocations": 2622504, "temporary_memory_allocations": 374988, "peak_heap": "2.50M", "peak_rss": "25.34M"}, {"name": "gtk", "parsing": 137808.031, "memory_allocations": 32392067, "temporary_memory_allocations": 2812438, "peak_heap": "12.49M", "peak_rss": "47.51M"}, {"name": "mesa", "parsing": 592215.8339999999, "memory_allocations": 153955892, "temporary_memory_allocations": 10170276, "peak_heap": "26.27M", "peak_rss": "75.16M"}, {"name": "postgres", "parsing": 370635.84500000003, "memory_allocations": 104262555, "temporary_memory_allocations": 9856281, "peak_heap": "19.95M", "peak_rss": "64.65M"}, {"name": "qemu", "parsing": 400718.06, "memory_allocations": 107271275, "temporary_memory_allocations": 9983560, "peak_heap": "25.22M", "peak_rss": "78.61M"}], "floss": {"elementary": {"parsing": 37927.431, "memory_allocations": 90801252, "temporary_memory_allocations": 13222667, "peak_heap": "9.60M", "peak_rss": "36.42M"}, "gnome": {"parsing": 365058.426, "memory_allocations": 881145709, "temporary_memory_allocations": 101469136, "peak_heap": "17.08M", "peak_rss": "88.69M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v1.5.1.json: -------------------------------------------------------------------------------- 1 | {"time": 1680378759.0973575, "commit": "v1.5.1", "size": 96869088, "stripped_size": 57656720, "quick": {"bsdutils": 3053.592, "bubblewrap": 505.23412, "budgie-desktop": 4452.888, "bzip2": 413.24019999999996, "cglm": 176.58712, "cinnamon-desktop": 632.40806, "code": 1239.53026, "dbus-broker": 830.5172, "dxvk": 1155.50136, "evince": 2935.1020000000003, "frida-core": 3148.0190000000002, "fwupd": 11953.462, "gitg": 1676.3120000000001, "gjs": 2207.382, "glib": 16948.685999999998, "gnome-shell": 2446.509, "hexchat": 2330.009, "igt-gpu-tools": 3632.902, "knot-resolver": 3398.248, "le": 1756.688, "libswiftdemangle": 140.63783999999998, "libvips": 3932.4970000000003, "libvirt": 17242.486, "lxc": 4890.148, "miniz": 61.91436000000001, "mpv": 4219.9580000000005, "pipewire": 8452.766, "rustc-demangle": 114.43016, "scipy": 8725.769, "systemd": 23828.824999999997, "vte": 2984.179, "xts": 5796.727, "zrythm": 10964.009, "gnome-builder": 14127.582999999999, "GNOME-Builder-Plugins": 1044.94144, "gtk": 11445.429, "mesa": 46200.822, "postgres": 29484.48, "qemu": 33261.114}, "misc": {"parsing": 149758.241, "memory_allocations": 441076848, "temporary_memory_allocations": 38840340, "peak_heap": "12.78M", "peak_rss": "81.44M"}, "projects": [{"name": "gnome-builder", "parsing": 142004.74500000002, "memory_allocations": 45601557, "temporary_memory_allocations": 4676779, "peak_heap": "9.06M", "peak_rss": "39.06M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10519.067, "memory_allocations": 3676757, "temporary_memory_allocations": 480611, "peak_heap": "2.94M", "peak_rss": "25.82M"}, {"name": "gtk", "parsing": 114433.519, "memory_allocations": 32119305, "temporary_memory_allocations": 2366839, "peak_heap": "9.80M", "peak_rss": "46.92M"}, {"name": "mesa", "parsing": 457791.3, "memory_allocations": 115091834, "temporary_memory_allocations": 8698951, "peak_heap": "23.91M", "peak_rss": "73.97M"}, {"name": "postgres", "parsing": 291191.33900000004, "memory_allocations": 89501021, "temporary_memory_allocations": 8837352, "peak_heap": "16.50M", "peak_rss": "62.71M"}, {"name": "qemu", "parsing": 330008.056, "memory_allocations": 92863851, "temporary_memory_allocations": 7830360, "peak_heap": "23.56M", "peak_rss": "78.94M"}], "floss": {"elementary": {"parsing": 32780.448, "memory_allocations": 98257943, "temporary_memory_allocations": 11760920, "peak_heap": "5.13M", "peak_rss": "33.02M"}, "gnome": {"parsing": 321304.884, "memory_allocations": 939005777, "temporary_memory_allocations": 88075249, "peak_heap": "11.92M", "peak_rss": "88.37M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v1.5.json: -------------------------------------------------------------------------------- 1 | {"time": 1679943897.3321517, "commit": "v1.5", "size": 96839040, "stripped_size": 57648144, "quick": {"bsdutils": 3060.8759999999997, "bubblewrap": 507.44568, "budgie-desktop": 5004.551, "bzip2": 417.99016000000006, "cglm": 174.15916, "cinnamon-desktop": 629.07528, "code": 1232.26318, "dbus-broker": 822.94656, "dxvk": 1138.93274, "evince": 2961.078, "frida-core": 3117.172, "fwupd": 11835.66, "gitg": 1666.34, "gjs": 2219.353, "glib": 16868.179, "gnome-shell": 2462.831, "hexchat": 2318.3199999999997, "igt-gpu-tools": 3608.404, "knot-resolver": 3410.109, "le": 1740.8680000000002, "libswiftdemangle": 140.11244, "libvips": 3914.101, "libvirt": 17107.516, "lxc": 4843.051, "miniz": 61.48762, "mpv": 4167.723, "pipewire": 8310.9, "rustc-demangle": 112.8495, "scipy": 8599.012, "systemd": 23954.743000000002, "vte": 2928.891, "xts": 5763.662, "zrythm": 10920.002999999999, "gnome-builder": 14078.282, "GNOME-Builder-Plugins": 1031.6737999999998, "gtk": 11520.403999999999, "mesa": 46181.548, "postgres": 29655.211000000003, "qemu": 33722.326}, "misc": {"parsing": 152422.741, "memory_allocations": 441085633, "temporary_memory_allocations": 38838919, "peak_heap": "12.78M", "peak_rss": "81.42M"}, "projects": [{"name": "gnome-builder", "parsing": 140856.259, "memory_allocations": 45609373, "temporary_memory_allocations": 4676380, "peak_heap": "9.06M", "peak_rss": "39.06M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10377.869, "memory_allocations": 3675726, "temporary_memory_allocations": 480611, "peak_heap": "2.94M", "peak_rss": "25.43M"}, {"name": "gtk", "parsing": 112844.947, "memory_allocations": 32118314, "temporary_memory_allocations": 2366876, "peak_heap": "9.80M", "peak_rss": "46.53M"}, {"name": "mesa", "parsing": 470971.196, "memory_allocations": 115105086, "temporary_memory_allocations": 8700239, "peak_heap": "23.91M", "peak_rss": "73.85M"}, {"name": "postgres", "parsing": 291924.42699999997, "memory_allocations": 89501621, "temporary_memory_allocations": 8837344, "peak_heap": "16.50M", "peak_rss": "62.77M"}, {"name": "qemu", "parsing": 332538.516, "memory_allocations": 92861519, "temporary_memory_allocations": 7831548, "peak_heap": "23.56M", "peak_rss": "78.85M"}], "floss": {"elementary": {"parsing": 33485.841, "memory_allocations": 98254381, "temporary_memory_allocations": 11761577, "peak_heap": "5.13M", "peak_rss": "33.05M"}, "gnome": {"parsing": 314777.587, "memory_allocations": 938987573, "temporary_memory_allocations": 88076774, "peak_heap": "11.92M", "peak_rss": "88.65M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v1.6.json: -------------------------------------------------------------------------------- 1 | {"time": 1680897461.320248, "commit": "v1.6", "size": 99685464, "stripped_size": 58474640, "quick": {"bsdutils": 3075.4139999999998, "bubblewrap": 508.96502, "budgie-desktop": 4420.446, "bzip2": 411.79542000000004, "cglm": 176.8066, "cinnamon-desktop": 639.67468, "code": 1258.84032, "dbus-broker": 838.1093400000001, "dxvk": 1186.99756, "evince": 3036.138, "frida-core": 3228.4860000000003, "fwupd": 12231.407000000001, "gitg": 1726.904, "gjs": 2278.756, "glib": 17296.546, "gnome-shell": 2515.265, "hexchat": 2392.852, "igt-gpu-tools": 3655.3779999999997, "knot-resolver": 3510.035, "le": 1824.047, "libswiftdemangle": 144.14964, "libvips": 4010.677, "libvirt": 17759.167999999998, "lxc": 5040.476, "miniz": 63.78354, "mpv": 4316.719, "pipewire": 8659.554999999998, "rustc-demangle": 117.94113999999999, "scipy": 9057.909, "systemd": 24387.686999999998, "vte": 3029.5190000000002, "xts": 5937.427, "zrythm": 11164.273, "gnome-builder": 14573.812, "GNOME-Builder-Plugins": 1058.9994, "gtk": 11591.787999999999, "mesa": 46403.392, "postgres": 29433.621, "qemu": 33132.506}, "misc": {"parsing": 150321.013, "memory_allocations": 445266226, "temporary_memory_allocations": 39406004, "peak_heap": "12.77M", "peak_rss": "81.76M"}, "projects": [{"name": "gnome-builder", "parsing": 142168.827, "memory_allocations": 46191743, "temporary_memory_allocations": 4747468, "peak_heap": "9.05M", "peak_rss": "39.58M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10503.403, "memory_allocations": 3722783, "temporary_memory_allocations": 486071, "peak_heap": "2.93M", "peak_rss": "26.20M"}, {"name": "gtk", "parsing": 114587.66, "memory_allocations": 32358290, "temporary_memory_allocations": 2401312, "peak_heap": "9.79M", "peak_rss": "47.30M"}, {"name": "mesa", "parsing": 460821.396, "memory_allocations": 115949287, "temporary_memory_allocations": 8792896, "peak_heap": "23.89M", "peak_rss": "73.86M"}, {"name": "postgres", "parsing": 301552.007, "memory_allocations": 90497794, "temporary_memory_allocations": 8953098, "peak_heap": "16.49M", "peak_rss": "63.32M"}, {"name": "qemu", "parsing": 335077.598, "memory_allocations": 93621187, "temporary_memory_allocations": 7928020, "peak_heap": "23.54M", "peak_rss": "79.64M"}], "floss": {"elementary": {"parsing": 32806.434, "memory_allocations": 99953512, "temporary_memory_allocations": 11982481, "peak_heap": "5.13M", "peak_rss": "33.56M"}, "gnome": {"parsing": 312617.07999999996, "memory_allocations": 949804341, "temporary_memory_allocations": 89543265, "peak_heap": "11.90M", "peak_rss": "89.35M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v2.0.json: -------------------------------------------------------------------------------- 1 | {"time": 1681156593.1171148, "commit": "v2.0", "size": 99671752, "stripped_size": 58417168, "quick": {"bsdutils": 3090.603, "bubblewrap": 507.06325999999996, "budgie-desktop": 4419.023, "bzip2": 410.71268000000003, "cglm": 174.53578000000002, "cinnamon-desktop": 635.72758, "code": 1242.5025, "dbus-broker": 824.77954, "dxvk": 1152.7653, "evince": 2915.56, "frida-core": 3148.828, "fwupd": 11910.219, "gitg": 1664.8480000000002, "gjs": 2182.34, "glib": 16919.413, "gnome-shell": 2444.908, "hexchat": 2315.066, "igt-gpu-tools": 3611.9979999999996, "knot-resolver": 3396.743, "le": 1755.626, "libswiftdemangle": 142.02752, "libvips": 3901.875, "libvirt": 17192.996, "lxc": 4847.145, "miniz": 62.329480000000004, "mpv": 4146.022999999999, "pipewire": 8376.34, "rustc-demangle": 114.92078, "scipy": 8704.162999999999, "systemd": 23615.464, "vte": 2945.435, "xts": 5837.343, "zrythm": 11032.604, "gnome-builder": 14173.907, "GNOME-Builder-Plugins": 1043.65144, "gtk": 11445.091, "mesa": 46538.506, "postgres": 29627.891000000003, "qemu": 33475.204}, "misc": {"parsing": 148504.311, "memory_allocations": 445461239, "temporary_memory_allocations": 39461475, "peak_heap": "12.77M", "peak_rss": "81.87M"}, "projects": [{"name": "gnome-builder", "parsing": 142230.06100000002, "memory_allocations": 46190905, "temporary_memory_allocations": 4747470, "peak_heap": "9.05M", "peak_rss": "38.93M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10523.588, "memory_allocations": 3722353, "temporary_memory_allocations": 486068, "peak_heap": "2.93M", "peak_rss": "25.69M"}, {"name": "gtk", "parsing": 114467.909, "memory_allocations": 32367942, "temporary_memory_allocations": 2412787, "peak_heap": "9.79M", "peak_rss": "47.19M"}, {"name": "mesa", "parsing": 463278.43, "memory_allocations": 115959425, "temporary_memory_allocations": 8794394, "peak_heap": "23.89M", "peak_rss": "74.34M"}, {"name": "postgres", "parsing": 295261.775, "memory_allocations": 90574646, "temporary_memory_allocations": 8969474, "peak_heap": "16.49M", "peak_rss": "64.03M"}, {"name": "qemu", "parsing": 332815.138, "memory_allocations": 93679312, "temporary_memory_allocations": 7956980, "peak_heap": "23.54M", "peak_rss": "79.38M"}], "floss": {"elementary": {"parsing": 32069.91, "memory_allocations": 99957511, "temporary_memory_allocations": 11982983, "peak_heap": "5.13M", "peak_rss": "33.03M"}, "gnome": {"parsing": 312303.777, "memory_allocations": 950030031, "temporary_memory_allocations": 89599461, "peak_heap": "11.90M", "peak_rss": "89.77M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v2.1.json: -------------------------------------------------------------------------------- 1 | {"time": 1682104994.0426428, "commit": "v2.1", "size": 97426448, "stripped_size": 58213408, "quick": {"bsdutils": 2928.353, "bubblewrap": 488.29202000000004, "budgie-desktop": 4785.518, "bzip2": 400.64482, "cglm": 170.79958000000002, "cinnamon-desktop": 607.56492, "code": 1186.06498, "dbus-broker": 799.31588, "dxvk": 1113.5815, "evince": 2838.558, "frida-core": 3028.533, "fwupd": 11607.936, "gitg": 1627.459, "gjs": 2126.8509999999997, "glib": 16534.048, "gnome-shell": 2363.388, "hexchat": 2246.85, "igt-gpu-tools": 3493.706, "knot-resolver": 3328.334, "le": 1688.3809999999999, "libswiftdemangle": 135.03679999999997, "libvips": 3779.565, "libvirt": 17109.264, "lxc": 4739.552, "miniz": 60.406040000000004, "mpv": 4073.9739999999997, "pipewire": 8158.827, "rustc-demangle": 108.68114, "scipy": 8452.915, "systemd": 23553.184, "vte": 2878.294, "xts": 5663.909000000001, "zrythm": 10798.591, "gnome-builder": 14055.327, "GNOME-Builder-Plugins": 990.78646, "gtk": 11184.932999999999, "mesa": 46224.255, "postgres": 29361.525, "qemu": 32579.046}, "misc": {"parsing": 145922.199, "memory_allocations": 440376823, "temporary_memory_allocations": 36635347, "peak_heap": "13.46M", "peak_rss": "87.28M"}, "projects": [{"name": "gnome-builder", "parsing": 139755.82499999998, "memory_allocations": 45369468, "temporary_memory_allocations": 4349022, "peak_heap": "10.18M", "peak_rss": "41.03M"}, {"name": "GNOME-Builder-Plugins", "parsing": 9964.316, "memory_allocations": 3629533, "temporary_memory_allocations": 465061, "peak_heap": "2.94M", "peak_rss": "25.43M"}, {"name": "gtk", "parsing": 112093.224, "memory_allocations": 32026792, "temporary_memory_allocations": 2228092, "peak_heap": "10.18M", "peak_rss": "49.41M"}, {"name": "mesa", "parsing": 460365.913, "memory_allocations": 114766138, "temporary_memory_allocations": 8092295, "peak_heap": "27.28M", "peak_rss": "80.58M"}, {"name": "postgres", "parsing": 295377.6, "memory_allocations": 89216109, "temporary_memory_allocations": 8240697, "peak_heap": "19.03M", "peak_rss": "67.61M"}, {"name": "qemu", "parsing": 325776.466, "memory_allocations": 92595877, "temporary_memory_allocations": 7301902, "peak_heap": "25.15M", "peak_rss": "83.88M"}], "floss": {"elementary": {"parsing": 31290.662, "memory_allocations": 98209556, "temporary_memory_allocations": 11127797, "peak_heap": "5.13M", "peak_rss": "33.96M"}, "gnome": {"parsing": 311654.627, "memory_allocations": 937768882, "temporary_memory_allocations": 83288864, "peak_heap": "13.08M", "peak_rss": "95.59M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v2.2.json: -------------------------------------------------------------------------------- 1 | {"time": 1683921524.7071273, "commit": "v2.2", "size": 98046328, "stripped_size": 58399584, "quick": {"bsdutils": 3009.935, "bubblewrap": 493.92578000000003, "budgie-desktop": 4318.823, "bzip2": 409.76728, "cglm": 173.64951999999997, "cinnamon-desktop": 610.37318, "code": 1180.1529600000001, "dbus-broker": 797.19784, "dxvk": 1123.08456, "evince": 2867.619, "frida-core": 3100.413, "fwupd": 11666.703, "gitg": 1620.733, "gjs": 2145.626, "glib": 16538.66, "gnome-shell": 2357.9150000000004, "hexchat": 2233.37, "igt-gpu-tools": 3555.113, "knot-resolver": 3340.402, "le": 1699.92, "libswiftdemangle": 134.62614, "libvips": 3840.145, "libvirt": 17122.149, "lxc": 4737.476, "miniz": 60.61222, "mpv": 4152.366, "pipewire": 8281.505, "rustc-demangle": 108.74928, "scipy": 8467.894, "systemd": 23881.703, "vte": 2929.866, "xts": 5661.519, "zrythm": 10819.026, "gnome-builder": 14060.297, "GNOME-Builder-Plugins": 987.51822, "gtk": 11251.887, "mesa": 46664.53, "postgres": 29308.201, "qemu": 32761.418999999998}, "misc": {"parsing": 147568.4, "memory_allocations": 440102612, "temporary_memory_allocations": 36650490, "peak_heap": "13.47M", "peak_rss": "86.96M"}, "projects": [{"name": "gnome-builder", "parsing": 140701.993, "memory_allocations": 45364001, "temporary_memory_allocations": 4349449, "peak_heap": "10.20M", "peak_rss": "41.03M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10114.274, "memory_allocations": 3627110, "temporary_memory_allocations": 465274, "peak_heap": "2.95M", "peak_rss": "26.21M"}, {"name": "gtk", "parsing": 113199.174, "memory_allocations": 32009972, "temporary_memory_allocations": 2228864, "peak_heap": "10.19M", "peak_rss": "49.39M"}, {"name": "mesa", "parsing": 464362.542, "memory_allocations": 114701702, "temporary_memory_allocations": 8094481, "peak_heap": "27.30M", "peak_rss": "80.37M"}, {"name": "postgres", "parsing": 291579.722, "memory_allocations": 89187494, "temporary_memory_allocations": 8242019, "peak_heap": "19.05M", "peak_rss": "67.83M"}, {"name": "qemu", "parsing": 329643.794, "memory_allocations": 92568488, "temporary_memory_allocations": 7302531, "peak_heap": "25.17M", "peak_rss": "84.69M"}], "floss": {"elementary": {"parsing": 31151.243000000002, "memory_allocations": 98101522, "temporary_memory_allocations": 11142358, "peak_heap": "5.13M", "peak_rss": "34.23M"}, "gnome": {"parsing": 308679.751, "memory_allocations": 937097972, "temporary_memory_allocations": 83327334, "peak_heap": "13.10M", "peak_rss": "95.60M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v2.3.1.json: -------------------------------------------------------------------------------- 1 | {"time": 1687072873.8183715, "commit": "v2.3.1", "size": 98511112, "stripped_size": 58554896, "quick": {"bsdutils": 3008.653, "bubblewrap": 495.86324, "budgie-desktop": 4258.705, "bzip2": 364.01856, "cglm": 156.25469999999999, "cinnamon-desktop": 551.49854, "code": 1087.7600400000001, "dbus-broker": 716.2715, "dxvk": 1026.9483599999999, "evince": 2568.623, "frida-core": 2695.3230000000003, "fwupd": 10459.015000000001, "gitg": 1421.57772, "gjs": 1980.189, "glib": 15110.275, "gnome-shell": 2122.998, "hexchat": 1994.804, "igt-gpu-tools": 3156.601, "knot-resolver": 2955.705, "le": 1502.759, "libswiftdemangle": 124.02146, "libvips": 3429.688, "libvirt": 15457.786, "lxc": 4278.138, "miniz": 57.81924, "mpv": 3666.369, "pipewire": 7453.772, "rustc-demangle": 99.90632, "scipy": 7699.677000000001, "systemd": 21660.843, "vte": 2606.811, "xts": 5208.766, "zrythm": 9799.776, "gnome-builder": 12801.137999999999, "GNOME-Builder-Plugins": 912.95458, "gtk": 10127.057999999999, "mesa": 42884.957, "postgres": 26200.804, "qemu": 30252.362}, "misc": {"parsing": 133795.732, "memory_allocations": 445763548, "temporary_memory_allocations": 36660213, "peak_heap": "13.47M", "peak_rss": "89.48M"}, "projects": [{"name": "gnome-builder", "parsing": 127534.81, "memory_allocations": 45681595, "temporary_memory_allocations": 4351514, "peak_heap": "10.20M", "peak_rss": "41.65M"}, {"name": "GNOME-Builder-Plugins", "parsing": 9152.780999999999, "memory_allocations": 3662510, "temporary_memory_allocations": 465297, "peak_heap": "2.96M", "peak_rss": "26.19M"}, {"name": "gtk", "parsing": 102871.628, "memory_allocations": 32371057, "temporary_memory_allocations": 2229497, "peak_heap": "10.19M", "peak_rss": "50.43M"}, {"name": "mesa", "parsing": 429640.605, "memory_allocations": 116926889, "temporary_memory_allocations": 8103020, "peak_heap": "27.31M", "peak_rss": "81.65M"}, {"name": "postgres", "parsing": 266862.56100000005, "memory_allocations": 89998609, "temporary_memory_allocations": 8243669, "peak_heap": "19.06M", "peak_rss": "69.30M"}, {"name": "qemu", "parsing": 305008.316, "memory_allocations": 94164308, "temporary_memory_allocations": 7304077, "peak_heap": "25.18M", "peak_rss": "85.45M"}], "floss": {"elementary": {"parsing": 29247.77, "memory_allocations": 99132790, "temporary_memory_allocations": 11119182, "peak_heap": "5.13M", "peak_rss": "34.86M"}, "gnome": {"parsing": 287864.234, "memory_allocations": 947833887, "temporary_memory_allocations": 83358730, "peak_heap": "13.10M", "peak_rss": "99.27M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v2.4.json: -------------------------------------------------------------------------------- 1 | {"time": 1693654313.6705718, "commit": "v2.4", "size": 99105784, "stripped_size": 58717392, "quick": {"bsdutils": 3051.5460000000003, "bubblewrap": 518.48212, "budgie-desktop": 4688.862999999999, "bzip2": 379.34996, "cglm": 163.96238000000002, "cinnamon-desktop": 576.80458, "code": 1125.19106, "dbus-broker": 749.7955799999999, "dxvk": 1067.75892, "evince": 2668.623, "frida-core": 2828.739, "fwupd": 11061.487, "gitg": 1480.8439799999999, "gjs": 2062.295, "glib": 15674.778, "gnome-shell": 2201.949, "hexchat": 2128.332, "igt-gpu-tools": 3374.31, "knot-resolver": 3150.6059999999998, "le": 1549.29, "libswiftdemangle": 126.76422000000001, "libvips": 3573.025, "libvirt": 15682.771, "lxc": 4396.598, "miniz": 59.32152, "mpv": 3831.634, "pipewire": 7592.678, "rustc-demangle": 99.58318000000001, "scipy": 8243.325, "systemd": 22007.264, "vte": 2660.458, "xts": 5490.936, "zrythm": 10173.106, "gnome-builder": 13245.011999999999, "GNOME-Builder-Plugins": 935.05728, "gtk": 10888.438, "mesa": 43908.582, "postgres": 27372.164, "qemu": 32015.982}, "misc": {"parsing": 139209.228, "memory_allocations": 446027401, "temporary_memory_allocations": 36923661, "peak_heap": "13.47M", "peak_rss": "89.87M"}, "projects": [{"name": "gnome-builder", "parsing": 134161.126, "memory_allocations": 45710606, "temporary_memory_allocations": 4376945, "peak_heap": "10.21M", "peak_rss": "41.81M"}, {"name": "GNOME-Builder-Plugins", "parsing": 9591.316, "memory_allocations": 3666910, "temporary_memory_allocations": 468016, "peak_heap": "2.96M", "peak_rss": "26.48M"}, {"name": "gtk", "parsing": 107803.46299999999, "memory_allocations": 32386340, "temporary_memory_allocations": 2248553, "peak_heap": "10.19M", "peak_rss": "50.70M"}, {"name": "mesa", "parsing": 442647.74899999995, "memory_allocations": 117019110, "temporary_memory_allocations": 8196395, "peak_heap": "27.31M", "peak_rss": "82.20M"}, {"name": "postgres", "parsing": 277267.846, "memory_allocations": 90038042, "temporary_memory_allocations": 8288546, "peak_heap": "19.06M", "peak_rss": "68.71M"}, {"name": "qemu", "parsing": 314525.24199999997, "memory_allocations": 94192918, "temporary_memory_allocations": 7337510, "peak_heap": "25.18M", "peak_rss": "86.17M"}], "floss": {"elementary": {"parsing": 31143.067, "memory_allocations": 98668788, "temporary_memory_allocations": 11008992, "peak_heap": "5.13M", "peak_rss": "35.05M"}, "gnome": {"parsing": 290409.731, "memory_allocations": 948122364, "temporary_memory_allocations": 84025828, "peak_heap": "13.10M", "peak_rss": "99.31M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v3.0.0.json: -------------------------------------------------------------------------------- 1 | {"time": 1698073232.805298, "commit": "v3.0.0", "size": 101087976, "stripped_size": 59276032, "quick": {"bsdutils": 3300.941, "bubblewrap": 504.69656000000003, "budgie-desktop": 4398.653, "bzip2": 383.33256, "cglm": 162.39522, "cinnamon-desktop": 586.8, "code": 1141.2601399999999, "dbus-broker": 760.0470799999999, "dxvk": 1078.34788, "evince": 2713.446, "frida-core": 2862.934, "fwupd": 11054.103, "gitg": 1809.7369999999999, "gjs": 2095.638, "glib": 18684.71, "gnome-shell": 2239.643, "hexchat": 2438.815, "igt-gpu-tools": 3898.88, "knot-resolver": 3080.855, "le": 1800.996, "libswiftdemangle": 149.42926, "libvips": 3538.856, "libvirt": 16205.327000000001, "lxc": 4459.05, "miniz": 58.92776, "mpv": 5129.809, "pipewire": 7768.437, "rustc-demangle": 101.58879999999999, "scipy": 7991.301, "systemd": 23274.237, "vte": 3187.167, "xts": 5432.632, "zrythm": 11933.137, "gnome-builder": 13408.54, "GNOME-Builder-Plugins": 946.76874, "gtk": 10898.85, "mesa": 44957.575, "postgres": 28266.933999999997, "qemu": 32279.721}, "misc": {"parsing": 142296.672, "memory_allocations": 451374508, "temporary_memory_allocations": 37428333, "peak_heap": "13.91M", "peak_rss": "97.30M"}, "projects": [{"name": "gnome-builder", "parsing": 139300.315, "memory_allocations": 46547578, "temporary_memory_allocations": 4442821, "peak_heap": "10.42M", "peak_rss": "45.32M"}, {"name": "GNOME-Builder-Plugins", "parsing": 9934.977, "memory_allocations": 3677912, "temporary_memory_allocations": 468071, "peak_heap": "2.99M", "peak_rss": "27.62M"}, {"name": "gtk", "parsing": 117991.08, "memory_allocations": 33008279, "temporary_memory_allocations": 2307949, "peak_heap": "10.43M", "peak_rss": "54.66M"}, {"name": "mesa", "parsing": 465659.524, "memory_allocations": 117094883, "temporary_memory_allocations": 8274179, "peak_heap": "27.76M", "peak_rss": "87.47M"}, {"name": "postgres", "parsing": 297461.975, "memory_allocations": 91555674, "temporary_memory_allocations": 8352261, "peak_heap": "19.53M", "peak_rss": "75.19M"}, {"name": "qemu", "parsing": 333776.64900000003, "memory_allocations": 93627014, "temporary_memory_allocations": 7361359, "peak_heap": "25.51M", "peak_rss": "89.99M"}], "floss": {"elementary": {"parsing": 35339.225999999995, "memory_allocations": 99013863, "temporary_memory_allocations": 11079756, "peak_heap": "5.13M", "peak_rss": "37.83M"}, "gnome": {"parsing": 349310.602, "memory_allocations": 959676247, "temporary_memory_allocations": 85528551, "peak_heap": "13.35M", "peak_rss": "107.57M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v3.1.0.json: -------------------------------------------------------------------------------- 1 | {"time": 1698867756.0834072, "commit": "v3.1.0", "size": 98180328, "stripped_size": 57835024, "quick": {"bsdutils": 2968.5640000000003, "bubblewrap": 507.59268, "budgie-desktop": 4269.555, "bzip2": 386.39315999999997, "cglm": 160.35978, "cinnamon-desktop": 564.87192, "code": 1134.4804000000001, "dbus-broker": 755.263, "dxvk": 1104.81332, "evince": 2732.702, "frida-core": 2796.704, "fwupd": 11007.156, "gitg": 1526.943, "gjs": 2083.261, "glib": 16229.202999999998, "gnome-shell": 2203.3450000000003, "hexchat": 2094.283, "igt-gpu-tools": 3364.263, "knot-resolver": 3088.795, "le": 1567.652, "libswiftdemangle": 132.11104, "libvips": 3536.632, "libvirt": 16077.576000000001, "lxc": 4474.784, "miniz": 61.66646, "mpv": 4376.066, "pipewire": 8008.945000000001, "rustc-demangle": 105.404, "scipy": 8046.779, "systemd": 23119.436, "vte": 2731.78, "xts": 5323.561, "zrythm": 10494.35, "gnome-builder": 13304.529999999999, "GNOME-Builder-Plugins": 1021.53238, "gtk": 11072.179, "mesa": 45398.596, "postgres": 28887.494, "qemu": 32081.408000000003}, "misc": {"parsing": 145682.874, "memory_allocations": 449893189, "temporary_memory_allocations": 37273514, "peak_heap": "13.92M", "peak_rss": "96.58M"}, "projects": [{"name": "gnome-builder", "parsing": 136624.872, "memory_allocations": 46139076, "temporary_memory_allocations": 4392399, "peak_heap": "10.43M", "peak_rss": "45.35M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10201.614, "memory_allocations": 3890234, "temporary_memory_allocations": 499380, "peak_heap": "3.01M", "peak_rss": "27.92M"}, {"name": "gtk", "parsing": 109558.102, "memory_allocations": 32652677, "temporary_memory_allocations": 2264386, "peak_heap": "10.44M", "peak_rss": "54.39M"}, {"name": "mesa", "parsing": 452045.668, "memory_allocations": 116640837, "temporary_memory_allocations": 8218634, "peak_heap": "27.77M", "peak_rss": "87.03M"}, {"name": "postgres", "parsing": 285410.076, "memory_allocations": 91205240, "temporary_memory_allocations": 8308640, "peak_heap": "19.54M", "peak_rss": "74.58M"}, {"name": "qemu", "parsing": 322840.729, "memory_allocations": 93525925, "temporary_memory_allocations": 7350420, "peak_heap": "25.52M", "peak_rss": "89.72M"}], "floss": {"elementary": {"parsing": 31267.651, "memory_allocations": 99790249, "temporary_memory_allocations": 11258828, "peak_heap": "5.13M", "peak_rss": "37.78M"}, "gnome": {"parsing": 300515.23500000004, "memory_allocations": 954338465, "temporary_memory_allocations": 85043818, "peak_heap": "13.37M", "peak_rss": "105.59M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v3.1.2.json: -------------------------------------------------------------------------------- 1 | {"time": 1700383617.5181692, "commit": "v3.1.2", "size": 98296776, "stripped_size": 57856608, "quick": {"bsdutils": 3116.084, "bubblewrap": 583.16318, "budgie-desktop": 4733.918, "bzip2": 400.38725999999997, "cglm": 172.61541999999997, "cinnamon-desktop": 650.50044, "code": 1234.97084, "dbus-broker": 870.91184, "dxvk": 1182.78038, "evince": 3257.182, "frida-core": 3044.039, "fwupd": 13111.126, "gitg": 1808.482, "gjs": 2137.909, "glib": 16397.864999999998, "gnome-shell": 2575.034, "hexchat": 2189.623, "igt-gpu-tools": 3843.8219999999997, "knot-resolver": 3242.134, "le": 1831.427, "libswiftdemangle": 138.62398000000002, "libvips": 3714.562, "libvirt": 16767.668, "lxc": 4576.298000000001, "miniz": 64.5287, "mpv": 4529.063, "pipewire": 8067.2789999999995, "rustc-demangle": 112.16362000000001, "scipy": 8313.466999999999, "systemd": 23480.346999999998, "vte": 2770.575, "xts": 5788.700000000001, "zrythm": 10949.809, "gnome-builder": 13885.653, "GNOME-Builder-Plugins": 1043.6506, "gtk": 11041.118, "mesa": 50065.081, "postgres": 28630.71, "qemu": 35468.39}, "misc": {"parsing": 143964.674, "memory_allocations": 459558955, "temporary_memory_allocations": 37464784, "peak_heap": "14.37M", "peak_rss": "97.89M"}, "projects": [{"name": "gnome-builder", "parsing": 141112.831, "memory_allocations": 47453244, "temporary_memory_allocations": 4409219, "peak_heap": "11.71M", "peak_rss": "46.78M"}, {"name": "GNOME-Builder-Plugins", "parsing": 10757.609, "memory_allocations": 4114262, "temporary_memory_allocations": 501435, "peak_heap": "3.13M", "peak_rss": "28.05M"}, {"name": "gtk", "parsing": 109807.941, "memory_allocations": 33165274, "temporary_memory_allocations": 2271239, "peak_heap": "10.90M", "peak_rss": "55.57M"}, {"name": "mesa", "parsing": 480035.724, "memory_allocations": 118490015, "temporary_memory_allocations": 8224763, "peak_heap": "29.65M", "peak_rss": "88.90M"}, {"name": "postgres", "parsing": 301826.336, "memory_allocations": 93466508, "temporary_memory_allocations": 8319469, "peak_heap": "21.57M", "peak_rss": "77.20M"}, {"name": "qemu", "parsing": 326479.378, "memory_allocations": 95381485, "temporary_memory_allocations": 7381135, "peak_heap": "27.31M", "peak_rss": "92.42M"}], "floss": {"elementary": {"parsing": 34051.270000000004, "memory_allocations": 103630143, "temporary_memory_allocations": 11276296, "peak_heap": "5.13M", "peak_rss": "37.12M"}, "gnome": {"parsing": 353802.918, "memory_allocations": 981025585, "temporary_memory_allocations": 85554999, "peak_heap": "13.47M", "peak_rss": "107.13M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v4.2.2.json: -------------------------------------------------------------------------------- 1 | {"time": 1715440840.2581327, "commit": "v4.2.2", "size": 65326520, "stripped_size": 5430240, "quick": {"bsdutils": 241.82600000000002, "bubblewrap": 62.125, "budgie-desktop": 346.431, "bzip2": 49.679, "cglm": 22.529, "cinnamon-desktop": 58.547000000000004, "code": 104.279, "dbus-broker": 71.409, "dxvk": 108.321, "evince": 236.766, "frida-core": 253.36599999999999, "fwupd": 1061.7069999999999, "gitg": 137.375, "gjs": 186.88299999999998, "glib": 1212.722, "gnome-shell": 196.332, "hexchat": 205.21, "igt-gpu-tools": 286.63300000000004, "knot-resolver": 274.933, "le": 142.88, "libswiftdemangle": 24.922, "libvips": 280.214, "libvirt": 1227.647, "lxc": 342.165, "miniz": 19.841, "mpv": 373.26599999999996, "pipewire": 627.968, "rustc-demangle": 23.179000000000002, "scipy": 548.3240000000001, "systemd": 1662.7510000000002, "vte": 207.623, "xts": 389.913, "zrythm": 695.466, "gnome-builder": 887.738, "GNOME-Builder-Plugins": 148.318, "gtk": 866.049, "mesa": 2702.4159999999997, "postgres": 1909.53, "qemu": 2160.881}, "misc": {"parsing": 11351.449, "memory_allocations": 100696229, "temporary_memory_allocations": 2486004, "peak_heap": "8.70M", "peak_rss": "39.70M"}, "projects": [{"name": "gnome-builder", "parsing": 9237.128999999999, "memory_allocations": 7273367, "temporary_memory_allocations": 221050, "peak_heap": "4.63M", "peak_rss": "20.29M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1474.6840000000002, "memory_allocations": 1137011, "temporary_memory_allocations": 24746, "peak_heap": "1.56M", "peak_rss": "16.20M"}, {"name": "gtk", "parsing": 8792.617999999999, "memory_allocations": 7510080, "temporary_memory_allocations": 177753, "peak_heap": "4.70M", "peak_rss": "23.02M"}, {"name": "mesa", "parsing": 28443.458, "memory_allocations": 22060585, "temporary_memory_allocations": 371253, "peak_heap": "11.10M", "peak_rss": "33.23M"}, {"name": "postgres", "parsing": 19539.045000000002, "memory_allocations": 15198585, "temporary_memory_allocations": 420451, "peak_heap": "8.59M", "peak_rss": "29.14M"}, {"name": "qemu", "parsing": 23167.907, "memory_allocations": 17857687, "temporary_memory_allocations": 673754, "peak_heap": "11.12M", "peak_rss": "33.74M"}], "floss": {"elementary": {"parsing": 2874.444, "memory_allocations": 21272536, "temporary_memory_allocations": 659838, "peak_heap": "2.14M", "peak_rss": "17.77M"}, "gnome": {"parsing": 26413.391, "memory_allocations": 202270835, "temporary_memory_allocations": 5526687, "peak_heap": "6.08M", "peak_rss": "38.35M"}}} 2 | -------------------------------------------------------------------------------- /Benchmarks/v4.3.0.json: -------------------------------------------------------------------------------- 1 | {"time": 1719676528.6166863, "commit": "v4.3.0", "size": 65717392, "stripped_size": 5581944, "quick": {"bsdutils": 246.12800000000001, "bubblewrap": 63.693, "budgie-desktop": 332.318, "bzip2": 54.983, "cglm": 23.262, "cinnamon-desktop": 58.520999999999994, "code": 106.72, "dbus-broker": 79.39, "dxvk": 104.43299999999999, "evince": 236.817, "frida-core": 263.52, "fwupd": 1065.8110000000001, "gitg": 140.907, "gjs": 191.692, "glib": 1247.345, "gnome-shell": 196.469, "hexchat": 215.482, "igt-gpu-tools": 291.813, "knot-resolver": 280.326, "le": 144.369, "libswiftdemangle": 25.808, "libvips": 281.07599999999996, "libvirt": 1261.205, "lxc": 380.2, "miniz": 13.053, "mpv": 380.29699999999997, "pipewire": 646.089, "rustc-demangle": 23.996, "scipy": 552.7370000000001, "systemd": 1575.566, "vte": 209.32700000000003, "xts": 370.99199999999996, "zrythm": 699.095, "gnome-builder": 866.709, "GNOME-Builder-Plugins": 152.273, "gtk": 835.244, "mesa": 2705.022, "postgres": 1924.148, "qemu": 2124.167}, "misc": {"parsing": 10905.207, "memory_allocations": 97549246, "temporary_memory_allocations": 1032404, "peak_heap": "8.71M", "peak_rss": "40.19M"}, "projects": [{"name": "gnome-builder", "parsing": 9531.934, "memory_allocations": 7044684, "temporary_memory_allocations": 79650, "peak_heap": "4.63M", "peak_rss": "21.25M"}, {"name": "GNOME-Builder-Plugins", "parsing": 1554.688, "memory_allocations": 1105528, "temporary_memory_allocations": 14546, "peak_heap": "1.56M", "peak_rss": "17.00M"}, {"name": "gtk", "parsing": 9342.088, "memory_allocations": 7335197, "temporary_memory_allocations": 92453, "peak_heap": "4.70M", "peak_rss": "22.99M"}, {"name": "mesa", "parsing": 28809.359, "memory_allocations": 21454802, "temporary_memory_allocations": 181653, "peak_heap": "11.12M", "peak_rss": "33.29M"}, {"name": "postgres", "parsing": 19692.868000000002, "memory_allocations": 14893402, "temporary_memory_allocations": 195651, "peak_heap": "8.59M", "peak_rss": "29.41M"}, {"name": "qemu", "parsing": 22660.432, "memory_allocations": 17121704, "temporary_memory_allocations": 181754, "peak_heap": "11.13M", "peak_rss": "33.69M"}], "floss": {"elementary": {"parsing": 2868.632, "memory_allocations": 20743653, "temporary_memory_allocations": 196738, "peak_heap": "2.15M", "peak_rss": "18.60M"}, "gnome": {"parsing": 26289.927, "memory_allocations": 196701552, "temporary_memory_allocations": 2160787, "peak_heap": "6.08M", "peak_rss": "39.37M"}}} 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Guidelines 4 | 1. Be nice 5 | 2. Treat others like you want to be treated 6 | 3. Communicate and act in good faith 7 | 4. Stay professional 8 | 9 | ## Enforcement 10 | Any violation of the Code of Conduct has a temporary ban as a consequence. If it is violated again, the offender will be permanently banned. 11 | 12 | ## Contact 13 | Mail me at JCWasmx86@t-online.de 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Guide for contributors 2 | - Check [PROGRESS.md] or the issues for tasks you could work on. 3 | - Implement the task 4 | - Submit a Pull Request. 5 | 6 | ## Code style 7 | I use clang-format and clang-tidy for formatting and linting. Please run `ninja clang-format` before 8 | submitting patches. 9 | 10 | Please write your code so it fits in with the surrounding code. 11 | 12 | 13 | ## Policies to keep in mind 14 | Changes *must* work in GNOME Builder and *should* work in VSCode. If your patch only works in VSCode it will be rejected, 15 | except if it is for a feature not supported by GNOME Builder. 16 | If it works in GNOME Builder, but not in VSCode, it will be accepted, if and only if fixing VSCode requires non-trivial 17 | changes. This means we follow the LSP client implementation in GNOME Builder. 18 | 19 | 20 | ## Contact 21 | I made a matrix channel: [#mesonlsp:matrix.org](https://matrix.to/#/#mesonlsp:matrix.org) Feel free to join 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest AS stage1 2 | 3 | RUN apk add --no-cache gcc g++ meson curl-static pkgconf util-linux-dev \ 4 | util-linux-static curl-dev libunistring-dev libunistring-static \ 5 | libarchive-static openssl-libs-static libarchive-dev libarchive-static \ 6 | acl-static zlib-static libidn2-static c-ares-static nghttp2-static brotli-static \ 7 | expat-static xz-static xz-dev zstd-static lz4-static bzip2-static zip jemalloc-dev jemalloc-static gtest-dev pkgconf-dev \ 8 | git benchmark-dev mercurial subversion autoconf automake libtool make py3-pip bash curl m4 libpsl-dev libpsl-static 9 | 10 | WORKDIR /app 11 | 12 | COPY COPYING meson.build meson.options /app/ 13 | COPY src /app/src 14 | COPY LSPTests /app/LSPTests 15 | COPY tests /app/tests 16 | COPY subprojects /app/subprojects 17 | COPY scripts /app/scripts 18 | RUN git clone https://github.com/libunwind/libunwind 19 | RUN pip install --break-system-packages pygls lsprotocol 20 | WORKDIR /app/libunwind 21 | RUN git checkout 05afdabf38d3fa461b7a9de80c64a6513a564d81 22 | RUN autoreconf -i 23 | RUN ./configure --prefix=/usr --disable-tests --disable-cxx-exceptions --enable-shared=no --enable-static=yes --enable-minidebuginfo --enable-zlibdebuginfo --enable-debug-frame 24 | RUN make -j4 install 25 | WORKDIR /app 26 | RUN meson setup _static --default-library=static --prefer-static \ 27 | -Dc_link_args='-static-libgcc -static-libstdc++' \ 28 | -Dcpp_link_args='-static-libgcc -static-libstdc++' -Dstatic_build=true \ 29 | --buildtype=release -Db_lto=true --force-fallback-for=libpkgconf 30 | RUN ninja -C _static -j2 31 | RUN meson test -C _static "mesonlsp:" 32 | RUN _static/tests/libcxathrow/cxathrowtest 33 | RUN mkdir /app/exportDir 34 | RUN cp _static/src/mesonlsp /app/exportDir 35 | RUN cp _static/src/lint/mesonlint /app/exportDir 36 | RUN ./scripts/create_license_file.sh 37 | RUN cp COPYING /app/exportDir 38 | RUN cp 3rdparty.txt /app/exportDir 39 | RUN sh -c 'apk list | tee /app/exportDir/env.txt' 40 | WORKDIR /app/exportDir 41 | RUN zip -9 mesonlsp-alpine-static.zip mesonlsp mesonlint env.txt COPYING 42 | 43 | FROM scratch AS export-stage 44 | COPY --from=stage1 /app/exportDir/mesonlsp-alpine-static.zip . 45 | -------------------------------------------------------------------------------- /LSPTests/Fixture/meson.build: -------------------------------------------------------------------------------- 1 | project('Fixture', 'c') 2 | xyz = 1 3 | -------------------------------------------------------------------------------- /LSPTests/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'lsptest', 3 | files('test.py'), 4 | args: [mesonlsp, files('Fixture/meson.build')], 5 | ) 6 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Release process 2 | 1. Run benchmarks locally 3 | 2. Commit benchmarks (And eventually remove HEAD.json) 4 | 3. Update RPM spec 5 | 4. Finalize changelog 6 | 5. Update version in meson.build 7 | 6. Create Github release 8 | 9 | # Postrelease 10 | 1. Add empty section to changelog 11 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Scope 4 | Only code in `src/` is within the scope of this security policy, as it's the only code shipped to the user. 5 | For all other kinds of vulnerabilities - unless you can show that it could harm the user, simply open an issue or make a PR. 6 | 7 | ## Supported Versions 8 | The only supported version is the most recent version. No LTS releases or similar 9 | are provided/supported. 10 | 11 | ## Reporting a Vulnerability 12 | If you find a vulnerability, mail me at: JCWasmx86@t-online.de 13 | You can expect an answer after not more than 72 hours. 14 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "_build" 3 | - "subprojects" 4 | - "tests" 5 | - "src/benchmarks" 6 | comment: 7 | layout: "diff, flags, files" 8 | behavior: default 9 | -------------------------------------------------------------------------------- /docker/Dockerfile.debiansid: -------------------------------------------------------------------------------- 1 | FROM debian:sid AS stage1 2 | 3 | RUN apt update && apt install -y git gcc g++ meson ninja-build libpkgconf-dev libcurl4-openssl-dev pkg-config uuid-dev libarchive-dev libgtest-dev libbenchmark-dev zip mercurial subversion 4 | WORKDIR /app 5 | 6 | COPY meson.build meson.options /app/ 7 | COPY src /app/src 8 | COPY LSPTests /app/LSPTests 9 | COPY tests /app/tests 10 | COPY subprojects /app/subprojects 11 | 12 | RUN meson setup _build --buildtype=release -Db_lto=true 13 | RUN ninja -C _build 14 | RUN meson test -C _build "mesonlsp:" 15 | RUN _build/tests/libcxathrow/cxathrowtest 16 | RUN mkdir /app/exportDir 17 | RUN cp _build/src/mesonlsp /app/exportDir 18 | WORKDIR /app/exportDir 19 | RUN zip -9 mesonlsp-debian-static.zip mesonlsp 20 | 21 | FROM scratch AS export-stage 22 | COPY --from=stage1 /app/exportDir/mesonlsp-debian-static.zip . 23 | -------------------------------------------------------------------------------- /docker/Dockerfile.debiantrixie: -------------------------------------------------------------------------------- 1 | FROM debian:trixie AS stage1 2 | 3 | RUN apt update && apt install -y git gcc g++ meson ninja-build libpkgconf-dev libcurl4-openssl-dev pkg-config uuid-dev libarchive-dev libgtest-dev libbenchmark-dev zip mercurial subversion 4 | WORKDIR /app 5 | 6 | COPY meson.build meson.options /app/ 7 | COPY src /app/src 8 | COPY LSPTests /app/LSPTests 9 | COPY tests /app/tests 10 | COPY subprojects /app/subprojects 11 | 12 | RUN meson setup _build --buildtype=release -Db_lto=true 13 | RUN ninja -C _build 14 | RUN meson test -C _build "mesonlsp:" 15 | RUN _build/tests/libcxathrow/cxathrowtest 16 | RUN mkdir /app/exportDir 17 | RUN cp _build/src/mesonlsp /app/exportDir 18 | WORKDIR /app/exportDir 19 | RUN zip -9 mesonlsp-debian-static.zip mesonlsp 20 | 21 | FROM scratch AS export-stage 22 | COPY --from=stage1 /app/exportDir/mesonlsp-debian-static.zip . 23 | -------------------------------------------------------------------------------- /docs/BuilderNightly.md: -------------------------------------------------------------------------------- 1 | # Integrate with GNOME Builder Nightly 2 | You have to do nothing. The editor already has the support code for mesonlsp. All you have to do is 3 | installing the language server. 4 | -------------------------------------------------------------------------------- /docs/Configuration.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | These options have to be sent to the language server with the `initializationOptions` and `workspace/didChangeConfiguration`. 3 | The format is: 4 | ``` 5 | { 6 | "others": { 7 | "ignoreDiagnosticsFromSubprojects": false, 8 | "neverDownloadAutomatically": false, 9 | "disableInlayHints": true 10 | }, 11 | "linting": { 12 | "disableNameLinting": false, 13 | "disableAllIdLinting": false, 14 | "disableCompilerIdLinting": false 15 | "disableCompilerArgumentIdLinting": false, 16 | "disableLinkerIdLinting": false, 17 | "disableCpuFamilyLinting": false, 18 | "disableOsFamilyLinting": false 19 | } 20 | } 21 | ``` 22 | - `others.ignoreDiagnosticsFromSubprojects`: If true, no diagnostics from subprojects will be shown. If it is an array of strings, the diagnostics from these subprojects will be ignored. 23 | - `others.neverDownloadAutomatically`: If true, no subprojects/wraps are downloaded automatically. 24 | - `others.disableInlayHints`: If true, no inlay hints will be shown. 25 | - `linting.disableNameLinting`: Disable checking, whether the variable names are snake case 26 | - `linting.disableAllIdLinting`: Disables checking of all following options. 27 | - `linting.disableCompilerIdLinting`: Disables the comparison of string literals with the results of `compiler.get_id()` and emitting a warning, if unknown string. 28 | - `linting.disableCompilerArgumentIdLinting`: Like above, just for `compiler.get_argument_syntax()` 29 | - `linting.disableLinkerIdLinting`: Like above, just for `compiler.get_linker_id()` 30 | - `linting.disableCpuFamilyLinting`: Like above, just for `host/target/build_machine.cpu_family()` 31 | - `linting.disableOsFamilyLinting`: Like above, just for `host/target/build_machine.system()` 32 | -------------------------------------------------------------------------------- /docs/Distribution.md: -------------------------------------------------------------------------------- 1 | # Notes for distributers 2 | Thanks a lot for even considering packaging this language server for your distribution. 3 | ## Dependencies 4 | Checkout mesonlsp.spec for a RPM manifest that contains all (runtime/build-)dependencies. 5 | 6 | You need at least gcc 13, as mesonlsp depends on the `` header. 7 | ## Patches 8 | If there are patches needed for this language server, kindly share them with me. 9 | Your patch doesn't have to be overly detailed. 10 | A simple note informing me about any missing elements for distributors would suffice. 11 | ## Compilation 12 | - Please consider using LTO (Compile with `-Db_lto=true`) 13 | - Use the release build (Run meson with `--buildtype release`). Some options will be added if this switch is used (E.g. hardening) 14 | - Consider linking with jemalloc or mimalloc (Configure with `-Duse_jemalloc=true` or `-Duse_mimalloc=true`). This improves performance by ~10-20% 15 | -------------------------------------------------------------------------------- /docs/Kate.md: -------------------------------------------------------------------------------- 1 | # Integrate with Kate 2 | **Note**: Kate is not tested extensively 3 | 4 | 5 | Add this JSON to `~/.config/kate/lspclient/settings.json`: 6 | ``` 7 | { 8 | "servers": { 9 | "meson": { 10 | "command": [ 11 | "mesonlsp", 12 | "--lsp" 13 | ], 14 | "rootIndicationFileNames": [ 15 | "meson.build", 16 | "meson_options.txt" 17 | ], 18 | "url": "https://github.com/JCWasmx86/Swift-MesonLSP", 19 | "highlightingModeRegex": "^Meson$" 20 | } 21 | } 22 | } 23 | ``` 24 | After that, a dialog should be shown asking you to confirm that the language server may be started. 25 | -------------------------------------------------------------------------------- /docs/Neovim.md: -------------------------------------------------------------------------------- 1 | # Integration with Neovim 2 | **Note**: Neovim is not tested extensively 3 | 4 | Add this JSON to `:CocConfig`: 5 | ``` 6 | { 7 | "languageserver": { 8 | "meson": { 9 | "command": "mesonlsp", 10 | "args": ["--lsp"], 11 | "rootPatterns": ["meson.build"], 12 | "filetypes": ["meson"] 13 | } 14 | } 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /docs/PackageInstall.md: -------------------------------------------------------------------------------- 1 | # Install from package manager repo. 2 | If you don't use Fedora 39, you have to [compile from source](SourceInstall.md). 3 | ## COPR (Fedora) 4 | Install [this COPR](https://copr.fedorainfracloud.org/coprs/jcwasmx86/Swift-MesonLSP/) and install the package `Swift-MesonLSP`. 5 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation for mesonlsp 2 | - Installation 3 | - [From package repo (Fedora)](PackageInstall.md) 4 | - [From Source](SourceInstall.md) 5 | - [Linux/macOS/Windows](ReleaseInstall.md) 6 | - Editor integration 7 | - [GNOME Builder 45 and Nightly](BuilderNightly.md) 8 | - [Kate](Kate.md) 9 | - [Neovim](Neovim.md) 10 | - [VSCode/Codium](VSCode.md) 11 | - [Configuration](Configuration.md) 12 | - [Notes for distributers](Distribution.md) 13 | -------------------------------------------------------------------------------- /docs/ReleaseInstall.md: -------------------------------------------------------------------------------- 1 | # Install from release 2 | Binaries for macOS, Windows and Linux are provided in the [release section](https://github.com/JCWasmx86/Swift-MesonLSP/releases/). 3 | Download them and copy them to a directory on PATH. The DLLs are required on Windows. 4 | -------------------------------------------------------------------------------- /docs/SourceInstall.md: -------------------------------------------------------------------------------- 1 | # Install from source. 2 | ## Dependencies 3 | ### Fedora 4 | ``` 5 | dnf install zip ninja-build gcc g++ git pip libcurl-devel glibc-static libarchive-devel gtest gtest-devel libpkgconf-devel libuuid-devel uuid python3-pip pkgconf-pkg-config -y 6 | pip install meson 7 | ``` 8 | ### Debian Trixie 9 | ``` 10 | apt install -y git gcc g++ meson ninja-build libpkgconf-dev libcurl4-openssl-dev pkg-config uuid-dev libarchive-dev libgtest-dev zip 11 | ``` 12 | ### Alpine:Latest 13 | ``` 14 | apk add --no-cache gcc g++ meson curl-static pkgconf util-linux-dev \ 15 | util-linux-static curl-dev libunistring-dev libunistring-static \ 16 | libarchive-static openssl-libs-static libarchive-dev libarchive-static \ 17 | acl-static zlib-static libidn2-static c-ares-static nghttp2-static brotli-static \ 18 | expat-static xz-static zstd-static lz4-static bzip2-static zip jemalloc-dev jemalloc-static gtest-dev pkgconf-dev \ 19 | git 20 | ``` 21 | 22 | 23 | 1. Clone the repository 24 | 2. Execute `meson setup _build --buildtype release -Db_lto=true && ninja -C _build && sudo ninja -C _build install` to get a dynamically linked binary 25 | 26 | ## Using jemalloc (Recommended!) 27 | Add `-Duse_jemalloc=true` to use the jemalloc allocator. This is recommended. 28 | 29 | ## Using mimalloc 30 | Add `-Duse_mimalloc=true` to use the mimalloc allocator 31 | -------------------------------------------------------------------------------- /docs/VSCode.md: -------------------------------------------------------------------------------- 1 | # Integration with VSCode/Codium 2 | Install the official meson extension. If you don't have mesonlsp in the PATH, 3 | it will ask you whether it should download the language server. 4 | -------------------------------------------------------------------------------- /docs/img/auto-completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/auto-completion.png -------------------------------------------------------------------------------- /docs/img/diags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/diags.png -------------------------------------------------------------------------------- /docs/img/hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/hover.png -------------------------------------------------------------------------------- /docs/img/hover2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/hover2.png -------------------------------------------------------------------------------- /docs/img/inlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/inlay.png -------------------------------------------------------------------------------- /docs/img/pkgconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/docs/img/pkgconfig.png -------------------------------------------------------------------------------- /meson.options: -------------------------------------------------------------------------------- 1 | option( 2 | 'static_build', 3 | type: 'boolean', 4 | value: false, 5 | ) 6 | option( 7 | 'use_jemalloc', 8 | type: 'boolean', 9 | value: false, 10 | ) 11 | option( 12 | 'use_mimalloc', 13 | type: 'boolean', 14 | value: false, 15 | ) 16 | option( 17 | 'use_mimalloc_wrap', 18 | type: 'boolean', 19 | value: true, 20 | ) 21 | option( 22 | 'tests', 23 | type: 'boolean', 24 | value: true, 25 | ) 26 | option( 27 | 'benchmarks', 28 | type: 'boolean', 29 | value: true, 30 | ) 31 | option( 32 | 'use_own_tree_sitter', 33 | type: 'boolean', 34 | value: true, 35 | ) 36 | -------------------------------------------------------------------------------- /scripts/ci_create_zip.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | meson setup _release --buildtype release -Db_lto=true 3 | # shellcheck disable=SC2086 4 | ninja -C _release $2 || exit 1 5 | ./_release/tests/libcxathrow/cxathrowtest 6 | cp _release/src/mesonlsp mesonlsp 7 | rm -rf _release 8 | meson setup _build --buildtype debug 9 | # shellcheck disable=SC2086 10 | ninja -C _build $2 || exit 1 11 | # shellcheck disable=SC2086 12 | meson test -C _build "mesonlsp:" $2 || exit 1 13 | ./_build/tests/libcxathrow/cxathrowtest 14 | cp _build/src/mesonlsp mesonlsp.debug 15 | zip -9 "$1".zip mesonlsp.debug mesonlsp 16 | sudo cp "$1".zip / || true 17 | cp "$1".zip / || true 18 | -------------------------------------------------------------------------------- /scripts/create_license_file.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | { 3 | echo "tree-sitter" 4 | curl https://raw.githubusercontent.com/tree-sitter/tree-sitter/master/LICENSE 5 | echo "tree-sitter-meson" 6 | echo "MIT license" 7 | echo "tree-sitter-ini" 8 | curl https://raw.githubusercontent.com/JCWasmx86/tree-sitter-ini/master/LICENSE 9 | echo "sha256" 10 | curl https://raw.githubusercontent.com/amosnier/sha-2/master/LICENSE.md 11 | echo "ada-url" 12 | curl https://raw.githubusercontent.com/ada-url/ada/main/LICENSE-APACHE 13 | curl https://raw.githubusercontent.com/ada-url/ada/main/LICENSE-MIT 14 | echo "muon" 15 | curl https://raw.githubusercontent.com/annacrombie/muon/master/LICENSES/Apache-2.0.txt 16 | curl https://raw.githubusercontent.com/annacrombie/muon/master/LICENSES/GPL-3.0-only.txt 17 | curl https://raw.githubusercontent.com/annacrombie/muon/master/LICENSES/MIT.txt 18 | curl https://raw.githubusercontent.com/annacrombie/muon/master/LICENSES/Unlicense.txt 19 | echo "custom patches here: https://github.com/JCWasmx86/muon" 20 | echo "nlohmann-json" 21 | curl https://github.com/nlohmann/json/raw/develop/LICENSE.MIT 22 | echo "curl" 23 | curl https://raw.githubusercontent.com/curl/curl/master/COPYING 24 | echo "libarchive" 25 | curl https://raw.githubusercontent.com/libarchive/libarchive/master/COPYING 26 | echo "util-linux/libuuid" 27 | curl https://raw.githubusercontent.com/util-linux/util-linux/master/COPYING 28 | echo "libpkgconf" 29 | curl https://raw.githubusercontent.com/pkgconf/pkgconf/master/COPYING 30 | echo "brotli" 31 | curl https://raw.githubusercontent.com/google/brotli/master/LICENSE 32 | echo "liblzma" 33 | curl https://raw.githubusercontent.com/kobolabs/liblzma/master/COPYING.GPLv2 34 | curl https://raw.githubusercontent.com/kobolabs/liblzma/master/COPYING 35 | curl https://raw.githubusercontent.com/kobolabs/liblzma/master/COPYING.GPLv3 36 | curl https://raw.githubusercontent.com/kobolabs/liblzma/master/COPYING.LGPLv2.1 37 | echo "zlib" 38 | curl https://raw.githubusercontent.com/madler/zlib/develop/LICENSE 39 | echo "jemalloc" 40 | curl https://raw.githubusercontent.com/jemalloc/jemalloc/dev/COPYING 41 | echo "mimalloc" 42 | curl https://raw.githubusercontent.com/microsoft/mimalloc/dev/LICENSE 43 | echo "fmt" 44 | curl https://raw.githubusercontent.com/fmtlib/fmt/master/LICENSE 45 | echo "tomlplusplus" 46 | curl https://raw.githubusercontent.com/marzer/tomlplusplus/master/LICENSE 47 | } >3rdparty.txt 48 | -------------------------------------------------------------------------------- /scripts/release_update_vscode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # pylint: disable=missing-module-docstring,missing-function-docstring,bare-except,line-too-long 3 | import sys 4 | 5 | 6 | def update_typescript(file): 7 | with open(file, "r", encoding="utf-8") as filep: 8 | lines = list(filep.readlines()) 9 | for idx, value in enumerate(lines): 10 | if 'name: "Swift-MesonLSP-win64.zip",' in value: 11 | lines[idx + 1] = f' hash: "{sys.argv[2]}",\n' 12 | elif 'name: "Swift-MesonLSP-macos12.zip",' in value: 13 | lines[idx + 1] = f' hash: "{sys.argv[3]}",\n' 14 | elif 'name: "Swift-MesonLSP.zip",' in value: 15 | lines[idx + 1] = f' hash: "{sys.argv[4]}",\n' 16 | elif "static override version: string =" in value: 17 | fixed_version = sys.argv[5].replace("v", "") 18 | lines[idx] = f' static override version: string = "{fixed_version}";\n' 19 | with open(file, "w", encoding="utf-8") as filep: 20 | filep.write("".join(lines).strip() + "\n") 21 | 22 | 23 | def update_changelog(changelog_file): 24 | with open(changelog_file, "r", encoding="utf-8") as filep: 25 | lines = list(filep.readlines()) 26 | old_idx = -1 27 | for idx, value in enumerate(lines): 28 | if value.startswith("## ") and "next" not in value: 29 | old_idx = idx - 1 30 | break 31 | new_lines = list(map(lambda x: x.replace("\n", ""), lines[0:old_idx])) 32 | if "## next" in new_lines[-1]: 33 | new_lines.append("") 34 | new_lines.append(f"- Bump Swift-MesonLSP to {sys.argv[5]}") 35 | new_lines += list(map(lambda x: x.replace("\n", ""), lines[old_idx:])) 36 | with open(changelog_file, "w", encoding="utf-8") as filep: 37 | filep.write("\n".join(new_lines) + "\n") 38 | 39 | 40 | if __name__ == "__main__": 41 | update_typescript(sys.argv[1]) 42 | update_changelog(sys.argv[6]) 43 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=JCWasmx86_Swift-MesonLSP 2 | sonar.organization=jcwasmx86 3 | sonar.host.url=https://sonarcloud.io 4 | sonar.sourceEncoding=UTF-8 5 | sonar.cfamily.cpp23.enabled=true 6 | sonar.sources=src/ 7 | sonar.tests=tests/ 8 | sonar.python.version=3.9,3.10,3.11 9 | 10 | # Issue Ignore Criteria 11 | sonar.issue.ignore.multicriteria=e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11 12 | sonar.issue.ignore.multicriteria.e1.ruleKey=cpp:S6045 13 | sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.cpp 14 | sonar.issue.ignore.multicriteria.e2.ruleKey=cpp:S6045 15 | sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.hpp 16 | sonar.issue.ignore.multicriteria.e3.ruleKey=cpp:S6004 17 | sonar.issue.ignore.multicriteria.e3.resourceKey=**/*.cpp 18 | sonar.issue.ignore.multicriteria.e4.ruleKey=cpp:S6004 19 | sonar.issue.ignore.multicriteria.e4.resourceKey=**/*.hpp 20 | sonar.issue.ignore.multicriteria.e5.ruleKey=cpp:S1186 21 | sonar.issue.ignore.multicriteria.e5.resourceKey=**/*.cpp 22 | sonar.issue.ignore.multicriteria.e6.ruleKey=cpp:S1186 23 | sonar.issue.ignore.multicriteria.e6.resourceKey=**/*.hpp 24 | sonar.issue.ignore.multicriteria.e7.ruleKey=cpp:S5414 25 | sonar.issue.ignore.multicriteria.e7.resourceKey=**/*.cpp 26 | sonar.issue.ignore.multicriteria.e8.ruleKey=cpp:S5414 27 | sonar.issue.ignore.multicriteria.e8.resourceKey=**/*.hpp 28 | sonar.issue.ignore.multicriteria.e9.ruleKey=cpp:S6009 29 | sonar.issue.ignore.multicriteria.e9.resourceKey=**/*.cpp 30 | sonar.issue.ignore.multicriteria.e10.ruleKey=cpp:S6009 31 | sonar.issue.ignore.multicriteria.e10.resourceKey=**/*.hpp 32 | sonar.issue.ignore.multicriteria.e11.ruleKey=cpp:S6011 33 | sonar.issue.ignore.multicriteria.e11.resourceKey=**/*semantictokensvisitor.cpp 34 | -------------------------------------------------------------------------------- /src/benchmarks/lexing.cpp: -------------------------------------------------------------------------------- 1 | #include "lexer.hpp" 2 | #include "polyfill.hpp" 3 | #include "utils.hpp" 4 | 5 | #include 6 | #include 7 | 8 | extern "C" { 9 | // Dirty hack 10 | #define ast muon_ast 11 | #define new fnew 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #undef ast 18 | #undef new 19 | } 20 | 21 | constexpr auto COUNT = 10000; 22 | 23 | int main(int /*argc*/, char **argv) { 24 | std::string mode = argv[1]; 25 | auto *file = argv[2]; 26 | if (mode == "muon") { 27 | std::cerr << "UNIMPLEMENTED" << std::endl; 28 | } else if (mode == "custom") { 29 | const auto fileContent = readFile(file); 30 | size_t size = 0; 31 | for (int i = 0; i < COUNT; i++) { 32 | Lexer lexer(fileContent); 33 | lexer.tokenize(); 34 | size = lexer.tokens.size(); 35 | } 36 | std::cerr << std::format("Tokens: {}, Filesize: {} bytes, Bytes/Token: {}", 37 | size, fileContent.size(), 38 | (double)fileContent.size() / (double)size) 39 | << std::endl; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/benchmarks/meson.build: -------------------------------------------------------------------------------- 1 | if not get_option('benchmarks') 2 | subdir_done() 3 | endif 4 | benchmark_dep = dependency( 5 | 'benchmark', 6 | version: '>= 1.7.1', 7 | allow_fallback: true, 8 | required: false, 9 | ) 10 | if not benchmark_dep.found() 11 | subdir_done() 12 | endif 13 | executable( 14 | 'parsingbenchmark', 15 | 'benchmark.cpp', 16 | dependencies: [ 17 | benchmark_dep, 18 | tree_sitter_dep, 19 | tree_sitter_meson_dep, 20 | utils_dep, 21 | ast_dep, 22 | muon_dep, 23 | parsing_dep, 24 | ] 25 | + extra_deps 26 | + extra_libs, 27 | ) 28 | executable( 29 | 'lexing', 30 | 'lexing.cpp', 31 | dependencies: [ 32 | muon_dep, 33 | parsing_dep, 34 | ] 35 | + extra_deps 36 | + extra_libs, 37 | ) 38 | 39 | executable( 40 | 'parsing', 41 | 'parsing.cpp', 42 | dependencies: [ 43 | muon_dep, 44 | tree_sitter_dep, 45 | tree_sitter_meson_dep, 46 | parsing_dep, 47 | ] 48 | + extra_deps 49 | + extra_libs, 50 | ) 51 | -------------------------------------------------------------------------------- /src/libanalyze/analysisoptions.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class AnalysisOptions { 4 | public: 5 | bool disableNameLinting; 6 | bool disableAllIdLinting; 7 | bool disableCompilerIdLinting; 8 | bool disableCompilerArgumentIdLinting; 9 | bool disableLinkerIdLinting; 10 | bool disableCpuFamilyLinting; 11 | bool disableOsFamilyLinting; 12 | bool disableUnusedVariableCheck; 13 | bool disableArgTypeChecking; 14 | bool disableIterationVariableShadowingLint; 15 | bool enableIterationVariableLint; 16 | 17 | // This should be a better API somehow 18 | explicit AnalysisOptions(bool disableNameLinting = false, 19 | bool disableAllIdLinting = false, 20 | bool disableCompilerIdLinting = false, 21 | bool disableCompilerArgumentIdLinting = false, 22 | bool disableLinkerIdLinting = false, 23 | bool disableCpuFamilyLinting = false, 24 | bool disableOsFamilyLinting = false, 25 | bool disableUnusedVariableCheck = false, 26 | bool disableArgTypeChecking = false, 27 | bool disableIterationVariableShadowingLint = false, 28 | bool enableIterationVariableLint = false) 29 | : disableNameLinting(disableNameLinting), 30 | disableAllIdLinting(disableAllIdLinting), 31 | disableCompilerIdLinting(disableCompilerIdLinting), 32 | disableCompilerArgumentIdLinting(disableCompilerArgumentIdLinting), 33 | disableLinkerIdLinting(disableLinkerIdLinting), 34 | disableCpuFamilyLinting(disableCpuFamilyLinting), 35 | disableOsFamilyLinting(disableOsFamilyLinting), 36 | disableUnusedVariableCheck(disableUnusedVariableCheck), 37 | disableArgTypeChecking(disableArgTypeChecking), 38 | disableIterationVariableShadowingLint( 39 | disableIterationVariableShadowingLint), 40 | enableIterationVariableLint(enableIterationVariableLint) {} 41 | }; 42 | -------------------------------------------------------------------------------- /src/libanalyze/meson.build: -------------------------------------------------------------------------------- 1 | analyze_inc = include_directories('.', 'options', 'subprojects', 'typeanalyzer') 2 | analyze_deps = [ 3 | ast_dep, 4 | tree_sitter_dep, 5 | tree_sitter_meson_dep, 6 | objects_dep, 7 | parsing_dep, 8 | typenamespace_dep, 9 | wrap_dep, 10 | polyfill_dep, 11 | ] 12 | analyze_lib = static_library( 13 | 'analyze', 14 | 'options/optionstate.cpp', 15 | 'options/optionextractor.cpp', 16 | 'options/optiondiagnosticvisitor.cpp', 17 | 'typeanalyzer/typeanalyzer.cpp', 18 | 'subprojects/subprojectstate.cpp', 19 | 'typeanalyzer/partialinterpreter.cpp', 20 | 'subprojects/subproject.cpp', 21 | 'mesontree.cpp', 22 | include_directories: analyze_inc, 23 | dependencies: analyze_deps, 24 | ) 25 | analyze_dep = declare_dependency( 26 | dependencies: analyze_deps, 27 | include_directories: analyze_inc, 28 | link_with: [analyze_lib], 29 | ) 30 | -------------------------------------------------------------------------------- /src/libanalyze/options/optionextractor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mesonoption.hpp" 4 | #include "node.hpp" 5 | 6 | #include 7 | #include 8 | 9 | class OptionExtractor : public CodeVisitor { 10 | public: 11 | std::vector> options; 12 | void visitArgumentList(ArgumentList *node) override; 13 | void visitArrayLiteral(ArrayLiteral *node) override; 14 | void visitAssignmentStatement(AssignmentStatement *node) override; 15 | void visitBinaryExpression(BinaryExpression *node) override; 16 | void visitBooleanLiteral(BooleanLiteral *node) override; 17 | void visitBuildDefinition(BuildDefinition *node) override; 18 | void visitConditionalExpression(ConditionalExpression *node) override; 19 | void visitDictionaryLiteral(DictionaryLiteral *node) override; 20 | void visitFunctionExpression(FunctionExpression *node) override; 21 | void visitIdExpression(IdExpression *node) override; 22 | void visitIntegerLiteral(IntegerLiteral *node) override; 23 | void visitIterationStatement(IterationStatement *node) override; 24 | void visitKeyValueItem(KeyValueItem *node) override; 25 | void visitKeywordItem(KeywordItem *node) override; 26 | void visitMethodExpression(MethodExpression *node) override; 27 | void visitSelectionStatement(SelectionStatement *node) override; 28 | void visitStringLiteral(StringLiteral *node) override; 29 | void visitSubscriptExpression(SubscriptExpression *node) override; 30 | void visitUnaryExpression(UnaryExpression *node) override; 31 | void visitErrorNode(ErrorNode *node) override; 32 | void visitBreakNode(BreakNode *node) override; 33 | void visitContinueNode(ContinueNode *node) override; 34 | }; 35 | -------------------------------------------------------------------------------- /src/libanalyze/options/optionstate.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mesonoption.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | class OptionState { 10 | public: 11 | std::vector> options; 12 | 13 | OptionState(); 14 | 15 | explicit OptionState(const std::vector> &options) 16 | : OptionState() { 17 | for (const auto &option : options) { 18 | this->options.push_back(option); 19 | } 20 | } 21 | 22 | [[nodiscard]] std::shared_ptr 23 | findOption(const std::string &name) const { 24 | for (const auto &option : this->options) { 25 | if (option->name == name) { 26 | return option; 27 | } 28 | } 29 | return nullptr; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/libanalyze/subprojects/subproject.cpp: -------------------------------------------------------------------------------- 1 | #include "subproject.hpp" 2 | 3 | #include "analysisoptions.hpp" 4 | #include "mesontree.hpp" 5 | #include "typenamespace.hpp" 6 | 7 | #include 8 | #include 9 | 10 | void MesonSubproject::parse(const AnalysisOptions &options, int depth, 11 | const std::string &parentIdentifier, 12 | const TypeNamespace &ns, bool downloadSubprojects, 13 | bool useCustomParser, MesonTree *parent) { 14 | this->tree = std::make_shared(this->realpath, ns); 15 | this->tree->parent = parent; 16 | this->tree->useCustomParser = useCustomParser; 17 | this->tree->depth = depth; 18 | this->tree->name = this->name; 19 | this->tree->identifier = parentIdentifier + ">" + this->name; 20 | this->tree->fullParse(options, downloadSubprojects); 21 | } 22 | -------------------------------------------------------------------------------- /src/libanalyze/subprojects/subprojectstate.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "analysisoptions.hpp" 3 | #include "subproject.hpp" 4 | #include "typenamespace.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class SubprojectState { 15 | public: 16 | std::filesystem::path root; 17 | std::vector> subprojects; 18 | bool used = false; 19 | 20 | explicit SubprojectState(std::filesystem::path root) 21 | : root(std::move(root)) {} 22 | 23 | void findSubprojects(bool downloadSubprojects, MesonTree *tree); 24 | void initSubprojects(); 25 | void updateSubprojects(); 26 | void parseSubprojects(const AnalysisOptions &options, int depth, 27 | const std::string &parentIdentifier, 28 | const TypeNamespace &ns, bool downloadSubprojects, 29 | bool useCustomParser, MesonTree *tree); 30 | 31 | [[nodiscard]] bool hasSubproject(const std::string &name) const { 32 | if (!this->used) { 33 | return false; 34 | } 35 | return std::ranges::any_of( 36 | this->subprojects.begin(), this->subprojects.end(), 37 | [&name](const auto subproj) { return subproj->name == name; }); 38 | } 39 | 40 | [[nodiscard]] std::shared_ptr 41 | findSubproject(const std::string &name) const { 42 | if (!this->used) { 43 | return nullptr; 44 | } 45 | for (const auto &subproj : this->subprojects) { 46 | if (subproj->name == name) { 47 | return subproj; 48 | } 49 | } 50 | return nullptr; 51 | } 52 | 53 | void fullSetup(const AnalysisOptions &options, int depth, 54 | const std::string &parentIdentifier, const TypeNamespace &ns, 55 | bool downloadSubprojects, bool useCustomParser, 56 | MesonTree *tree) { 57 | this->findSubprojects(downloadSubprojects, tree); 58 | this->initSubprojects(); 59 | this->updateSubprojects(); 60 | this->parseSubprojects(options, depth, parentIdentifier, ns, 61 | downloadSubprojects, useCustomParser, tree); 62 | } 63 | }; 64 | 65 | std::optional 66 | createIdentifierForWrap(const std::filesystem::path &path); 67 | -------------------------------------------------------------------------------- /src/libanalyze/typeanalyzer/scope.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "type.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Scope { 12 | public: 13 | std::unordered_map>> variables; 14 | 15 | [[nodiscard]] std::optional 16 | findVariableOfType(const std::shared_ptr &expected) const { 17 | for (const auto &[name, types] : this->variables) { 18 | for (const auto &type : types) { 19 | if (type->toString() == expected->toString()) { 20 | return name; 21 | } 22 | } 23 | } 24 | return std::nullopt; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/libast/ini.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "location.hpp" 3 | #include "sourcefile.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace ast::ini { 13 | class Node { 14 | public: 15 | const std::shared_ptr file; 16 | const Location location; 17 | 18 | virtual ~Node() = default; 19 | 20 | protected: 21 | Node(std::shared_ptr file, const TSNode &node); 22 | }; 23 | 24 | class StringValue : public ast::ini::Node { 25 | public: 26 | std::string value; 27 | StringValue(const std::shared_ptr &file, const TSNode &node); 28 | }; 29 | 30 | class ErrorNode : public Node { 31 | public: 32 | std::string message; 33 | 34 | ErrorNode(std::shared_ptr file, const TSNode &node, 35 | std::string message) 36 | : Node(std::move(file), node), message(std::move(message)) {} 37 | }; 38 | 39 | class KeyValuePair : public ast::ini::Node { 40 | public: 41 | std::shared_ptr key; 42 | std::shared_ptr value; 43 | KeyValuePair(const std::shared_ptr &file, const TSNode &node); 44 | }; 45 | 46 | class Section : public ast::ini::Node { 47 | public: 48 | std::shared_ptr name; 49 | std::vector> keyValuePairs; 50 | Section(const std::shared_ptr &file, const TSNode &node); 51 | 52 | std::optional findStringValue(const std::string &key); 53 | }; 54 | 55 | class IniFile : public ast::ini::Node { 56 | public: 57 | std::vector> sections; 58 | 59 | IniFile(const std::shared_ptr &file, const TSNode &node); 60 | }; 61 | 62 | std::shared_ptr makeNode(const std::shared_ptr &file, 63 | const TSNode &node); 64 | 65 | } // namespace ast::ini 66 | -------------------------------------------------------------------------------- /src/libast/location.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "polyfill.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | constexpr auto HALF_OF_U64 = 32U; 10 | 11 | class Location { 12 | public: 13 | Location(uint32_t startLine, uint32_t endLine, uint32_t startColumn, 14 | uint32_t endColumn) 15 | : startLine(startLine), endLine(endLine), startColumn(startColumn), 16 | endColumn(endColumn), 17 | columns((this->startColumn) | 18 | (((uint64_t)this->endColumn) << HALF_OF_U64)), 19 | lines((this->startLine) | (((uint64_t)this->endLine) << HALF_OF_U64)) {} 20 | 21 | Location() 22 | : startLine(0), endLine(0), startColumn(0), endColumn(0), columns(0), 23 | lines(0) {} 24 | 25 | Location(const std::pair &start, 26 | const std::pair &end) 27 | : Location(start.first, end.first, start.second, end.second) {} 28 | 29 | Location(const Location &start, const Location &end) 30 | : Location(start.startLine, end.endLine, start.startColumn, 31 | end.endColumn) {} 32 | 33 | Location(const std::pair &start, const Location &end) 34 | : Location(start.first, end.endLine, start.second, end.endColumn) {} 35 | 36 | explicit Location(const TSNode &node) 37 | : startLine(ts_node_start_point(node).row), 38 | endLine(node.id ? (ts_node_end_point(node).row) : 0), 39 | startColumn(ts_node_start_point(node).column), 40 | endColumn(node.id ? (ts_node_end_point(node).column) : 0), 41 | columns((this->startColumn) | 42 | (((uint64_t)this->endColumn) << HALF_OF_U64)), 43 | lines((this->startLine) | (((uint64_t)this->endLine) << HALF_OF_U64)) {} 44 | 45 | const uint32_t startLine; 46 | const uint32_t endLine; 47 | const uint32_t startColumn; 48 | const uint32_t endColumn; 49 | const uint64_t columns; 50 | const uint64_t lines; 51 | 52 | [[nodiscard]] std::string format() const { 53 | return std::format("[{}:{}]->[{}:{}]", this->startLine, this->startColumn, 54 | this->endLine, this->endColumn); 55 | } 56 | 57 | bool operator==(const Location &other) const { 58 | return this->columns == other.columns && this->lines == other.lines; 59 | } 60 | }; 61 | -------------------------------------------------------------------------------- /src/libast/meson.build: -------------------------------------------------------------------------------- 1 | ast_inc = include_directories('.') 2 | ast_deps = [tree_sitter_dep, objects_dep, utils_dep] 3 | ast_lib = static_library( 4 | 'ast', 5 | 'sourcefile.cpp', 6 | 'ini.cpp', 7 | 'node.cpp', 8 | include_directories: ast_inc, 9 | dependencies: ast_deps, 10 | ) 11 | ast_dep = declare_dependency( 12 | dependencies: ast_deps, 13 | include_directories: ast_inc, 14 | link_with: [ast_lib], 15 | ) 16 | -------------------------------------------------------------------------------- /src/libast/sourcefile.cpp: -------------------------------------------------------------------------------- 1 | #include "sourcefile.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | const std::string &SourceFile::contents() { 9 | if (this->cached) { 10 | return this->cachedContents; 11 | } 12 | const auto &path = std::filesystem::path(this->file); 13 | std::ifstream fstream(path); 14 | auto fileSize = std::filesystem::file_size(path); 15 | this->cachedContents.resize(fileSize, '\0'); 16 | fstream.read(this->cachedContents.data(), (std::streamsize)fileSize); 17 | this->cached = true; 18 | return this->cachedContents; 19 | } 20 | -------------------------------------------------------------------------------- /src/libast/sourcefile.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "location.hpp" 4 | #include "polyfill.hpp" 5 | #include "utils.hpp" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class SourceFile { 15 | public: 16 | const std::filesystem::path file; 17 | const uint32_t hashed; 18 | 19 | explicit SourceFile(const std::filesystem::path &file) 20 | : file(std::filesystem::absolute(file)), 21 | hashed(djb2(this->file.native())) {} 22 | 23 | virtual const std::string &contents(); 24 | virtual ~SourceFile() = default; 25 | 26 | std::string extractNodeValue(const TSNode &node) { 27 | auto startByte = ts_node_start_byte(node); 28 | auto endByte = ts_node_end_byte(node); 29 | return this->extractNodeValue(startByte, endByte); 30 | } 31 | 32 | std::string extractNodeValue(uint32_t startByte, uint32_t endByte) { 33 | const auto &contents = this->contents(); 34 | return contents.substr(startByte, endByte - startByte); 35 | } 36 | 37 | std::string extractNodeValue(const Location &loc) { 38 | const auto &string = this->contents(); 39 | const auto &lines = split(string, "\n"); 40 | if (loc.startLine == loc.endLine) { 41 | const auto &line = lines[loc.startLine]; 42 | return line.substr(loc.startColumn, loc.endColumn - loc.startColumn); 43 | } 44 | const auto &firstLine = lines[loc.startLine]; 45 | const auto &firstLine1 = firstLine.substr(loc.startColumn); 46 | const auto &lastLine = lines[loc.endLine]; 47 | const auto &lastLine1 = lastLine.substr(0, loc.endColumn); 48 | std::string concatenated; 49 | for (size_t idx = loc.startLine + 1; idx < loc.endLine; idx++) { 50 | concatenated += std::format("{}\n", lines[idx]); 51 | } 52 | return std::format("{}\n{}{}", firstLine1, concatenated, lastLine1); 53 | } 54 | 55 | private: 56 | std::string cachedContents; 57 | bool cached = false; 58 | }; 59 | 60 | class MemorySourceFile : public SourceFile { 61 | private: 62 | std::string str; 63 | 64 | public: 65 | MemorySourceFile(std::string contents, const std::filesystem::path &file) 66 | : SourceFile(file), str(std::move(contents)) {} 67 | 68 | const std::string &contents() override { return this->str; } 69 | }; 70 | -------------------------------------------------------------------------------- /src/libcxathrow/backtrace_execinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | #include "polyfill.hpp" 3 | #include "shared.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | constexpr auto BACKTRACE_LENGTH = 100; 12 | const static Logger LOG("cxathrow"); // NOLINT 13 | static void printAddr(uint32_t idx, void *addr); 14 | 15 | void doBacktrace() { 16 | std::array backtraces; 17 | auto btSize = backtrace(backtraces.data(), BACKTRACE_LENGTH); 18 | for (auto i = 0; i < btSize; i++) { 19 | printAddr(i, backtraces[i]); 20 | } 21 | } 22 | 23 | static void printAddr(uint32_t idx, void *addr) { 24 | Dl_info info; 25 | if (dladdr(addr, &info) != 0) { 26 | if (info.dli_sname == nullptr) { 27 | info.dli_sname = "???"; 28 | } 29 | if (info.dli_saddr == nullptr) { 30 | info.dli_saddr = addr; 31 | } 32 | auto *demangled = 33 | abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, nullptr); 34 | auto offset = (unsigned char *)addr - (unsigned char *)info.dli_saddr; 35 | const auto *symName = demangled ? demangled : info.dli_sname; 36 | LOG.debug(std::format("#{}: {}({}+{:#x}) [{}]", idx, info.dli_fname, 37 | symName, offset, addr)); 38 | if (demangled) { 39 | free(demangled); 40 | } 41 | } else { 42 | LOG.debug(std::format("#{}: {}", idx, addr)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/libcxathrow/backtrace_libunwind.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define UNW_LOCAL_ONLY 4 | #include "log.hpp" 5 | #include "polyfill.hpp" 6 | #include "shared.hpp" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | constexpr auto SYMBOL_LENGTH = 2048; 13 | const static Logger LOG("cxathrow"); // NOLINT 14 | 15 | void doBacktrace() { 16 | unw_cursor_t cursor; 17 | unw_context_t context; 18 | 19 | // Initialize cursor to current frame 20 | unw_getcontext(&context); 21 | unw_init_local(&cursor, &context); 22 | uint32_t idx = 0; 23 | while (unw_step(&cursor) > 0) { 24 | unw_word_t /*NOLINT*/ pc; 25 | unw_word_t offset; 26 | unw_get_reg(&cursor, UNW_REG_IP, &pc); 27 | std::array symbolName; 28 | if (!unw_get_proc_name(&cursor, symbolName.data(), symbolName.size(), 29 | &offset)) { 30 | auto *demangled = 31 | abi::__cxa_demangle(symbolName.data(), nullptr, nullptr, nullptr); 32 | const auto *symName = demangled ? demangled : symbolName.data(); 33 | LOG.debug( 34 | std::format("#{}: {}+{:#x} [{}]", idx, symName, offset, (void *)pc)); 35 | if (demangled) { 36 | free(demangled); 37 | } 38 | } else { 39 | LOG.debug(std::format("#{}: {}", idx, (void *)pc)); 40 | } 41 | idx++; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/libcxathrow/backtrace_null.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | #include "polyfill.hpp" 3 | #include "shared.hpp" 4 | 5 | #include 6 | 7 | const static Logger LOG("cxathrow"); // NOLINT 8 | 9 | void doBacktrace() { LOG.debug("No backtrace possible...."); } 10 | -------------------------------------------------------------------------------- /src/libcxathrow/backtrace_stacktrace.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | #include "polyfill.hpp" 3 | #include "shared.hpp" 4 | 5 | #include 6 | #include 7 | 8 | const static Logger LOG("cxathrow"); // NOLINT 9 | 10 | void doBacktrace() { 11 | auto stacktrace = std::stacktrace::current(); 12 | auto idx = 0; 13 | for (const auto &element : stacktrace) { 14 | LOG.debug(std::format("#{}: {} ({}:{})", idx, element.description(), 15 | element.source_file(), element.source_line())); 16 | idx++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_darwin_clang.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include 4 | #include 5 | CxaThrowType origCxaThrow = nullptr; 6 | 7 | extern "C" void __cxa_throw /*NOLINT*/ (void *thrown_exception, 8 | std::type_info *typeinfo, 9 | void (*dest)(void *)) { 10 | if (origCxaThrow == nullptr) { 11 | origCxaThrow = (CxaThrowType)dlsym(RTLD_NEXT, "__cxa_throw"); 12 | } 13 | logExceptionType(thrown_exception, typeinfo); 14 | doBacktrace(); 15 | origCxaThrow(thrown_exception, typeinfo, dest); 16 | } 17 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_linux_clang.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include 4 | #include 5 | CxaThrowType origCxaThrow = nullptr; 6 | 7 | extern "C" void 8 | __cxa_throw /*NOLINT*/ (void *thrown_exception, std::type_info *typeinfo, 9 | void(_GLIBCXX_CDTOR_CALLABI *dest)(void *)) { 10 | if (origCxaThrow == nullptr) { 11 | origCxaThrow = (CxaThrowType)dlsym(RTLD_NEXT, "__cxa_throw"); 12 | } 13 | logExceptionType(thrown_exception, typeinfo); 14 | doBacktrace(); 15 | origCxaThrow(thrown_exception, typeinfo, dest); 16 | } 17 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_linux_gcc.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include 4 | 5 | CxaThrowType origCxaThrow = nullptr; 6 | 7 | #ifdef _WIN32 8 | #define EXPORT __declspec(dllexport) 9 | #else 10 | #define EXPORT 11 | #endif 12 | extern "C" EXPORT __attribute__((noreturn)) void 13 | __cxa_throw /*NOLINT*/ (void *thrown_exception, void *pvtinfo, 14 | void (*dest)(void *)) { 15 | if (origCxaThrow == nullptr) { 16 | origCxaThrow = (CxaThrowType)dlsym(RTLD_NEXT, "__cxa_throw"); 17 | } 18 | const auto *typeinfo = (const std::type_info *)pvtinfo; 19 | logExceptionType(thrown_exception, typeinfo); 20 | doBacktrace(); 21 | origCxaThrow(thrown_exception, pvtinfo, dest); 22 | } 23 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_linux_static_clang.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include 4 | 5 | extern "C" void /*NOLINT*/ __real___cxa_throw(void *, std::type_info *, 6 | void (*)(void *)); 7 | 8 | extern "C" void 9 | __wrap___cxa_throw /*NOLINT*/ (void *thrown_exception, 10 | std::type_info *typeinfo, 11 | void(_GLIBCXX_CDTOR_CALLABI *dest)(void *)) { 12 | logExceptionType(thrown_exception, typeinfo); 13 | doBacktrace(); 14 | __real___cxa_throw(thrown_exception, typeinfo, dest); 15 | } 16 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_linux_static_gcc.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include 4 | 5 | extern "C" void /*NOLINT*/ __real___cxa_throw(void *, void *, void (*)(void *)); 6 | 7 | extern "C" void __wrap___cxa_throw /*NOLINT*/ 8 | (void * /*NOLINT*/ thrown_exception, void *pvtinfo, void (*dest)(void *)) { 9 | const auto *typeinfo = (const std::type_info *)pvtinfo; 10 | logExceptionType(thrown_exception, typeinfo); 11 | doBacktrace(); 12 | __real___cxa_throw(thrown_exception, pvtinfo, dest); 13 | } 14 | -------------------------------------------------------------------------------- /src/libcxathrow/handle_null.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/src/libcxathrow/handle_null.cpp -------------------------------------------------------------------------------- /src/libcxathrow/meson.build: -------------------------------------------------------------------------------- 1 | src_files = [ 2 | 'shared.cpp', 3 | ] 4 | is_static = get_option('static_build') 5 | dl_dep = dependency('dl', required: host_machine.system() == 'windows') 6 | cxathrow_deps = [log_dep, dl_dep] 7 | libunwind_dep = cxx.find_library('unwind', static: true, required: false) 8 | null_backtrace = (libunwind_dep.found() ? 'backtrace_libunwind.cpp' : 'backtrace_null.cpp') 9 | used_libunwind = false 10 | 11 | if cxx.get_id() == 'gcc' 12 | backtrace_dep = cxx.find_library('stdc++_libbacktrace', required: false) 13 | if not backtrace_dep.found() and cxx.version().version_compare('>=14.0.0') 14 | backtrace_dep = cxx.find_library('libstdc++exp', required: false) 15 | endif 16 | if backtrace_dep.found() 17 | src_files += 'backtrace_stacktrace.cpp' 18 | cxathrow_deps += backtrace_dep 19 | else 20 | if is_static or host_machine.system() == 'windows' 21 | # Should only happen in crappy distributions.... 22 | src_files += null_backtrace 23 | used_libunwind = true 24 | else 25 | src_files += 'backtrace_execinfo.cpp' 26 | endif 27 | endif 28 | if is_static 29 | src_files += 'handle_linux_static_gcc.cpp' 30 | else 31 | src_files += 'handle_linux_gcc.cpp' 32 | endif 33 | elif cxx.get_id() == 'clang' 34 | if is_static 35 | src_files += null_backtrace 36 | used_libunwind = true 37 | else 38 | src_files += 'backtrace_execinfo.cpp' 39 | endif 40 | 41 | if target_machine.system() == 'linux' 42 | if is_static 43 | src_files += 'handle_linux_static_clang.cpp' 44 | else 45 | src_files += 'handle_linux_clang.cpp' 46 | endif 47 | elif target_machine.system() == 'darwin' 48 | src_files += 'handle_darwin_clang.cpp' 49 | else 50 | src_files += 'handle_null.cpp' 51 | endif 52 | else 53 | src_files += [null_backtrace, 'handle_null.cpp'] 54 | used_libunwind = true 55 | endif 56 | 57 | if used_libunwind 58 | cxathrow_deps += libunwind_dep 59 | endif 60 | 61 | cxathrow_lib = static_library( 62 | 'cxathrow', 63 | src_files, 64 | dependencies: cxathrow_deps, 65 | ) 66 | cxathrow_dep = declare_dependency( 67 | dependencies: cxathrow_deps, 68 | link_with: [cxathrow_lib], 69 | ) 70 | -------------------------------------------------------------------------------- /src/libcxathrow/shared.cpp: -------------------------------------------------------------------------------- 1 | #include "shared.hpp" 2 | 3 | #include "log.hpp" 4 | #include "polyfill.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | const static Logger LOG("cxathrow"); // NOLINT 11 | 12 | void logExceptionType(const void *thrownException, 13 | const std::type_info *typeinfo) { 14 | auto *demangled = 15 | abi::__cxa_demangle(typeinfo->name(), nullptr, nullptr, nullptr); 16 | LOG.debug(std::format("Exception of type {}", 17 | demangled ? demangled : typeinfo->name())); 18 | if (demangled) { 19 | free(demangled); 20 | } 21 | #ifndef __APPLE__ 22 | const auto *exc = 23 | dynamic_cast(&typeid(std::exception)); 24 | const auto *cti = dynamic_cast(typeinfo); 25 | 26 | if (cti && exc) { 27 | auto *casted = reinterpret_cast( 28 | abi::__dynamic_cast(thrownException, exc, cti, -1)); 29 | if (casted) { 30 | LOG.debug(std::format(" what(): {}", casted->what())); 31 | } 32 | } 33 | #endif 34 | } 35 | -------------------------------------------------------------------------------- /src/libcxathrow/shared.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #if defined(__linux__) || defined(_WIN32) 5 | #ifdef __GNUC__ 6 | using CxaThrowType = void 7 | __attribute__((__noreturn__)) (*)(void *, void *, void (*)(void *)); 8 | #elif defined(__clang__) 9 | using CxaThrowType = void 10 | __attribute__((__noreturn__)) (*)(void *, std::type_info *, 11 | void(_GLIBCXX_CDTOR_CALLABI *)(void *)); 12 | #endif 13 | #elif defined(__APPLE__) 14 | using CxaThrowType = void (*)(void *, std::type_info *, void (*)(void *)); 15 | #endif 16 | 17 | void logExceptionType(const void *thrownException, 18 | const std::type_info *typeinfo); 19 | void doBacktrace(); 20 | -------------------------------------------------------------------------------- /src/libjsonrpc/jsonrpc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace jsonrpc { 15 | 16 | enum class JsonrpcError { 17 | PARSE_ERROR = -32700, 18 | INVALID_REQUEST = -32600, 19 | METHOD_NOT_FOUND = -32601, 20 | INVALID_PARAMS = -32602, 21 | INTERNAL_ERROR = -32603, 22 | }; 23 | 24 | class JsonRpcHandler; 25 | 26 | class JsonRpcServer { 27 | private: 28 | std::istream &input; 29 | std::ostream &output; 30 | std::mutex output_mutex; 31 | std::vector> futures; 32 | void evaluateData(const std::shared_ptr &handler, 33 | nlohmann::json data); 34 | void sendToClient(const nlohmann::json &data); 35 | bool shouldExit = false; 36 | 37 | public: 38 | JsonRpcServer() : input(std::cin), output(std::cout) {} 39 | 40 | JsonRpcServer(std::istringstream &input, std::ostringstream &output) 41 | : input(input), output(output) {} 42 | 43 | void loop(const std::shared_ptr &handler); 44 | void reply(nlohmann::json callId, nlohmann::json result); 45 | void notification(const std::string &method, nlohmann::json params); 46 | void returnError(nlohmann::json callId, JsonrpcError error, 47 | const std::string &message); 48 | void exit(); 49 | void wait(); 50 | }; 51 | 52 | class JsonRpcHandler { 53 | public: 54 | std::shared_ptr server = nullptr; 55 | JsonRpcHandler(); 56 | 57 | virtual ~JsonRpcHandler() = default; 58 | 59 | virtual void handleNotification(std::string method, 60 | nlohmann::json params) = 0; 61 | virtual void handleRequest(std::string method, nlohmann::json callId, 62 | nlohmann::json params) = 0; 63 | }; 64 | }; // namespace jsonrpc 65 | -------------------------------------------------------------------------------- /src/libjsonrpc/meson.build: -------------------------------------------------------------------------------- 1 | jsonrpc_inc = include_directories('.') 2 | jsonrpc_deps = [polyfill_dep, nlohmann_json_dep] 3 | jsonrpc_lib = static_library( 4 | 'jsonrpc', 5 | 'jsonrpc.cpp', 6 | include_directories: [jsonrpc_inc], 7 | dependencies: jsonrpc_deps, 8 | ) 9 | jsonrpc_dep = declare_dependency( 10 | include_directories: jsonrpc_inc, 11 | link_with: [jsonrpc_lib], 12 | dependencies: jsonrpc_deps, 13 | ) 14 | -------------------------------------------------------------------------------- /src/liblangserver/completion.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "lsptypes.hpp" 4 | #include "mesontree.hpp" 5 | #include "node.hpp" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | std::vector complete(const std::filesystem::path &path, 12 | MesonTree *tree, 13 | const std::shared_ptr &ast, 14 | const LSPPosition &position, 15 | const std::set &pkgNames); 16 | -------------------------------------------------------------------------------- /src/liblangserver/documentsymbolvisitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lsptypes.hpp" 3 | #include "node.hpp" 4 | 5 | #include 6 | 7 | class DocumentSymbolVisitor : public CodeVisitor { 8 | public: 9 | std::vector symbols; 10 | void visitArgumentList(ArgumentList *node) override; 11 | void visitArrayLiteral(ArrayLiteral *node) override; 12 | void visitAssignmentStatement(AssignmentStatement *node) override; 13 | void visitBinaryExpression(BinaryExpression *node) override; 14 | void visitBooleanLiteral(BooleanLiteral *node) override; 15 | void visitBuildDefinition(BuildDefinition *node) override; 16 | void visitConditionalExpression(ConditionalExpression *node) override; 17 | void visitDictionaryLiteral(DictionaryLiteral *node) override; 18 | void visitFunctionExpression(FunctionExpression *node) override; 19 | void visitIdExpression(IdExpression *node) override; 20 | void visitIntegerLiteral(IntegerLiteral *node) override; 21 | void visitIterationStatement(IterationStatement *node) override; 22 | void visitKeyValueItem(KeyValueItem *node) override; 23 | void visitKeywordItem(KeywordItem *node) override; 24 | void visitMethodExpression(MethodExpression *node) override; 25 | void visitSelectionStatement(SelectionStatement *node) override; 26 | void visitStringLiteral(StringLiteral *node) override; 27 | void visitSubscriptExpression(SubscriptExpression *node) override; 28 | void visitUnaryExpression(UnaryExpression *node) override; 29 | void visitErrorNode(ErrorNode *node) override; 30 | void visitBreakNode(BreakNode *node) override; 31 | void visitContinueNode(ContinueNode *node) override; 32 | 33 | private: 34 | void createSymbol(const IdExpression *idExpr); 35 | }; 36 | -------------------------------------------------------------------------------- /src/liblangserver/foldingrangevisitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lsptypes.hpp" 3 | #include "node.hpp" 4 | 5 | #include 6 | 7 | class FoldingRangeVisitor : public CodeVisitor { 8 | public: 9 | std::vector ranges; 10 | void visitArgumentList(ArgumentList *node) override; 11 | void visitArrayLiteral(ArrayLiteral *node) override; 12 | void visitAssignmentStatement(AssignmentStatement *node) override; 13 | void visitBinaryExpression(BinaryExpression *node) override; 14 | void visitBooleanLiteral(BooleanLiteral *node) override; 15 | void visitBuildDefinition(BuildDefinition *node) override; 16 | void visitConditionalExpression(ConditionalExpression *node) override; 17 | void visitDictionaryLiteral(DictionaryLiteral *node) override; 18 | void visitFunctionExpression(FunctionExpression *node) override; 19 | void visitIdExpression(IdExpression *node) override; 20 | void visitIntegerLiteral(IntegerLiteral *node) override; 21 | void visitIterationStatement(IterationStatement *node) override; 22 | void visitKeyValueItem(KeyValueItem *node) override; 23 | void visitKeywordItem(KeywordItem *node) override; 24 | void visitMethodExpression(MethodExpression *node) override; 25 | void visitSelectionStatement(SelectionStatement *node) override; 26 | void visitStringLiteral(StringLiteral *node) override; 27 | void visitSubscriptExpression(SubscriptExpression *node) override; 28 | void visitUnaryExpression(UnaryExpression *node) override; 29 | void visitErrorNode(ErrorNode *node) override; 30 | void visitBreakNode(BreakNode *node) override; 31 | void visitContinueNode(ContinueNode *node) override; 32 | }; 33 | -------------------------------------------------------------------------------- /src/liblangserver/formatting.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | std::string formatFile(const std::filesystem::path &path, 6 | const std::string &toFormat, 7 | const std::filesystem::path &configFile); 8 | -------------------------------------------------------------------------------- /src/liblangserver/hover.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "lsptypes.hpp" 4 | #include "node.hpp" 5 | #include "optionstate.hpp" 6 | #include "typenamespace.hpp" 7 | 8 | Hover makeHoverForFunctionExpression( 9 | FunctionExpression *fe, const OptionState &options, 10 | const std::map &descriptions); 11 | Hover makeHoverForMethodExpression(MethodExpression *me); 12 | Hover makeHoverForId(const TypeNamespace &ns, IdExpression *idExpr); 13 | -------------------------------------------------------------------------------- /src/liblangserver/inlayhintvisitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lsptypes.hpp" 3 | #include "node.hpp" 4 | #include "type.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class InlayHintVisitor : public CodeVisitor { 11 | public: 12 | InlayHintVisitor(bool removeDefaultTypesInInlayHints, 13 | bool disablePosargInlayHints) 14 | : removeDefaultTypesInInlayHints(removeDefaultTypesInInlayHints), 15 | disablePosargInlayHints(disablePosargInlayHints) {} 16 | 17 | std::vector hints; 18 | void visitArgumentList(ArgumentList *node) override; 19 | void visitArrayLiteral(ArrayLiteral *node) override; 20 | void visitAssignmentStatement(AssignmentStatement *node) override; 21 | void visitBinaryExpression(BinaryExpression *node) override; 22 | void visitBooleanLiteral(BooleanLiteral *node) override; 23 | void visitBuildDefinition(BuildDefinition *node) override; 24 | void visitConditionalExpression(ConditionalExpression *node) override; 25 | void visitDictionaryLiteral(DictionaryLiteral *node) override; 26 | void visitFunctionExpression(FunctionExpression *node) override; 27 | void visitIdExpression(IdExpression *node) override; 28 | void visitIntegerLiteral(IntegerLiteral *node) override; 29 | void visitIterationStatement(IterationStatement *node) override; 30 | void visitKeyValueItem(KeyValueItem *node) override; 31 | void visitKeywordItem(KeywordItem *node) override; 32 | void visitMethodExpression(MethodExpression *node) override; 33 | void visitSelectionStatement(SelectionStatement *node) override; 34 | void visitStringLiteral(StringLiteral *node) override; 35 | void visitSubscriptExpression(SubscriptExpression *node) override; 36 | void visitUnaryExpression(UnaryExpression *node) override; 37 | void visitErrorNode(ErrorNode *node) override; 38 | void visitBreakNode(BreakNode *node) override; 39 | void visitContinueNode(ContinueNode *node) override; 40 | 41 | private: 42 | bool removeDefaultTypesInInlayHints; 43 | bool disablePosargInlayHints; 44 | void makeHint(const Node *node); 45 | std::string prettify(const std::vector> &types, 46 | int depth); 47 | }; 48 | -------------------------------------------------------------------------------- /src/liblangserver/langserverutils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "lsptypes.hpp" 4 | #include "mesonmetadata.hpp" 5 | #include "node.hpp" 6 | #include "polyfill.hpp" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | inline std::filesystem::path extractPathFromUrl(const std::string &urlStr) { 15 | auto url = ada::parse(urlStr); 16 | if (!url) { 17 | throw std::runtime_error(std::format("Unknown URL: {}", urlStr)); 18 | } 19 | if (url->get_protocol() != "file:") { 20 | throw std::runtime_error( 21 | std::format("Unknown protocol: {}", url->get_protocol())); 22 | } 23 | auto input = url->get_pathname(); 24 | auto ret = ada::unicode::percent_decode(input, input.find('%')); 25 | #ifdef _WIN32 26 | // For Windows: We get e.g. /D:/a/... 27 | // We will transform it to D:/a/... 28 | if (ret.size() > 3 && ret[0] == '/' && ret[2] == ':') { 29 | ret = ret.substr(1); 30 | } 31 | #endif 32 | return {ret}; 33 | } 34 | 35 | inline std::string pathToUrl(const std::filesystem::path &path) { 36 | auto ret = ada::href_from_file(path.generic_string()); 37 | return ret; 38 | } 39 | 40 | inline LSPDiagnostic makeLSPDiagnostic(const Diagnostic &diag) { 41 | auto range = LSPRange(LSPPosition(diag.startLine, diag.startColumn), 42 | LSPPosition(diag.endLine, diag.endColumn)); 43 | auto severity = diag.severity == Severity::ERROR 44 | ? DiagnosticSeverity::LSP_ERROR 45 | : DiagnosticSeverity::LSP_WARNING; 46 | std::vector tags; 47 | if (diag.deprecated) { 48 | tags.push_back(DiagnosticTag::LSP_DEPRECATED); 49 | } 50 | if (diag.unnecessary) { 51 | tags.push_back(DiagnosticTag::LSP_UNNECESSARY); 52 | } 53 | return {range, severity, diag.message, tags}; 54 | } 55 | 56 | inline LSPRange nodeToRange(const Node *node) { 57 | const auto &loc = node->location; 58 | return {LSPPosition(loc.startLine, loc.startColumn), 59 | LSPPosition(loc.endLine, loc.endColumn)}; 60 | } 61 | -------------------------------------------------------------------------------- /src/liblangserver/meson.build: -------------------------------------------------------------------------------- 1 | langserver_inc = include_directories('.') 2 | langserver_deps = [ 3 | jsonrpc_dep, 4 | lsptypes_dep, 5 | log_dep, 6 | ls_dep, 7 | ada_dep, 8 | analyze_dep, 9 | uuid_dep, 10 | muon_dep, 11 | pkgconf_dep, 12 | ] 13 | langserver_lib = static_library( 14 | 'langserver', 15 | 'langserver.cpp', 16 | 'completion.cpp', 17 | 'workspace.cpp', 18 | 'task.cpp', 19 | 'inlayhintvisitor.cpp', 20 | 'foldingrangevisitor.cpp', 21 | 'semantictokensvisitor.cpp', 22 | 'documentsymbolvisitor.cpp', 23 | 'codeactionvisitor.cpp', 24 | 'hover.cpp', 25 | 'formatting.cpp', 26 | cpp_args: [ 27 | '-DVERSION="' + meson.project_version() + '"', 28 | ], 29 | include_directories: langserver_inc, 30 | dependencies: langserver_deps, 31 | ) 32 | 33 | langserver_dep = declare_dependency( 34 | dependencies: langserver_deps, 35 | include_directories: langserver_inc, 36 | link_with: [langserver_lib], 37 | ) 38 | -------------------------------------------------------------------------------- /src/liblangserver/semantictokensvisitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "location.hpp" 3 | #include "node.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | constexpr int TOKEN_LENGTH = 5; 11 | 12 | class SemanticTokensVisitor : public CodeVisitor { 13 | public: 14 | void visitArgumentList(ArgumentList *node) override; 15 | void visitArrayLiteral(ArrayLiteral *node) override; 16 | void visitAssignmentStatement(AssignmentStatement *node) override; 17 | void visitBinaryExpression(BinaryExpression *node) override; 18 | void visitBooleanLiteral(BooleanLiteral *node) override; 19 | void visitBuildDefinition(BuildDefinition *node) override; 20 | void visitConditionalExpression(ConditionalExpression *node) override; 21 | void visitDictionaryLiteral(DictionaryLiteral *node) override; 22 | void visitFunctionExpression(FunctionExpression *node) override; 23 | void visitIdExpression(IdExpression *node) override; 24 | void visitIntegerLiteral(IntegerLiteral *node) override; 25 | void visitIterationStatement(IterationStatement *node) override; 26 | void visitKeyValueItem(KeyValueItem *node) override; 27 | void visitKeywordItem(KeywordItem *node) override; 28 | void visitMethodExpression(MethodExpression *node) override; 29 | void visitSelectionStatement(SelectionStatement *node) override; 30 | void visitStringLiteral(StringLiteral *node) override; 31 | void visitSubscriptExpression(SubscriptExpression *node) override; 32 | void visitUnaryExpression(UnaryExpression *node) override; 33 | void visitErrorNode(ErrorNode *node) override; 34 | void visitBreakNode(BreakNode *node) override; 35 | void visitContinueNode(ContinueNode *node) override; 36 | 37 | std::vector finish(); 38 | 39 | private: 40 | std::vector> tokens; 41 | void makeSemanticToken(const Node *node, size_t idx, uint64_t modifiers); 42 | void insertTokens(long matchPosition, long matchLength, const Location &loc); 43 | }; 44 | -------------------------------------------------------------------------------- /src/liblangserver/task.cpp: -------------------------------------------------------------------------------- 1 | #include "task.hpp" 2 | 3 | #include "log.hpp" 4 | #include "polyfill.hpp" 5 | 6 | #include 7 | 8 | const static Logger LOG("Task"); // NOLINT 9 | 10 | void Task::run() { 11 | try { 12 | LOG.info("Running task " + this->uuid); 13 | this->state = TaskState::RUNNING; 14 | this->taskFunction(); 15 | if (this->cancelled) { 16 | LOG.info(std::format("Task {} was cancelled", this->uuid)); 17 | } else { 18 | LOG.info(std::format("Task {} finished", this->uuid)); 19 | } 20 | } catch (...) { 21 | auto currentException = std::current_exception(); 22 | LOG.error(std::format("Caught exception in task {}", this->uuid)); 23 | } 24 | this->state = TaskState::ENDED; 25 | } 26 | -------------------------------------------------------------------------------- /src/liblangserver/task.hpp: -------------------------------------------------------------------------------- 1 | #include "polyfill.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #ifndef _WIN32 10 | #include 11 | 12 | // See https://github.com/netdata/netdata/pull/10313 13 | #ifndef UUID_STR_LEN 14 | #define UUID_STR_LEN 37 15 | #endif 16 | #else 17 | #include 18 | #include 19 | #endif 20 | 21 | enum class TaskState { 22 | PENDING, 23 | RUNNING, 24 | ENDED, 25 | }; 26 | 27 | class Task { 28 | private: 29 | std::string uuid; 30 | bool cancelled = false; 31 | std::mutex mtx; 32 | 33 | std::function taskFunction; 34 | 35 | public: 36 | std::atomic state; 37 | 38 | explicit Task(std::function func) : taskFunction(std::move(func)) { 39 | #ifndef _WIN32 40 | uuid_t filename; 41 | uuid_generate(filename); 42 | std::array out; 43 | uuid_unparse(filename, out.data()); 44 | this->uuid = std::format("{}", out.data()); 45 | #else 46 | const auto now = std::chrono::system_clock::now(); 47 | this->uuid = std::format("{:%d-%m-%Y %H:%M:%OS}", now); 48 | #endif 49 | this->state = TaskState::PENDING; 50 | } 51 | 52 | [[nodiscard]] std::string getUUID() const { return uuid; } 53 | 54 | void cancel() { 55 | std::scoped_lock const lock(mtx); 56 | cancelled = true; 57 | } 58 | 59 | [[nodiscard]] bool isCancelled() { 60 | std::scoped_lock const lock(mtx); 61 | return cancelled; 62 | } 63 | 64 | void run(); 65 | }; 66 | -------------------------------------------------------------------------------- /src/liblog/log.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Logger { 7 | private: 8 | std::string logmodule; 9 | std::string red; 10 | std::string yellow; 11 | std::string blue; 12 | std::string green; 13 | std::string reset; 14 | bool noOutput = false; 15 | 16 | public: 17 | explicit Logger(std::string logmodule); 18 | 19 | void 20 | info(const std::string &msg, 21 | std::source_location location = std::source_location::current()) const; 22 | void 23 | debug(const std::string &msg, 24 | std::source_location location = std::source_location::current()) const; 25 | void 26 | error(const std::string &msg, 27 | std::source_location location = std::source_location::current()) const; 28 | void 29 | warn(const std::string &msg, 30 | std::source_location location = std::source_location::current()) const; 31 | }; 32 | -------------------------------------------------------------------------------- /src/liblog/meson.build: -------------------------------------------------------------------------------- 1 | log_inc = include_directories('.') 2 | log_lib = static_library( 3 | 'log', 4 | 'log.cpp', 5 | include_directories: log_inc, 6 | dependencies: polyfill_dep, 7 | ) 8 | log_dep = declare_dependency( 9 | include_directories: log_inc, 10 | link_with: [log_lib], 11 | dependencies: polyfill_dep, 12 | ) 13 | -------------------------------------------------------------------------------- /src/libls/ls.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "jsonrpc.hpp" 3 | #include "lsptypes.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class AbstractLanguageServer : public jsonrpc::JsonRpcHandler { 12 | public: 13 | void handleNotification(std::string method, nlohmann::json params) override; 14 | void handleRequest(std::string method, nlohmann::json callId, 15 | nlohmann::json params) override; 16 | 17 | virtual InitializeResult initialize(InitializeParams ¶ms) = 0; 18 | virtual std::vector inlayHints(InlayHintParams ¶ms) = 0; 19 | virtual std::vector 20 | foldingRanges(FoldingRangeParams ¶ms) = 0; 21 | virtual std::vector 22 | semanticTokens(SemanticTokensParams ¶ms) = 0; 23 | virtual TextEdit formatting(DocumentFormattingParams ¶ms) = 0; 24 | virtual std::vector 25 | documentSymbols(DocumentSymbolParams ¶ms) = 0; 26 | virtual std::optional hover(HoverParams ¶ms) = 0; 27 | virtual std::vector 28 | highlight(DocumentHighlightParams ¶ms) = 0; 29 | virtual std::optional rename(RenameParams ¶ms) = 0; 30 | virtual std::vector declaration(DeclarationParams ¶ms) = 0; 31 | virtual std::vector definition(DefinitionParams ¶ms) = 0; 32 | virtual std::vector codeAction(CodeActionParams ¶ms) = 0; 33 | virtual std::vector completion(CompletionParams ¶ms) = 0; 34 | virtual void shutdown() = 0; 35 | 36 | virtual void onInitialized(InitializedParams ¶ms) = 0; 37 | virtual void onExit() = 0; 38 | virtual void 39 | onDidChangeConfiguration(DidChangeConfigurationParams ¶ms) = 0; 40 | virtual void onDidOpenTextDocument(DidOpenTextDocumentParams ¶ms) = 0; 41 | virtual void onDidChangeTextDocument(DidChangeTextDocumentParams ¶ms) = 0; 42 | virtual void onDidSaveTextDocument(DidSaveTextDocumentParams ¶ms) = 0; 43 | virtual void onDidCloseTextDocument(DidCloseTextDocumentParams ¶ms) = 0; 44 | }; 45 | -------------------------------------------------------------------------------- /src/libls/meson.build: -------------------------------------------------------------------------------- 1 | ls_inc = include_directories('.') 2 | ls_deps = [jsonrpc_dep, lsptypes_dep, log_dep, polyfill_dep] 3 | ls_lib = static_library( 4 | 'ls', 5 | 'ls.cpp', 6 | include_directories: [ls_inc], 7 | dependencies: ls_deps, 8 | ) 9 | 10 | ls_dep = declare_dependency( 11 | dependencies: ls_deps, 12 | include_directories: ls_inc, 13 | link_with: [ls_lib], 14 | ) 15 | -------------------------------------------------------------------------------- /src/liblsptypes/meson.build: -------------------------------------------------------------------------------- 1 | lsptypes_inc = include_directories('.') 2 | lsptypes_deps = [nlohmann_json_dep] 3 | lsptypes_dep = declare_dependency( 4 | dependencies: lsptypes_deps, 5 | include_directories: lsptypes_inc, 6 | ) 7 | -------------------------------------------------------------------------------- /src/libobjects/argument.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "deprecationstate.hpp" 4 | #include "type.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Argument { 12 | public: 13 | const std::string name; 14 | const std::vector> types; 15 | const DeprecationState deprecationState; 16 | const bool optional; 17 | virtual ~Argument() = default; 18 | 19 | protected: 20 | Argument(std::string name, std::vector> types, 21 | bool optional, DeprecationState deprecationState = {}) 22 | : name(std::move(name)), types(std::move(types)), 23 | deprecationState(std::move(deprecationState)), optional(optional) {} 24 | }; 25 | 26 | class Kwarg : public Argument { 27 | public: 28 | Kwarg(std::string name, std::vector> types, 29 | bool optional, DeprecationState deprecationState = {}) 30 | : Argument(std::move(name), std::move(types), optional, 31 | std::move(deprecationState)) {} 32 | }; 33 | 34 | class PositionalArgument : public Argument { 35 | public: 36 | const bool varargs; 37 | 38 | PositionalArgument(std::string name, std::vector> types, 39 | bool optional, bool varargs) 40 | : Argument(std::move(name), std::move(types), optional), 41 | varargs(varargs) {} 42 | }; 43 | -------------------------------------------------------------------------------- /src/libobjects/deprecationstate.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "version.hpp" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | class DeprecationState { 10 | public: 11 | const std::optional sinceWhen; 12 | const std::vector replacements; 13 | const bool deprecated; 14 | 15 | DeprecationState() : deprecated(false) {} 16 | 17 | DeprecationState(const std::string &sinceWhen, 18 | const std::vector &replacements) 19 | : sinceWhen(sinceWhen), replacements(replacements), deprecated(true) {} 20 | 21 | DeprecationState(DeprecationState &&other) noexcept = default; 22 | DeprecationState &operator=(DeprecationState const &other) = delete; 23 | DeprecationState &operator=(DeprecationState &&other) noexcept = delete; 24 | 25 | ~DeprecationState() = default; 26 | }; 27 | 28 | void swap(DeprecationState &first, DeprecationState &second) noexcept; 29 | -------------------------------------------------------------------------------- /src/libobjects/function.cpp: -------------------------------------------------------------------------------- 1 | #include "function.hpp" 2 | 3 | #include 4 | 5 | const std::string &Function::id() const { return this->name; } 6 | 7 | const std::string &Method::id() const { return this->privateId; } 8 | -------------------------------------------------------------------------------- /src/libobjects/meson.build: -------------------------------------------------------------------------------- 1 | objects_inc = include_directories('.') 2 | objects_dep = [utils_dep] 3 | objects_lib = static_library( 4 | 'objects', 5 | 'function.cpp', 6 | include_directories: objects_inc, 7 | dependencies: objects_dep, 8 | ) 9 | objects_dep = declare_dependency( 10 | include_directories: objects_inc, 11 | link_with: [objects_lib], 12 | dependencies: objects_dep, 13 | ) 14 | -------------------------------------------------------------------------------- /src/libobjects/version.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "utils.hpp" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class Version { 10 | public: 11 | std::string versionString; 12 | 13 | explicit Version(std::string string) : versionString(std::move(string)) { 14 | this->parts = split(this->versionString, "."); 15 | } 16 | 17 | bool after(const Version &other) { 18 | for (unsigned long i = 0; 19 | i < std::min(other.parts.size(), this->parts.size()); i++) { 20 | const auto &thisPart = this->parts[i]; 21 | const auto &otherPart = other.parts[i]; 22 | if (thisPart > otherPart) { 23 | return true; 24 | } 25 | if (thisPart < otherPart) { 26 | return false; 27 | } 28 | } 29 | if (this->parts.size() > other.parts.size() && this->parts.back() == "0") { 30 | return false; 31 | } 32 | return this->parts.size() > other.parts.size(); 33 | } 34 | 35 | private: 36 | std::vector parts; 37 | }; 38 | -------------------------------------------------------------------------------- /src/libparsing/lexingtool.cpp: -------------------------------------------------------------------------------- 1 | #include "lexer.hpp" 2 | #include "log.hpp" 3 | #include "polyfill.hpp" 4 | #include "utils.hpp" 5 | 6 | const static Logger LOG("lexingtool") /*NOLINT*/; 7 | 8 | int main(int /*argc*/, char **argv) { 9 | auto contents = readFile(argv[1]); 10 | for (size_t i = 0; i < contents.size(); i++) { 11 | auto lexer = Lexer(contents.substr(0, i)); 12 | auto result = lexer.tokenize(); 13 | LOG.info(std::format("At iteration {}: {} {} tokens, {} errors", i, result, 14 | lexer.tokens.size(), lexer.errors.size())); 15 | } 16 | for (size_t i = 0; i < contents.size(); i++) { 17 | auto lexer = Lexer(contents.substr(i)); 18 | auto result = lexer.tokenize(); 19 | LOG.info(std::format("At iteration {}: {} {} tokens, {} errors", i, result, 20 | lexer.tokens.size(), lexer.errors.size())); 21 | } 22 | for (auto i = 0; i < 100; i++) { 23 | auto lexer = Lexer(contents); 24 | auto result = lexer.tokenize(); 25 | LOG.info(std::format("Lexing result: {}, {} tokens, {} errors", result, 26 | lexer.tokens.size(), lexer.errors.size())); 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /src/libparsing/meson.build: -------------------------------------------------------------------------------- 1 | parsing_inc = include_directories('.') 2 | parsing_dep = [ast_dep, utils_dep] 3 | parsing_lib = static_library( 4 | 'parsing', 5 | 'lexer.cpp', 6 | 'parser.cpp', 7 | include_directories: parsing_inc, 8 | dependencies: parsing_dep, 9 | ) 10 | parsing_dep = declare_dependency( 11 | include_directories: parsing_inc, 12 | link_with: [parsing_lib], 13 | dependencies: parsing_dep, 14 | ) 15 | 16 | executable( 17 | 'lexingtool', 18 | 'lexingtool.cpp', 19 | dependencies: [parsing_dep] + extra_deps + extra_libs, 20 | ) 21 | 22 | executable( 23 | 'lexerstats', 24 | 'lexerstats.cpp', 25 | dependencies: [parsing_dep] + extra_deps + extra_libs, 26 | ) 27 | 28 | executable( 29 | 'parserstats', 30 | 'parserstats.cpp', 31 | dependencies: [parsing_dep] + extra_deps + extra_libs, 32 | ) 33 | 34 | executable( 35 | 'parsingtool', 36 | 'parsingtool.cpp', 37 | dependencies: [parsing_dep] + extra_deps + extra_libs, 38 | ) 39 | 40 | executable( 41 | 'parserbench', 42 | 'parserbench.cpp', 43 | dependencies: [parsing_dep] + extra_deps + extra_libs, 44 | ) 45 | -------------------------------------------------------------------------------- /src/libparsing/parserbench.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "lexer.hpp" 4 | #include "parser.hpp" 5 | #include "sourcefile.hpp" 6 | #include "utils.hpp" 7 | 8 | int main(int argc, char **argv) { 9 | auto contents = readFile(argv[1]); 10 | auto sourceFile = std::make_shared(contents, argv[1]); 11 | for (size_t i = 0; i < 100000; i++) { 12 | Lexer lexer(contents); 13 | lexer.tokenize(); 14 | Parser parser(lexer, sourceFile); 15 | parser.parse(lexer.errors); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/libparsing/parsingtool.cpp: -------------------------------------------------------------------------------- 1 | #include "lexer.hpp" 2 | #include "log.hpp" 3 | #include "parser.hpp" 4 | #include "polyfill.hpp" 5 | #include "sourcefile.hpp" 6 | #include "utils.hpp" 7 | 8 | #include 9 | 10 | const static Logger LOG("parsingtool") /*NOLINT*/; 11 | 12 | int main(int /*argc*/, char **argv) { 13 | auto contents = readFile(argv[1]); 14 | auto sourceFile = std::make_shared(contents, argv[1]); 15 | for (size_t i = 0; i < contents.size(); i++) { 16 | LOG.info(std::format("Iteration ({}/{})", i, contents.size())); 17 | auto lexer = Lexer(contents.substr(0, i)); 18 | lexer.tokenize(); 19 | auto parser = Parser(lexer, sourceFile); 20 | parser.parse(lexer.errors); 21 | } 22 | for (size_t i = 0; i < contents.size(); i++) { 23 | LOG.info(std::format("Iteration ({}/{})", i, contents.size())); 24 | auto lexer = Lexer(contents.substr(i)); 25 | lexer.tokenize(); 26 | auto parser = Parser(lexer, sourceFile); 27 | parser.parse(lexer.errors); 28 | } 29 | auto lexer = Lexer(contents); 30 | lexer.tokenize(); 31 | LOG.info(std::format("Finished lexing: {} errors", lexer.errors.size())); 32 | for (const auto &errors : lexer.errors) { 33 | LOG.error(std::format("[{}:{}]: {}", errors.line + 1, errors.column, 34 | errors.message)); 35 | } 36 | auto parser = Parser(lexer, sourceFile); 37 | parser.parse(lexer.errors); 38 | LOG.info(std::format("Finished parsing: {} errors", parser.errors.size())); 39 | for (const auto &errors : parser.errors) { 40 | LOG.error(std::format("[{}:{}]: {}", errors.line + 1, errors.column, 41 | errors.message)); 42 | } 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /src/libtypenamespace/deprecations.csv: -------------------------------------------------------------------------------- 1 | meson::build_root,0.56.0,meson.current_build_dir()|meson.project_build_root()|meson.global_build_root() 2 | meson::source_root,0.56.0,meson.current_source_dir()|meson.project_source_root()|meson.global_source_root() 3 | meson::get_cross_property,0.58.0,meson.get_external_property() 4 | meson::has_exe_wrapper,0.55.0,meson.can_run_host_binaries() 5 | @gui_app,0.56.0,@win_subsystem 6 | @rust_crate_type,1.3.0,@rust_abi 7 | @build_always,0.47.0,@build_always_stale|@build_by_default 8 | build_tgt::path,0.59.0,build_tgt.full_path() 9 | dep::get_configtool_variable,0.56.0,dep.get_variable() 10 | dep::get_pkgconfig_variable,0.56.0,dep.get_variable() 11 | external_program::path,0.55.0,external_program.full_path() 12 | @languages,0.43.0, 13 | java_module::generate_native_header,0.62.0,java_module.generate_native_headers() 14 | java_module::generate_native_headers,1.0.0,java_module.native_headers() 15 | python3_module::find_python,0.48.0,python_module.find_installation() 16 | python3_module::extension_module,0.48.0,python_installation.extension_module() 17 | python3_module::language_version,0.48.0,python_installation.language_version() 18 | python3_module::sysconfig_path,0.40.0,python_installation.get_path() 19 | -------------------------------------------------------------------------------- /src/libtypenamespace/genobjectdocs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | from shared import parse_ascii_file 5 | 6 | 7 | def main(): 8 | with open(sys.argv[2], "w", encoding="utf-8") as output: 9 | print('#include "typenamespace.hpp"', file=output) 10 | print("void TypeNamespace::initObjectDocs() {", file=output) 11 | data_dict = parse_ascii_file(sys.argv[1]) 12 | for key, doc in data_dict.items(): 13 | escaped = doc.encode("unicode-escape").decode("utf-8").replace('"', '\\"') 14 | print(f' this->objectDocs["{key}"] = "{escaped}";', file=output) 15 | print("}", file=output) 16 | 17 | 18 | if __name__ == "__main__": 19 | main() 20 | -------------------------------------------------------------------------------- /src/libtypenamespace/meson.build: -------------------------------------------------------------------------------- 1 | typenamespace_inc = include_directories('.') 2 | typenamespace_deps = [objects_dep] 3 | 4 | genfunctions_cpp = configure_file( 5 | command: [ 6 | files('genfunctions.py'), 7 | '@INPUT0@', 8 | '@OUTPUT0@', 9 | '@INPUT1@', 10 | '@INPUT2@', 11 | '@INPUT3@', 12 | ], 13 | input: [ 14 | 'functions.def', 15 | 'functiondocs.def', 16 | 'deprecations.csv', 17 | 'addedData.csv', 18 | ], 19 | output: 'genfunctions.cpp', 20 | ) 21 | genmethods_cpp = configure_file( 22 | command: [ 23 | files('genmethods.py'), 24 | '@INPUT0@', 25 | '@OUTPUT0@', 26 | '@INPUT1@', 27 | '@INPUT2@', 28 | '@INPUT3@', 29 | ], 30 | input: [ 31 | 'methods.def', 32 | 'methoddocs.def', 33 | 'deprecations.csv', 34 | 'addedData.csv', 35 | ], 36 | output: 'genmethods.cpp', 37 | ) 38 | genobjectdocs_cpp = configure_file( 39 | command: [files('genobjectdocs.py'), '@INPUT0@', '@OUTPUT0@'], 40 | input: ['objectdocs.def'], 41 | output: 'genobjectdocs.cpp', 42 | ) 43 | 44 | generated_lib = static_library( 45 | 'generated_lib', 46 | genfunctions_cpp, 47 | genmethods_cpp, 48 | genobjectdocs_cpp, 49 | include_directories: typenamespace_inc, 50 | dependencies: typenamespace_deps, 51 | cpp_args: cxx.get_id() == 'clang' ? [] : ['-fno-var-tracking-assignments'], 52 | ) 53 | 54 | typenamespace_lib = static_library( 55 | 'typenamespace', 56 | 'typenamespace.cpp', 57 | include_directories: typenamespace_inc, 58 | dependencies: typenamespace_deps, 59 | ) 60 | typenamespace_dep = declare_dependency( 61 | dependencies: typenamespace_deps, 62 | include_directories: typenamespace_inc, 63 | link_with: [typenamespace_lib, generated_lib], 64 | ) 65 | -------------------------------------------------------------------------------- /src/libtypenamespace/shared.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | 4 | def parse_ascii_file(file_path): 5 | data_dict = {} 6 | current_section = None 7 | 8 | with open(file_path, "r", encoding="utf-8") as file: 9 | for line in file: 10 | line = line.strip() 11 | 12 | if line.startswith("@"): 13 | # Removing '@' at the beginning and ':' at the end 14 | section_name = line[1:-1] 15 | data_dict[section_name] = "" 16 | current_section = section_name 17 | elif current_section is not None: 18 | data_dict[current_section] += line + "\n" 19 | for section, content in data_dict.items(): 20 | data_dict[section] = content.rstrip("\n") 21 | 22 | return data_dict 23 | 24 | 25 | def extract_types(input_str): 26 | input_str = input_str[5:][:-1] 27 | paren_cnter = 0 28 | s = "" 29 | ret = [] 30 | for ch in input_str: 31 | if ch == "(": 32 | paren_cnter += 1 33 | if ch == ")": 34 | paren_cnter -= 1 35 | if paren_cnter == 0 and ch == "|": 36 | ret.append(s) 37 | s = "" 38 | else: 39 | s += ch 40 | assert paren_cnter == 0 41 | if s != "": 42 | ret.append(s) 43 | return ret 44 | 45 | 46 | def type_to_cpp(t: str): 47 | if t == "subproject()": 48 | return 'this->types.at("subproject")' 49 | if t.startswith("dict(") or t.startswith("list("): 50 | cpp_type = "Dict" if t.startswith("dict(") else "List" 51 | sub_types = list(map(type_to_cpp, extract_types(t))) 52 | if len(sub_types) == 0: 53 | return f"std::make_shared<{cpp_type}>()" 54 | total_str = "{" + ",".join(sub_types) + "}" 55 | return f"std::make_shared<{cpp_type}>(std::vector>{total_str})" 56 | return f'this->types.at("{t}")' 57 | 58 | 59 | def fetch_deprecation_data(file_pointer): 60 | parsed_dict = {} 61 | csv_reader = csv.reader(file_pointer) 62 | for row in csv_reader: 63 | key = row[0] 64 | data = (row[1], row[2].split("|")) 65 | parsed_dict[key] = data 66 | return parsed_dict 67 | 68 | 69 | def fetch_since_data(file_pointer): 70 | parsed_dict = {} 71 | csv_reader = csv.reader(file_pointer) 72 | for row in csv_reader: 73 | parsed_dict[row[0]] = row[1] 74 | return parsed_dict 75 | -------------------------------------------------------------------------------- /src/libtypenamespace/typenamespace.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "function.hpp" 4 | #include "type.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class TypeNamespace { 13 | public: 14 | std::map> functions; 15 | std::map> types; 16 | std::map>> vtables; 17 | std::map objectDocs; 18 | std::shared_ptr strType = std::make_shared(); 19 | std::shared_ptr intType = std::make_shared(); 20 | std::shared_ptr boolType = std::make_shared(); 21 | 22 | TypeNamespace(); 23 | 24 | [[nodiscard]] std::optional> 25 | lookupFunction(const std::string &name) const { 26 | auto iter = this->functions.find(name); 27 | if (iter != this->functions.end()) [[likely]] { 28 | return iter->second; 29 | } 30 | return std::nullopt; 31 | } 32 | 33 | [[nodiscard]] std::optional> 34 | lookupMethod(const std::string &name, 35 | const std::shared_ptr &type) const { 36 | auto iter = this->vtables.find(type->name); 37 | if (iter != this->vtables.end()) { 38 | for (const auto &method : iter->second) { 39 | if (method->name == name) { 40 | return method; 41 | } 42 | } 43 | } 44 | auto *abstractObject = dynamic_cast(type.get()); 45 | if (abstractObject && abstractObject->parent) { 46 | return this->lookupMethod(name, abstractObject->parent.value()); 47 | } 48 | return std::nullopt; 49 | } 50 | 51 | [[nodiscard]] std::optional> 52 | lookupMethod(const std::string &name) const { 53 | for (const auto &[_, methods] : this->vtables) { 54 | for (const auto &method : methods) { 55 | if (method->name == name) { 56 | return method; 57 | } 58 | } 59 | } 60 | return std::nullopt; 61 | } 62 | 63 | private: 64 | void initFunctions(); 65 | void initMethods(); 66 | void initObjectDocs(); 67 | }; 68 | -------------------------------------------------------------------------------- /src/libutils/meson.build: -------------------------------------------------------------------------------- 1 | utils_inc = include_directories('.') 2 | utils_deps = [log_dep, archive_dep, curl_dep, sha256_dep, polyfill_dep] 3 | utils_lib = static_library( 4 | 'utils', 5 | 'utils.cpp', 6 | include_directories: utils_inc, 7 | dependencies: utils_deps, 8 | ) 9 | utils_dep = declare_dependency( 10 | dependencies: utils_deps, 11 | include_directories: [utils_inc], 12 | link_with: [utils_lib], 13 | ) 14 | -------------------------------------------------------------------------------- /src/libwrap/hgwrap.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | #include "polyfill.hpp" 3 | #include "utils.hpp" 4 | #include "wrap.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | const static Logger LOG("wrap::HgWrap"); // NOLINT 12 | 13 | bool HgWrap::setupDirectory(const std::filesystem::path &path, 14 | const std::filesystem::path &packageFilesPath) { 15 | auto url = this->url; 16 | if (url.empty()) { 17 | this->errors.emplace_back("Missing URL"); 18 | LOG.warn("URL is empty"); 19 | return false; 20 | } 21 | if (this->revision.empty()) { 22 | this->errors.emplace_back("Missing revision"); 23 | LOG.warn("Revision is empty"); 24 | return false; 25 | } 26 | std::string rev = this->revision; 27 | if (this->directory->empty()) { 28 | this->errors.emplace_back("Missing directory"); 29 | LOG.warn("Directory is empty"); 30 | return false; 31 | } 32 | auto targetDirectory = this->directory.value(); 33 | std::string const fullPath = 34 | std::format("{}/{}", path.generic_string(), targetDirectory); 35 | auto result = 36 | launchProcess("hg", std::vector{"clone", url, fullPath}); 37 | if (result) { 38 | auto isTip = rev.size() == 3 && 39 | (std::tolower(rev[0]) == 't' && std::tolower(rev[1]) == 'i' && 40 | std::tolower(rev[2]) == 'p'); 41 | if (isTip) { 42 | result = launchProcess( 43 | "hg", std::vector{"--cwd", fullPath, "checkout", rev}); 44 | if (!result) { 45 | this->errors.emplace_back("Failed to do hg checkout"); 46 | return false; 47 | } 48 | } 49 | return this->postSetup(fullPath, packageFilesPath); 50 | } 51 | this->errors.emplace_back("Failed to do hg clone"); 52 | return false; 53 | } 54 | -------------------------------------------------------------------------------- /src/libwrap/meson.build: -------------------------------------------------------------------------------- 1 | wrap_inc = include_directories('.') 2 | wrap_deps = [ 3 | tree_sitter_dep, 4 | tree_sitter_ini_dep, 5 | ast_dep, 6 | archive_dep, 7 | curl_dep, 8 | utils_dep, 9 | ] 10 | wrap_lib = static_library( 11 | 'wrap', 12 | 'filewrap.cpp', 13 | 'gitwrap.cpp', 14 | 'hgwrap.cpp', 15 | 'svnwrap.cpp', 16 | 'vcswrap.cpp', 17 | 'wrap.cpp', 18 | include_directories: wrap_inc, 19 | dependencies: wrap_deps, 20 | ) 21 | wrap_dep = declare_dependency( 22 | dependencies: wrap_deps, 23 | include_directories: wrap_inc, 24 | link_with: [wrap_lib], 25 | ) 26 | -------------------------------------------------------------------------------- /src/libwrap/svnwrap.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | #include "polyfill.hpp" 3 | #include "utils.hpp" 4 | #include "wrap.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | const static Logger LOG("wrap::SvnWrap"); // NOLINT 11 | 12 | bool SvnWrap::setupDirectory(const std::filesystem::path &path, 13 | const std::filesystem::path &packageFilesPath) { 14 | auto url = this->url; 15 | if (url.empty()) { 16 | LOG.warn("URL is empty"); 17 | this->errors.emplace_back("Missing URL"); 18 | return false; 19 | } 20 | auto rev = this->revision.empty() ? "HEAD" : this->revision; 21 | if (this->directory->empty()) { 22 | LOG.warn("Directory is empty"); 23 | this->errors.emplace_back("Missing directory"); 24 | return false; 25 | } 26 | auto targetDirectory = this->directory.value(); 27 | std::string const fullPath = 28 | std::format("{}/{}", path.generic_string(), targetDirectory); 29 | auto result = launchProcess( 30 | "svn", std::vector{"checkout", "--non-interactive", 31 | "--trust-server-cert-failures=unknown-ca," 32 | "cn-mismatch,expired,not-yet-valid,other", 33 | "-r", rev, url, fullPath}); 34 | if (!result) { 35 | this->errors.emplace_back("Failed to do svn checkout"); 36 | return false; 37 | } 38 | return this->postSetup(fullPath, packageFilesPath); 39 | } 40 | -------------------------------------------------------------------------------- /src/libwrap/vcswrap.cpp: -------------------------------------------------------------------------------- 1 | #include "ini.hpp" 2 | #include "wrap.hpp" 3 | 4 | VcsWrap::VcsWrap(ast::ini::Section *section) : Wrap(section) { 5 | if (auto optUrl = section->findStringValue("url")) { 6 | this->url = optUrl.value(); 7 | } 8 | if (auto optRevision = section->findStringValue("revision")) { 9 | this->revision = optRevision.value(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/lint/linter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lintingconfig.hpp" 3 | #include "mesontree.hpp" 4 | #include "typenamespace.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class Linter { 11 | MesonLintConfig config; 12 | std::filesystem::path root; 13 | MesonTree tree; 14 | TypeNamespace ns; 15 | std::filesystem::path muonConfigFile; 16 | std::map unformattedFiles; 17 | 18 | public: 19 | Linter(MesonLintConfig cfg, std::filesystem::path root) 20 | : config(std::move(cfg)), root(std::move(root)), 21 | tree(this->root, this->ns) {} 22 | 23 | bool lint() { 24 | const auto passedCodeLinting = this->lintCode(); 25 | const auto passedFormattingLinting = this->lintFormatting(); 26 | if (passedCodeLinting && passedFormattingLinting) { 27 | std::cout << "Your project passes all tests ✨ 🍰 ✨" << std::endl; 28 | return true; 29 | } 30 | this->printDiagnostics(); 31 | return false; 32 | } 33 | 34 | void fix(); 35 | 36 | private: 37 | bool lintCode(); 38 | bool lintFormatting(); 39 | void lintFormattingTracked(); 40 | void lintFormatting(const std::filesystem::path &path); 41 | void writeMuonConfigFile(); 42 | void printDiagnostics() const; 43 | }; 44 | -------------------------------------------------------------------------------- /src/lint/lintingconfig.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "analysisoptions.hpp" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | enum class FileFinderMode { TRACKED, ALL }; 9 | 10 | struct MuonConfig { 11 | FileFinderMode mode = FileFinderMode::TRACKED; 12 | int max_line_len = 80; 13 | std::optional indent_by; 14 | bool space_array = false; 15 | bool kwargs_force_multiline = false; 16 | bool wide_colon = false; 17 | bool no_single_comma_function = false; 18 | std::string indent_style = "space"; 19 | int indent_size = 4; 20 | bool insert_final_newline = true; 21 | bool sort_files = true; 22 | bool group_arg_value = true; 23 | bool simplify_string_literals = false; 24 | std::string indent_before_comments = " "; 25 | std::optional end_of_line = std::nullopt; 26 | }; 27 | 28 | struct LintingConfig { 29 | bool werror = false; 30 | AnalysisOptions options; 31 | }; 32 | 33 | struct MesonLintConfig { 34 | MuonConfig formatting; 35 | LintingConfig linting; 36 | 37 | void load(const std::filesystem::path &path); 38 | }; 39 | -------------------------------------------------------------------------------- /src/lint/meson.build: -------------------------------------------------------------------------------- 1 | tomlplusplus_dep = dependency( 2 | 'tomlplusplus', 3 | default_options: ['compile_library=false', 'build_lib=false'], 4 | ) 5 | executable( 6 | 'mesonlint', 7 | 'main.cpp', 8 | 'lintingconfig.cpp', 9 | 'linter.cpp', 10 | version_h, 11 | link_args: extra_link_args, 12 | cpp_args: [ 13 | '-DVERSION="' + version + '"', 14 | '-DCC_VERSION="' + cc_version + '"', 15 | '-DCXX_VERSION="' + cxx_version + '"', 16 | '-DLINKER_ID="' + cc.get_linker_id() + '"', 17 | ] 18 | + args, 19 | dependencies: [ 20 | analyze_dep, 21 | ast_dep, 22 | log_dep, 23 | objects_dep, 24 | cxathrow_dep, 25 | tomlplusplus_dep, 26 | langserver_dep, 27 | muon_dep, 28 | ] 29 | + extra_deps 30 | + extra_libs, 31 | install: true, 32 | pie: host_machine.system() == 'linux', 33 | ) 34 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | subdir('polyfill') 2 | subdir('liblog') 3 | subdir('libcxathrow') 4 | subdir('libutils') 5 | subdir('libobjects') 6 | subdir('libast') 7 | subdir('libparsing') 8 | subdir('libtypenamespace') 9 | subdir('libwrap') 10 | subdir('libanalyze') 11 | subdir('libjsonrpc') 12 | subdir('liblsptypes') 13 | subdir('libls') 14 | subdir('liblangserver') 15 | 16 | version = meson.project_version() 17 | 18 | cxx_version = cxx.get_id() + ' ' + cxx.version() 19 | cc_version = cc.get_id() + ' ' + cc.version() 20 | assert(cc.get_linker_id() == cxx.get_linker_id()) 21 | 22 | source_root = meson.project_source_root() 23 | version_h = vcs_tag( 24 | command: [ 25 | 'git', 26 | '--git-dir=' + join_paths(source_root, '.git'), 27 | '--work-tree=' + source_root, 28 | 'describe', 29 | '--always', 30 | '--tags', 31 | '--dirty', 32 | ], 33 | input: 'vcs_version.h.in', 34 | output: 'vcs_version.h', 35 | replace_string: '@VCS_VERSION@', 36 | ) 37 | 38 | mesonlsp = executable( 39 | 'mesonlsp', 40 | 'main.cpp', 41 | version_h, 42 | link_args: extra_link_args, 43 | cpp_args: [ 44 | '-DVERSION="' + version + '"', 45 | '-DCC_VERSION="' + cc_version + '"', 46 | '-DCXX_VERSION="' + cxx_version + '"', 47 | '-DLINKER_ID="' + cc.get_linker_id() + '"', 48 | ] 49 | + args, 50 | dependencies: [ 51 | analyze_dep, 52 | ast_dep, 53 | jsonrpc_dep, 54 | log_dep, 55 | objects_dep, 56 | tree_sitter_dep, 57 | tree_sitter_meson_dep, 58 | wrap_dep, 59 | langserver_dep, 60 | cxathrow_dep, 61 | ] 62 | + extra_deps 63 | + extra_libs, 64 | install: true, 65 | pie: host_machine.system() == 'linux', 66 | ) 67 | 68 | install_dir = get_option('prefix') / get_option('bindir') 69 | install_symlink( 70 | 'Swift-MesonLSP', 71 | install_dir: install_dir, 72 | pointing_to: install_dir / (host_machine.system() == 'windows' ? 'mesonlsp.exe' : 'mesonlsp'), 73 | ) 74 | 75 | subdir('benchmarks') 76 | subdir('lint') 77 | -------------------------------------------------------------------------------- /src/polyfill/meson.build: -------------------------------------------------------------------------------- 1 | polyfill_inc = include_directories('.') 2 | polyfill_dep = declare_dependency( 3 | include_directories: polyfill_inc, 4 | dependencies: fmt_dep, 5 | ) 6 | -------------------------------------------------------------------------------- /src/polyfill/polyfill.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(__APPLE__) 4 | #include 5 | #include 6 | 7 | #ifdef __x86_64__ 8 | namespace std { 9 | using fmt::format; 10 | } 11 | 12 | template 13 | struct fmt::formatter> { 14 | // Presentation format: 'f' for full format 15 | constexpr auto parse(format_parse_context &ctx) { return ctx.begin(); } 16 | 17 | // Format the time point 18 | template 19 | auto format(const std::chrono::time_point &tp, 20 | FormatContext &ctx) const { 21 | return fmt::format_to(ctx.out(), "{}", tp.time_since_epoch().count()); 22 | } 23 | }; 24 | 25 | #endif 26 | #elif defined(_WIN32) 27 | #include 28 | #include 29 | #include 30 | 31 | template <> struct std::formatter { 32 | constexpr auto parse(format_parse_context &ctx) { return ctx.begin(); } 33 | 34 | template 35 | auto format(const wchar_t *str, FormatContext &ctx) { 36 | return std::format_to(ctx.out(), L"{}", str); 37 | } 38 | }; 39 | 40 | template <> 41 | struct std::formatter 42 | : std::formatter { 43 | template 44 | auto format(const wchar_t *value, FormatContext &ctx) const { 45 | std::wstring_convert> converter; 46 | return std::formatter::format(converter.to_bytes(value), 47 | ctx); 48 | } 49 | }; 50 | 51 | #else 52 | #include 53 | #endif 54 | -------------------------------------------------------------------------------- /src/vcs_version.h.in: -------------------------------------------------------------------------------- 1 | #define VCS_VERSION "@VCS_VERSION@" 2 | -------------------------------------------------------------------------------- /subprojects/.gitignore: -------------------------------------------------------------------------------- 1 | packagecache/ 2 | -------------------------------------------------------------------------------- /subprojects/ada.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/ada-url/ada 3 | revision = v2.7.4 4 | patch_directory = ada 5 | directory = ada 6 | -------------------------------------------------------------------------------- /subprojects/google-benchmark.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = benchmark-1.7.1 3 | source_url = https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz 4 | source_filename = benchmark-1.7.1.tar.gz 5 | source_hash = 6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7 6 | patch_filename = google-benchmark_1.7.1-2_patch.zip 7 | patch_url = https://wrapdb.mesonbuild.com/v2/google-benchmark_1.7.1-2/get_patch 8 | patch_hash = 169304b7095ed39f2a260c84fe3fe368124a5a9ab66e529f11c71c9907fc4085 9 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/google-benchmark_1.7.1-2/benchmark-1.7.1.tar.gz 10 | wrapdb_version = 1.7.1-2 11 | 12 | [provide] 13 | benchmark = google_benchmark_dep 14 | -------------------------------------------------------------------------------- /subprojects/gtest.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = googletest-1.14.0 3 | source_url = https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz 4 | source_filename = gtest-1.14.0.tar.gz 5 | source_hash = 8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7 6 | patch_filename = gtest_1.14.0-1_patch.zip 7 | patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-1/get_patch 8 | patch_hash = 2e693c7d3f9370a7aa6dac802bada0874d3198ad4cfdf75647b818f691182b50 9 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.14.0-1/gtest-1.14.0.tar.gz 10 | wrapdb_version = 1.14.0-1 11 | 12 | [provide] 13 | gtest = gtest_dep 14 | gtest_main = gtest_main_dep 15 | gmock = gmock_dep 16 | gmock_main = gmock_main_dep 17 | -------------------------------------------------------------------------------- /subprojects/mimalloc.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/mimalloc 3 | revision = HEAD 4 | -------------------------------------------------------------------------------- /subprojects/muon.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/muon 3 | revision = HEAD 4 | -------------------------------------------------------------------------------- /subprojects/nlohmann_json.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = nlohmann_json-3.11.2 3 | lead_directory_missing = true 4 | source_url = https://github.com/nlohmann/json/releases/download/v3.11.2/include.zip 5 | source_filename = nlohmann_json-3.11.2.zip 6 | source_hash = e5c7a9f49a16814be27e4ed0ee900ecd0092bfb7dbfca65b5a421b774dccaaed 7 | wrapdb_version = 3.11.2-1 8 | 9 | [provide] 10 | nlohmann_json = nlohmann_json_dep 11 | -------------------------------------------------------------------------------- /subprojects/packagefiles/ada/meson.build: -------------------------------------------------------------------------------- 1 | project('ada', 'cpp') 2 | 3 | ada_inc = include_directories('include') 4 | ada_lib = library('ada', 'src/ada.cpp', include_directories: ada_inc) 5 | ada_dep = declare_dependency(link_with: ada_lib, include_directories: ada_inc) 6 | -------------------------------------------------------------------------------- /subprojects/packagefiles/sha256/meson.build: -------------------------------------------------------------------------------- 1 | project('sha256', 'c') 2 | 3 | sha256_inc = include_directories('.') 4 | sha256_lib = library('sha256', 'sha-256.c', include_directories: sha256_inc) 5 | 6 | sha256_dep = declare_dependency( 7 | link_with: sha256_lib, 8 | include_directories: sha256_inc, 9 | ) 10 | -------------------------------------------------------------------------------- /subprojects/packagefiles/tree-sitter-0.20.8/meson.build: -------------------------------------------------------------------------------- 1 | project('tree-sitter', 'c') 2 | # Based on 3 | # https://github.com/rizinorg/rizin/blob/dev/subprojects/packagefiles/tree-sitter-0.20.7/meson.build 4 | tree_sitter_files = ['lib/src/lib.c'] 5 | tree_sitter_inc = [ 6 | include_directories('lib/src'), 7 | include_directories('lib/include'), 8 | ] 9 | 10 | libtree_sitter = static_library( 11 | 'tree_sitter', 12 | tree_sitter_files, 13 | include_directories: tree_sitter_inc, 14 | implicit_include_directories: false, 15 | install: not meson.is_subproject(), 16 | # Horrible hack, but that's how we can 17 | # avoid the overhead from atomics in this 18 | # case 19 | c_args: ['-D__TINYC__=1'], 20 | ) 21 | 22 | tree_sitter_dep = declare_dependency( 23 | link_with: libtree_sitter, 24 | include_directories: tree_sitter_inc, 25 | ) 26 | -------------------------------------------------------------------------------- /subprojects/packagefiles/tree-sitter-ini/meson.build: -------------------------------------------------------------------------------- 1 | project('tree-sitter-c', 'c', default_options: ['werror=false']) 2 | 3 | ts_ini_files = ['src/parser.c'] 4 | 5 | tree_sitter_dep = dependency('tree-sitter') 6 | 7 | libtsc = static_library( 8 | 'tree-sitter-ini', 9 | ts_ini_files, 10 | include_directories: ['src'], 11 | implicit_include_directories: false, 12 | dependencies: tree_sitter_dep.partial_dependency(includes: true), 13 | ) 14 | 15 | tree_sitter_ini_dep = declare_dependency( 16 | link_with: libtsc, 17 | include_directories: ['src/tree_sitter'], 18 | dependencies: tree_sitter_dep, 19 | ) 20 | meson.override_dependency('tree-sitter-ini', tree_sitter_ini_dep) 21 | -------------------------------------------------------------------------------- /subprojects/packagefiles/tree-sitter-meson/meson.build: -------------------------------------------------------------------------------- 1 | project('tree-sitter-c', 'c', default_options: ['werror=false']) 2 | 3 | ts_meson_files = ['src/parser.c'] 4 | 5 | tree_sitter_dep = dependency('tree-sitter') 6 | 7 | libtsc = static_library( 8 | 'tree-sitter-meson', 9 | ts_meson_files, 10 | include_directories: ['src'], 11 | implicit_include_directories: false, 12 | dependencies: tree_sitter_dep.partial_dependency(includes: true), 13 | ) 14 | 15 | tree_sitter_meson_dep = declare_dependency( 16 | link_with: libtsc, 17 | include_directories: ['src/tree_sitter'], 18 | dependencies: tree_sitter_dep, 19 | ) 20 | meson.override_dependency('tree-sitter-meson', tree_sitter_meson_dep) 21 | -------------------------------------------------------------------------------- /subprojects/pkgconf.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = pkgconf-2.1.1 3 | source_url = https://distfiles.ariadne.space/pkgconf/pkgconf-2.1.1.tar.xz 4 | source_filename = pkgconf-2.1.1.tar.xz 5 | source_hash = 3a224f2accf091b77a5781316e27b9ee3ba82c083cc2e539e08940b68a44fec5 6 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pkgconf_2.1.1-1/pkgconf-2.1.1.tar.xz 7 | wrapdb_version = 2.1.1-1 8 | 9 | [provide] 10 | libpkgconf = dep_libpkgconf 11 | -------------------------------------------------------------------------------- /subprojects/sha256.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/amosnier/sha-2 3 | revision = 49265c656f9b370da660531db8cc6bf0a2e110a6 4 | patch_directory = sha256 5 | directory = sha256 6 | -------------------------------------------------------------------------------- /subprojects/tomlplusplus.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = tomlplusplus-3.4.0 3 | source_url = https://github.com/marzer/tomlplusplus/archive/v3.4.0.tar.gz 4 | source_filename = tomlplusplus-3.4.0.tar.gz 5 | source_hash = 8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155 6 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/tomlplusplus_3.4.0-1/tomlplusplus-3.4.0.tar.gz 7 | wrapdb_version = 3.4.0-1 8 | 9 | [provide] 10 | dependency_names = tomlplusplus 11 | -------------------------------------------------------------------------------- /subprojects/tree-sitter-ini.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/tree-sitter-ini 3 | revision = HEAD 4 | patch_directory = tree-sitter-ini 5 | directory = tree-sitter-ini 6 | -------------------------------------------------------------------------------- /subprojects/tree-sitter-meson.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/tree-sitter-meson 3 | revision = HEAD 4 | patch_directory = tree-sitter-meson 5 | directory = tree-sitter-meson 6 | -------------------------------------------------------------------------------- /subprojects/tree-sitter.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | source_url = https://github.com/tree-sitter/tree-sitter/archive/v0.20.8.tar.gz 3 | source_filename = v0.20.8.tar.gz 4 | source_hash = 6181ede0b7470bfca37e293e7d5dc1d16469b9485d13f13a605baec4a8b1f791 5 | patch_directory = tree-sitter-0.20.8 6 | directory = tree-sitter-0.20.8 7 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/dict+iter.meson: -------------------------------------------------------------------------------- 1 | other_dict = { 2 | 'abcabc': 'dict11111', 3 | 'bbcbbc': 'dict22222', 4 | } 5 | foreach a, b : other_dict 6 | set_variable(b, true) 7 | endforeach 8 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/dict+join_path.meson: -------------------------------------------------------------------------------- 1 | supported_arch = { 2 | 'x86': 'x86', 3 | 'x86_64': 'x86', 4 | } 5 | arch = host_machine.cpu() 6 | xyz = ('arch' / supported_arch[arch]) 7 | set_variable(xyz, true) 8 | set_variable('arch1' / supported_arch[arch], true) 9 | 10 | set_variable(join_paths('a', 'b'), 1) 11 | xyz = join_paths('a1', 'b') 12 | set_variable(xyz, 1) 13 | supported_arch1 = { 14 | 'x86': 'x861', 15 | 'x86_64': 'x861', 16 | } 17 | arch1 = host_machine.cpu() 18 | set_variable(join_paths('arch', supported_arch1[arch1]), true) 19 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/foreach.meson: -------------------------------------------------------------------------------- 1 | funcs = ['foo', 'bar', 'baz'] 2 | foreach x : funcs 3 | set_variable('have_' + x, true) 4 | endforeach 5 | foreach x : funcs 6 | set_variable(x + 'have_', true) 7 | endforeach 8 | types = ['int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t', 'uint32_t', 'int64_t', 'uint64_t'] 9 | underscore_types = ['__int8', '__int16', '__int32', '__int64'] 10 | foreach t : types + underscore_types 11 | set_variable('have_@0@'.format(t), true) 12 | endforeach 13 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/format.meson: -------------------------------------------------------------------------------- 1 | foreach x : ['2', '3'] 2 | set_variable('have_@0@'.format(x), true) 3 | endforeach 4 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/gdkpixbuf.meson: -------------------------------------------------------------------------------- 1 | gdkpixbuf_bin = [ 2 | ['gdk-pixbuf-csource'], 3 | ['gdk-pixbuf-pixdata'], 4 | ['gdk-pixbuf-query-loaders', ['queryloaders.c']], 5 | ] 6 | foreach bin : gdkpixbuf_bin 7 | bin_name = bin[0] 8 | set_variable(bin_name.underscorify(), true) 9 | endforeach 10 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/goa.meson: -------------------------------------------------------------------------------- 1 | monitors = {} 2 | if enable_afc 3 | monitors += {'Afc': true} 4 | endif 5 | if enable_goa 6 | monitors += {'Goa': false} 7 | endif 8 | if enable_gphoto2 9 | monitors += {'GPhoto2': true} 10 | endif 11 | monitors += {'MTP': false} 12 | foreach monitor, monitor_test : monitors 13 | monitor_name = monitor.to_lower() 14 | set_variable(monitor_name, true) 15 | endforeach 16 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/grilo.meson: -------------------------------------------------------------------------------- 1 | NAME1 = 0 2 | plugins = [ 3 | ['bookmarks', [gio_dep, libxml_dep, gom_dep], []], 4 | ['filesystem', [grilo_pls_dep], []], 5 | [ 6 | 'lua-factory', 7 | [lua_dep, libarchive_dep, grilo_net_dep, json_glib_dep, libxml_dep], 8 | [goa_dep, totem_plparser_mini_dep], 9 | ], 10 | [ 11 | 'youtube', 12 | [grilo_net_dep, libxml_dep, libgdata_dep, totem_plparser_dep], 13 | [], 14 | ], 15 | ] 16 | foreach p : plugins 17 | varname = p[NAME1].underscorify() 18 | varname_enabled = varname + '_enabled' 19 | varname_idx = varname + '_idx' 20 | set_variable(varname_enabled, true) 21 | set_variable(varname_idx, true) 22 | endforeach 23 | 24 | 25 | foreach p : plugins 26 | name = p[NAME1].underscorify() + '_enabled' 27 | set_variable(name + 'foo', get_variable(name).to_string('yes', 'no')) 28 | endforeach 29 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/harfbuzz.meson: -------------------------------------------------------------------------------- 1 | tests = [ 2 | 'hb-shape-fuzzer.cc', 3 | 'hb-subset-fuzzer.cc', 4 | 'hb-set-fuzzer.cc', 5 | 'hb-draw-fuzzer.cc', 6 | ] 7 | if get_option('experimental_api') 8 | tests += 'hb-repacker-fuzzer.cc' 9 | endif 10 | foreach file_name : tests 11 | test_name = file_name.split('.')[0] 12 | set_variable('@0@_exe'.format(test_name.underscorify()), true) 13 | endforeach 14 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/imgui-options.meson: -------------------------------------------------------------------------------- 1 | option( 2 | 'bindings', 3 | type: 'array', 4 | choices: ['cpp', 'human', 'python'], 5 | description: 'Generate language bindings', 6 | ) 7 | option( 8 | 'shims', 9 | type: 'array', 10 | choices: ['lua'], 11 | description: 'Generate backward compatibility shims', 12 | ) 13 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/imgui.meson: -------------------------------------------------------------------------------- 1 | bindings = get_option('bindings') 2 | binding_targets = { 3 | 'cpp': {'output': 'reaper_imgui_functions.h'}, 4 | 'human': { 5 | 'output': 'reaper_imgui_doc.html', 6 | 'install_dir': data_dir, 7 | }, 8 | 'python': { 9 | 'output': 'imgui_python.py', 10 | 'install_dir': scripts_dir, 11 | }, 12 | } 13 | foreach name : bindings 14 | set_variable(name + '_binding', true) 15 | endforeach 16 | foreach shim_name : get_option('shims') 17 | set_variable(shim_name + '___shim', true) 18 | endforeach 19 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/replace.meson: -------------------------------------------------------------------------------- 1 | # From Lix: https://git.lix.systems/lix-project/lix 2 | path_opts = [ 3 | # Meson built-ins. 4 | 'datadir', 5 | 'bindir', 6 | 'mandir', 7 | 'libdir', 8 | 'includedir', 9 | 'libexecdir', 10 | # Homecooked Lix directories. 11 | 'store-dir', 12 | 'state-dir', 13 | 'log-dir', 14 | 'profile-dir', 15 | ] 16 | # For your grepping pleasure, this loop sets the following variables that aren't mentioned 17 | # literally above: 18 | # store_dir 19 | # state_dir 20 | # log_dir 21 | # profile_dir 22 | foreach optname : path_opts 23 | varname = optname.replace('-', '_') 24 | path = get_option(optname) 25 | set_variable(varname, path) 26 | endforeach 27 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/underscorify.meson: -------------------------------------------------------------------------------- 1 | python_tools = [ 2 | 'glib-genmarshal', 3 | 'glib-mkenums', 4 | ] 5 | foreach tool : python_tools 6 | set_variable(tool.underscorify(), true) 7 | endforeach 8 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/vpx2.meson: -------------------------------------------------------------------------------- 1 | vpx2_features = [ 2 | [ 3 | 'vpx/vp6cx.h', 4 | 'vpx_codec_vp6_cx_algo', 5 | '-DHAVE_VP6_ENCODER', 6 | 'VP6 encoder', 7 | ], 8 | [ 9 | 'vpx/vp6dx.h', 10 | 'vpx_codec_vp6_dx_algo', 11 | '-DHAVE_VP8_DECODER', 12 | 'VP6 decoder', 13 | ], 14 | [ 15 | 'vpx/vp7cx.h', 16 | 'vpx_codec_vp7_cx_algo', 17 | '-DHAVE_VP7_ENCODER', 18 | 'VP7 encoder', 19 | ], 20 | [ 21 | 'vpx/vp7dx.h', 22 | 'vpx_codec_vp7_dx_algo', 23 | '-DHAVE_VP7_DECODER', 24 | 'VP7 decoder', 25 | ], 26 | ] 27 | foreach f : vpx2_features 28 | set_variable('have_' + f[3].to_lower().underscorify(), true) 29 | endforeach 30 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/vpx8.meson: -------------------------------------------------------------------------------- 1 | vpx_features = [ 2 | [ 3 | 'vpx/vp8cx.h', 4 | 'vpx_codec_vp8_cx_algo', 5 | '-DHAVE_VP8_ENCODER', 6 | 'VP8 encoder', 7 | ], 8 | [ 9 | 'vpx/vp8dx.h', 10 | 'vpx_codec_vp8_dx_algo', 11 | '-DHAVE_VP8_DECODER', 12 | 'VP8 decoder', 13 | ], 14 | [ 15 | 'vpx/vp8cx.h', 16 | 'vpx_codec_vp9_cx_algo', 17 | '-DHAVE_VP9_ENCODER', 18 | 'VP9 encoder', 19 | ], 20 | [ 21 | 'vpx/vp8dx.h', 22 | 'vpx_codec_vp9_dx_algo', 23 | '-DHAVE_VP9_DECODER', 24 | 'VP9 decoder', 25 | ], 26 | ] 27 | foreach f : vpx_features 28 | set_variable('have_' + f.get(3).to_lower().underscorify(), true) 29 | endforeach 30 | -------------------------------------------------------------------------------- /tests/integration/partial-interpreter-test/wayland.meson: -------------------------------------------------------------------------------- 1 | generated_headers = [ 2 | { 3 | 'scanner_args': ['server-header'], 4 | 'output': 'wayland-server-protocol.h', 5 | 'install': true, 6 | }, 7 | { 8 | 'scanner_args': ['server-header', '-c'], 9 | 'output': 'wayland-server-protocol-core.h', 10 | 'install': false, 11 | }, 12 | { 13 | 'scanner_args': ['client-header'], 14 | 'output': 'wayland-client-protocol.h', 15 | 'install': true, 16 | }, 17 | { 18 | 'scanner_args': ['client-header', '-c'], 19 | 'output': 'wayland-client-protocol-core.h', 20 | 'install': false, 21 | }, 22 | ] 23 | foreach gen : generated_headers 24 | output_file = gen.get('output') 25 | target_name = output_file.underscorify() 26 | set_variable(target_name, true) 27 | endforeach 28 | -------------------------------------------------------------------------------- /tests/integration/subproj/meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'mesonlsp-subproj', 3 | 'cpp', 4 | subproject_dir: 'vendor' 5 | ) 6 | 7 | subdir('test') 8 | -------------------------------------------------------------------------------- /tests/integration/subproj/test/add_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Demonstrate some basic assertions. 4 | TEST_CASE("AddTest", "BasicAssertions") { REQUIRE(6 + 7 == 13); } 5 | -------------------------------------------------------------------------------- /tests/integration/subproj/test/meson.build: -------------------------------------------------------------------------------- 1 | catch2_proj = subproject('catch2') 2 | catch2_with_main_dep = catch2_proj.get_variable('catch2_with_main_dep') 3 | 4 | executable( 5 | 'tests', 6 | 'add_test.cpp', 7 | dependencies: [catch2_with_main_dep], 8 | ) 9 | -------------------------------------------------------------------------------- /tests/integration/subproj/vendor/catch2.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/catchorg/Catch2 3 | revision = v3.6.0 4 | depth = 1 5 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/assignment.meson: -------------------------------------------------------------------------------- 1 | someint = 1 2 | someint += 2 3 | somestr = '' 4 | somestr += '1' 5 | somelist = [1] 6 | somelist += '' 7 | somelist2 = [1,2,3] 8 | somelist2 += ['a', true] 9 | someint2 = 6 10 | someint2 /= 2 11 | somestr2 = '' 12 | somestr2 /= '55' 13 | someint %= 2 14 | someint -= 3 15 | someint *= -5 16 | somebool = not true 17 | somebool2 = !true 18 | someunaryint = -5 19 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/basictests.meson: -------------------------------------------------------------------------------- 1 | conditional = true ? 1 : '' 2 | someint = 1 3 | somestr = '' 4 | somebool = true 5 | someemptydict = {} 6 | somedict = {'foo': 1, 'bar': ''} 7 | someemptyarray = [] 8 | somearray = [1, ''] 9 | 10 | foreach mixedbagiter : [[], {}, 1, '', bool, meson] 11 | 12 | endforeach 13 | 14 | foreach dictkey, dictvalue : {'foo': [[], {}, 1, '', bool, meson], 'bar': 1} 15 | 16 | endforeach 17 | 18 | firstmixedbagiter = [[], {}, 1, '', bool, meson][0] 19 | somedictvalue = somedict['foo'] 20 | somesubstr = somestr[0] 21 | custom_idx = custom_target()[0] 22 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/binaryexpression.meson: -------------------------------------------------------------------------------- 1 | bool_and = true and (1 == 2) 2 | bool_or = true or (1 != 2) 3 | int_div = 4 / 2 4 | str_div = 'foo' / 'bar' 5 | int_eq = 1 == 1 6 | object_eq = meson == meson 7 | list_neq = [] != [] 8 | int_ge = 4 >= 2 9 | int_gt = 4 > 2 10 | int_le = 4 <= 2 11 | int_lt = 4 < 2 12 | in_check = 'foo' in [] 13 | not_in_check = 'foo' not in [] 14 | int_minus = 4 - 4 15 | int_mod = 4 % 4 16 | int_mul = 4 * 4 17 | str_plus = 'f' + 'o' 18 | int_plus = 1 + 2 19 | list_list_plus = ['f'] + [1, ['foo']] 20 | list_other_plus = ['f'] + 1 21 | dict_dict_plus = {'a': 1} + {'a': meson, 'b': build_machine} 22 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/build_target.meson: -------------------------------------------------------------------------------- 1 | executable = build_target('executable', target_type: 'executable') 2 | shared_library = build_target('shared_library', target_type: 'shared_library') 3 | static_library = build_target('static_library', target_type: 'static_library') 4 | library = build_target('library', target_type: 'library') 5 | shared_module = build_target('shared_module', target_type: 'shared_module') 6 | both_libraries = build_target('both_libraries', target_type: 'both_libraries') 7 | jar = build_target('jar', target_type: 'jar') 8 | conditional = build_target('conditional', target_type: true ? 'jar' : 'library') 9 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/get_method_improved.meson: -------------------------------------------------------------------------------- 1 | somelist = [[1,2,3], {'a': 1, 'b': 2, 'c': true}, false] 2 | somelist_sub_no_default = somelist.get(0) 3 | somelist_sub = somelist.get(0, []) 4 | somelist_sub2 = somelist.get(1, {}) 5 | somedict = {'a': 1, 'b': true, 'c': [1,2,3], 'd': {'a': 1}} 6 | somedict_sub_no_default = somedict.get('c') 7 | somedict_sub = somedict.get('c', []) 8 | somedict_sub2 = somedict.get('d', {}) 9 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/options.meson: -------------------------------------------------------------------------------- 1 | strvalue = get_option('stroption') 2 | boolvalue = get_option('booloption') 3 | combovalue = get_option('combooption') 4 | intvalue = get_option('intoption') 5 | arrayvalue = get_option('arrayoption') 6 | featurevalue = get_option('featureoption') 7 | int_and_strvalue = get_option(true ? 'stroption' : 'intoption') 8 | unknownvalue = get_option('never-seen-before') 9 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/options_options.meson: -------------------------------------------------------------------------------- 1 | option('stroption', type: 'string') 2 | option('booloption', type: 'boolean') 3 | option('combooption', type: 'combo', choices: ['one', 'two', 'three']) 4 | option('intoption', type: 'integer') 5 | option('arrayoption', type: 'array', choices: ['one', 'two', 'three']) 6 | option('featureoption', type: 'feature') 7 | -------------------------------------------------------------------------------- /tests/integration/type-analyzer-test/selectionstatement.meson: -------------------------------------------------------------------------------- 1 | full = meson 2 | 3 | if true 4 | full = true 5 | if false 6 | full = host_machine 7 | else 8 | if 1 == 1 9 | full = target_machine 10 | else 11 | full = {} 12 | endif 13 | endif 14 | else 15 | full = [] 16 | if 1 == 1 17 | full = {'a': 1} 18 | endif 19 | endif 20 | -------------------------------------------------------------------------------- /tests/integration/workspace-test/meson.build: -------------------------------------------------------------------------------- 1 | project('workspace-test', meson_version: '>=0.21.0') 2 | 3 | message(meson.project_build_root()) 4 | 5 | x = [] 6 | 7 | 8 | x += [1, 2, 3] 9 | 10 | message(x.length()) 11 | message(get_option('testopt')) 12 | subdir('subdir') 13 | 14 | meson_version = meson.version() 15 | message(meson_version) 16 | -------------------------------------------------------------------------------- /tests/integration/workspace-test/meson.options: -------------------------------------------------------------------------------- 1 | option('testopt', type: 'integer') 2 | -------------------------------------------------------------------------------- /tests/integration/workspace-test/subdir/meson.build: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JCWasmx86/mesonlsp/e3bb20acd1ba8bab8772f43a77efa1b1c5e81a27/tests/integration/workspace-test/subdir/meson.build -------------------------------------------------------------------------------- /tests/integration/wrap-test/libswiftdemangle.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/libswiftdemangle 3 | revision = e96565e27f95865830626f5d8a081b69cfe5ea11 4 | depth = 1 5 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/libswiftdemangle2.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = libswiftdemangle2 3 | url = https://github.com/JCWasmx86/libswiftdemangle 4 | revision = main 5 | depth = 1 6 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/miniz.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = miniz-3.0.1 3 | lead_directory_missing = true 4 | source_url = https://github.com/richgel999/miniz/releases/download/3.0.1/miniz-3.0.1.zip 5 | source_filename = miniz-3.0.1.zip 6 | source_hash = ff960eeb9354b5ef489cf32363a121e25407cadd7b1bfe868386b74f3b38727c 7 | patch_directory = miniz 8 | 9 | [provide] 10 | miniz = miniz_dep 11 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/packagefiles/miniz/meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'miniz', 3 | 'c', 4 | license: 'mit', 5 | version: '3.0.1', 6 | meson_version: '>=0.48.0', 7 | ) 8 | 9 | install_headers('miniz.h') 10 | 11 | if host_machine.system() == 'windows' 12 | api = get_option('default_library' ) != 'static' ? '-DMINIZ_EXPORT=__declspec(dllexport)' : [] 13 | else 14 | api = '-DMINIZ_EXPORT=__attribute__((visibility("default")))' 15 | endif 16 | 17 | miniz_lib = library( 18 | 'miniz', 19 | 'miniz.c', 20 | c_args: api, 21 | gnu_symbol_visibility: 'hidden', 22 | install: true, 23 | ) 24 | 25 | miniz_inc = include_directories('.') 26 | miniz_dep = declare_dependency( 27 | include_directories: miniz_inc, 28 | link_with: miniz_lib, 29 | ) 30 | 31 | pkg = import('pkgconfig') 32 | pkg.generate( 33 | miniz_lib, 34 | name: 'miniz', 35 | description: 'Single C source file zlib-replacement library', 36 | ) 37 | 38 | foreach n : ['1', '2', '3', '4', '5'] 39 | executable('example@0@'.format(n), 'examples/example@0@.c'.format(n), dependencies: miniz_dep) 40 | endforeach 41 | 42 | cc = meson.get_compiler('c') 43 | m_dep = cc.find_library('m', required: false) 44 | executable('example6', 'examples/example6.c', dependencies: [miniz_dep, m_dep]) 45 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/packagefiles/turtle/meson.build: -------------------------------------------------------------------------------- 1 | project('turtle', 'cpp', version : '1.3.2', license : 'Boost') 2 | 3 | turtle_dep = declare_dependency( 4 | include_directories: include_directories('include'), 5 | ) 6 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/pango.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = pango-1.50.12 3 | source_url = https://download.gnome.org/sources/pango/1.50/pango-1.50.12.tar.xz 4 | source_filename = pango-1.50.12.tar.xz 5 | source_hash = caef96d27bbe792a6be92727c73468d832b13da57c8071ef79b9df69ee058fe3 6 | diff_files = pango-1.50.12/0001-meson-Fix-pangoft2.pc-when-using-freetype-and-fontco.patch 7 | 8 | 9 | [provide] 10 | pango = libpango_dep 11 | pangoft2 = libpangoft2_dep 12 | pangoxft = libpangoxft_dep 13 | pangowin32 = libpangowin32_dep 14 | pangocairo = libpangocairo_dep 15 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/pidgin.wrap: -------------------------------------------------------------------------------- 1 | [wrap-hg] 2 | url = https://keep.imfreedom.org/pidgin/pidgin 3 | revision = v0.82 4 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/rubberband.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = rubberband-2.0.2 3 | 4 | source_url = https://breakfastquay.com/files/releases/rubberband-2.0.2.tar.bz2 5 | source_filename = rubberband-2.0.2.tar.bz2 6 | source_hash = b9eac027e797789ae99611c9eaeaf1c3a44cc804f9c8a0441a0d1d26f3d6bdf9 7 | 8 | [provide] 9 | rubberband = rubberband_dep 10 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/rustc-demangle.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/JCWasmx86/rustc-demangle 3 | revision = head 4 | clone-recursive = true 5 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/sqlite.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = sqlite-amalgamation-3080802 3 | 4 | source_url = http://sqlite.com/2015/sqlite-amalgamation-3080802.zip 5 | source_filename = sqlite-amalgamation-3080802.zip 6 | source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663 7 | 8 | patch_url = https://wrapdb.mesonbuild.com/v1/projects/sqlite/3080802/5/get_zip 9 | patch_filename = sqlite-3080802-5-wrap.zip 10 | patch_hash = d66469a73fa1344562d56a1d7627d5d0ee4044a77b32d16cf4bbb85741d4c9fd 11 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/turtle.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = turtle-1.3.2 3 | lead_directory_missing = true 4 | source_url = https://github.com/mat007/turtle/releases/download/v1.3.2/turtle-1.3.2.tar.gz 5 | source_filename = turtle-1.3.2.tar.gz 6 | source_hash = 0551f0e5f19bcee5484a2dfeadd4b56f7142f89ed2a1839dd56ed2d594ef1d4c 7 | patch_directory = turtle 8 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/turtle2.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = turtle-21.3.2 3 | lead_directory_missing = true 4 | source_url = https://github.com/mat007/turtle/releases/download/v1.3.1/turtle-1.3.1.tar.gz 5 | source_fallback_url = https://github.com/mat007/turtle/releases/download/v1.3.2/turtle-1.3.2.tar.gz 6 | source_filename = turtle-1.3.2.tar.gz 7 | source_hash = 0551f0e5f19bcee5484a2dfeadd4b56f7142f89ed2a1839dd56ed2d594ef1d4c 8 | patch_directory = turtle 9 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/turtle3.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = turtle-31.3.2 3 | lead_directory_missing = true 4 | source_url = https://github.com/mat007/turtle/releases/download/v1.3.2/turtle-1.3.9999999999999.tar.gz 5 | source_fallback_url = https://github.com/mat007/turtle/releases/download/v1.3.2/turtle-1.3.2.tar.gz 6 | source_filename = turtle-1.3.2.tar.gz 7 | source_hash = 0551f0e5f19bcee5484a2dfeadd4b56f7142f89ed2a1839dd56ed2d594ef1d4c 8 | patch_directory = turtle 9 | -------------------------------------------------------------------------------- /tests/integration/wrap-test/vorbis.wrap: -------------------------------------------------------------------------------- 1 | [wrap-svn] 2 | url = https://svn.xiph.org/trunk/vorbis/ 3 | -------------------------------------------------------------------------------- /tests/libanalyze/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'optiondiagnosticstest', 3 | executable( 4 | 'optiondiagnosticstest', 5 | 'optiondiagnostics.cpp', 6 | dependencies: [ 7 | analyze_dep, 8 | gtest_dep, 9 | ] 10 | + extra_deps 11 | + extra_libs, 12 | ), 13 | protocol: 'gtest', 14 | ) 15 | -------------------------------------------------------------------------------- /tests/libast/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'asttest', 3 | executable( 4 | 'asttest', 5 | 'test.cpp', 6 | dependencies: [ 7 | ast_dep, 8 | tree_sitter_dep, 9 | tree_sitter_meson_dep, 10 | tree_sitter_ini_dep, 11 | gtest_dep, 12 | ] 13 | + extra_deps 14 | + extra_libs, 15 | ), 16 | protocol: 'gtest', 17 | ) 18 | -------------------------------------------------------------------------------- /tests/libcxathrow/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'cxathrowtest', 3 | executable( 4 | 'cxathrowtest', 5 | 'test.cpp', 6 | dependencies: [cxathrow_dep] + extra_deps + extra_libs, 7 | link_args: extra_link_args, 8 | ), 9 | ) 10 | -------------------------------------------------------------------------------- /tests/libcxathrow/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __attribute__((noinline)) void f4() { throw std::runtime_error("test"); } 4 | 5 | __attribute__((noinline)) void f3() { f4(); } 6 | 7 | __attribute__((noinline)) void f2() { f3(); } 8 | 9 | __attribute__((noinline)) void f1() { f2(); } 10 | 11 | __attribute__((noinline)) void g7() { throw 1; } 12 | 13 | __attribute__((noinline)) void g6() { g7(); } 14 | 15 | __attribute__((noinline)) void g5() { g6(); } 16 | 17 | __attribute__((noinline)) void g4() { g5(); } 18 | 19 | __attribute__((noinline)) void g3() { g4(); } 20 | 21 | __attribute__((noinline)) void g2() { g3(); } 22 | 23 | __attribute__((noinline)) void g1() { g2(); } 24 | 25 | int main(int /*unused*/, char ** /*unused*/) { 26 | try { 27 | f1(); 28 | } catch (...) { 29 | } 30 | 31 | try { 32 | g1(); 33 | } catch (...) { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/libjsonrpc/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'jsonrpctest', 3 | executable( 4 | 'jsonrpctest', 5 | 'test.cpp', 6 | dependencies: [jsonrpc_dep, log_dep, polyfill_dep] + extra_deps + extra_libs, 7 | ), 8 | ) 9 | -------------------------------------------------------------------------------- /tests/liblog/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'logtest', 3 | executable( 4 | 'logtest', 5 | 'test.cpp', 6 | dependencies: [log_dep] + extra_deps + extra_libs, 7 | ), 8 | ) 9 | -------------------------------------------------------------------------------- /tests/liblog/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int /*unused*/, char ** /*unused*/) { 4 | Logger const log("my-module"); 5 | log.error("I'm an error"); 6 | log.info("I'm info"); 7 | log.warn("I'm a warning"); 8 | } 9 | -------------------------------------------------------------------------------- /tests/libparsing/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'lextest', 3 | executable( 4 | 'lextest', 5 | 'lextest.cpp', 6 | dependencies: [parsing_dep, gtest_dep] + extra_deps, 7 | ), 8 | ) 9 | -------------------------------------------------------------------------------- /tests/libtypenamespace/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'typenamespacetest', 3 | executable( 4 | 'typenamespacetest', 5 | 'test.cpp', 6 | dependencies: [typenamespace_dep, gtest_dep] + extra_deps + extra_libs, 7 | ), 8 | protocol: 'gtest', 9 | ) 10 | -------------------------------------------------------------------------------- /tests/libtypenamespace/test.cpp: -------------------------------------------------------------------------------- 1 | #include "typenamespace.hpp" 2 | 3 | #include 4 | 5 | TEST(TypeNamespaceTest, testLookupFunction) { 6 | auto tns = TypeNamespace(); 7 | auto mustExist = tns.lookupFunction("shared_library"); 8 | ASSERT_TRUE(mustExist.has_value()); 9 | auto doesNotExist = tns.lookupFunction("sharedlibrary"); 10 | ASSERT_FALSE(doesNotExist.has_value()); 11 | } 12 | 13 | TEST(TypeNamespaceTest, testLookupMethod) { 14 | auto tns = TypeNamespace(); 15 | auto mesonType = tns.types["meson"]; 16 | auto mustExist = tns.lookupMethod("project_version", mesonType); 17 | ASSERT_TRUE(mustExist.has_value()); 18 | auto doesNotExist = tns.lookupMethod("projectversion", mesonType); 19 | ASSERT_FALSE(doesNotExist.has_value()); 20 | } 21 | 22 | TEST(TypeNamespaceTest, testLookupMethodWithInheritance) { 23 | auto tns = TypeNamespace(); 24 | auto type = tns.types["target_machine"]; 25 | auto mustExist = tns.lookupMethod("cpu", type); 26 | ASSERT_TRUE(mustExist.has_value()); 27 | auto doesNotExist = tns.lookupMethod("cpu2", type); 28 | ASSERT_FALSE(doesNotExist.has_value()); 29 | } 30 | 31 | TEST(TypeNamespaceTest, testLookupMethodByName) { 32 | auto tns = TypeNamespace(); 33 | auto mustExist = tns.lookupMethod("get_linker_id"); 34 | ASSERT_TRUE(mustExist.has_value()); 35 | ASSERT_EQ("compiler.get_linker_id", mustExist->get()->id()); 36 | auto doesNotExist = tns.lookupMethod("cpu2"); 37 | ASSERT_FALSE(doesNotExist.has_value()); 38 | } 39 | 40 | TEST(TypeNamespaceTest, testFullObjectDocCoverage) { 41 | auto tns = TypeNamespace(); 42 | for (const auto &[name, typeRef] : tns.types) { 43 | ASSERT_TRUE(tns.objectDocs.contains(name)); 44 | } 45 | } 46 | 47 | TEST(TypeNamespaceTest, testFullMethodDocCoverage) { 48 | auto tns = TypeNamespace(); 49 | for (const auto &[typeName, methods] : tns.vtables) { 50 | for (const auto &method : methods) { 51 | ASSERT_NE(method->doc, ""); 52 | } 53 | } 54 | } 55 | 56 | TEST(TypeNamespaceTest, testFullFunctionDocCoverage) { 57 | auto tns = TypeNamespace(); 58 | for (const auto &func : tns.functions) { 59 | ASSERT_NE(func.second->doc, ""); 60 | } 61 | } 62 | 63 | int main(int argc, char **argv) { 64 | testing::InitGoogleTest(&argc, argv); 65 | return RUN_ALL_TESTS(); 66 | } 67 | -------------------------------------------------------------------------------- /tests/libutils/meson.build: -------------------------------------------------------------------------------- 1 | test( 2 | 'utilstest', 3 | executable( 4 | 'utilstest', 5 | 'test.cpp', 6 | dependencies: [utils_dep, gtest_dep, uuid_dep] + extra_deps + extra_libs, 7 | ), 8 | protocol: 'gtest', 9 | ) 10 | 11 | test( 12 | 'processtest', 13 | executable( 14 | 'processtest', 15 | 'processtest.cpp', 16 | dependencies: [utils_dep, gtest_dep] + extra_deps + extra_libs, 17 | ), 18 | protocol: 'gtest', 19 | ) 20 | -------------------------------------------------------------------------------- /tests/libutils/processtest.cpp: -------------------------------------------------------------------------------- 1 | #ifdef NDEBUG 2 | #undef NDEBUG 3 | #endif 4 | 5 | #include "utils.hpp" 6 | 7 | #include 8 | 9 | int main(int /*argc*/, char ** /*argv*/) { 10 | auto sout = captureProcessOutput("pkg-config", {"--list-all"}); 11 | assert(sout.has_value()); 12 | assert(sout.value().contains("curl")); 13 | auto sout2 = captureProcessOutput("does-not-exist-executable", {}); 14 | assert(!sout2.has_value()); 15 | auto sout3 = captureProcessOutput("pkg-config", {"--list-all"}); 16 | assert(sout3.has_value()); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | subdir('liblog') 2 | subdir('libcxathrow') 3 | subdir('libanalyze') 4 | subdir('libutils') 5 | subdir('libjsonrpc') 6 | subdir('libast') 7 | subdir('libtypenamespace') 8 | subdir('libparsing') 9 | subdir('integration') 10 | --------------------------------------------------------------------------------