Skip to content

Commit e4196dc

Browse files
committed
Initial gen_dap comit
0 parents  commit e4196dc

File tree

172 files changed

+12049
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+12049
-0
lines changed

.formatter.exs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Used by "mix format"
2+
locals = [
3+
assert_result: 2,
4+
assert_error: 2,
5+
assert_notification: 2,
6+
assert_result: 3,
7+
assert_error: 3,
8+
assert_notification: 3,
9+
notify: 2,
10+
request: 2
11+
]
12+
13+
[
14+
locals_without_parens: locals,
15+
import_deps: [:typed_struct],
16+
inputs: ["{mix,.formatter}.exs", "{config,lib,test,}/**/*.{ex,exs}"],
17+
export: [
18+
locals_without_parens: locals
19+
]
20+
]

.github/workflows/ci.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches: main
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-22.04
10+
name: Test (${{matrix.elixir}}/${{matrix.otp}})
11+
12+
strategy:
13+
matrix:
14+
include:
15+
- otp: 28.x
16+
elixir: 1.18.x
17+
- otp: 27.x
18+
elixir: 1.17.x
19+
- otp: 26.x
20+
elixir: 1.16.x
21+
- otp: 25.x
22+
elixir: 1.15.x
23+
- otp: 24.x
24+
elixir: 1.14.x
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: erlef/setup-beam@v1
29+
with:
30+
otp-version: ${{matrix.otp}}
31+
elixir-version: ${{matrix.elixir}}
32+
- uses: actions/cache@v3
33+
with:
34+
path: |
35+
deps
36+
_build
37+
key: ${{ runner.os }}-mix-${{matrix.otp}}-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
38+
restore-keys: |
39+
${{ runner.os }}-mix-${{matrix.otp}}-${{matrix.elixir}}-
40+
41+
- name: Install Dependencies
42+
run: mix deps.get
43+
44+
- name: Run Tests
45+
run: mix test || mix test --failed || mix test --failed
46+
47+
formatter:
48+
runs-on: ubuntu-latest
49+
name: Formatter (1.16.x/26.x)
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: erlef/setup-beam@v1
54+
with:
55+
otp-version: 26.x
56+
elixir-version: 1.16.x
57+
- uses: actions/cache@v3
58+
with:
59+
path: |
60+
deps
61+
_build
62+
key: ${{ runner.os }}-mix-24-1.15-${{ hashFiles('**/mix.lock') }}
63+
restore-keys: |
64+
${{ runner.os }}-mix-24-1.15-
65+
66+
- name: Install Dependencies
67+
run: mix deps.get
68+
69+
- name: Run Formatter
70+
run: mix format --check-formatted
71+
72+
dialyzer:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v2
76+
- name: Set up Elixir
77+
id: beam
78+
uses: erlef/setup-beam@v1
79+
with:
80+
otp-version: 26.x
81+
elixir-version: 1.15.x
82+
83+
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
84+
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
85+
- name: Restore PLT cache
86+
uses: actions/cache/restore@v3
87+
id: plt_cache
88+
with:
89+
key: |
90+
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
91+
restore-keys: |
92+
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
93+
path: |
94+
priv/plts
95+
96+
- name: Install Dependencies
97+
run: mix deps.get
98+
99+
# Create PLTs if no cache was found
100+
- name: Create PLTs
101+
if: steps.plt_cache.outputs.cache-hit != 'true'
102+
run: mix dialyzer --plt
103+
104+
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
105+
# so we separate the cache restore and save steps in case running dialyzer fails.
106+
- name: Save PLT cache
107+
uses: actions/cache/save@v3
108+
if: steps.plt_cache.outputs.cache-hit != 'true'
109+
id: plt_cache_save
110+
with:
111+
key: |
112+
${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
113+
path: |
114+
priv/plts
115+
116+
- name: Run dialyzer
117+
run: mix dialyzer --format github

.github/workflows/lint-commit.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint Commit
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
- edited
9+
10+
jobs:
11+
commitlint:
12+
runs-on: ubuntu-latest
13+
name: commitlint
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install Deps
18+
run: yarn install
19+
- name: Lint PR Title
20+
run: echo "${{ github.event.pull_request.title }}" | yarn commitlint

.github/workflows/release.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release:
13+
name: release
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
otp: [28.x]
18+
elixir: [1.18.x]
19+
steps:
20+
- uses: google-github-actions/release-please-action@v3
21+
id: release
22+
with:
23+
release-type: elixir
24+
package-name: gen_dap
25+
bump-minor-pre-major: true
26+
27+
- uses: actions/checkout@v3
28+
if: ${{ steps.release.outputs.release_created }}
29+
30+
- uses: erlef/setup-beam@v1
31+
with:
32+
otp-version: ${{matrix.otp}}
33+
elixir-version: ${{matrix.elixir}}
34+
if: ${{ steps.release.outputs.release_created }}
35+
36+
- uses: actions/cache@v3
37+
id: cache
38+
if: ${{ steps.release.outputs.release_created }}
39+
with:
40+
path: |
41+
deps
42+
_build
43+
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-
46+
47+
- name: Install Dependencies
48+
if: steps.release.outputs.release_created && steps.cache.outputs.cache-hit != 'true'
49+
run: mix deps.get
50+
51+
- name: publish to hex
52+
if: ${{ steps.release.outputs.release_created }}
53+
env:
54+
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
55+
run: |
56+
mix hex.publish --yes

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
lsp-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/
27+
gen_dap.log
28+
node_modules

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## [0.0.1] (2025-06-01)
4+
5+
### Initial release

LICENSE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Łukasz Samson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
MIT License
24+
25+
Copyright (c) 2022 Mitchell Hanberg
26+
27+
Permission is hereby granted, free of charge, to any person obtaining a copy
28+
of this software and associated documentation files (the "Software"), to deal
29+
in the Software without restriction, including without limitation the rights
30+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31+
copies of the Software, and to permit persons to whom the Software is
32+
furnished to do so, subject to the following conditions:
33+
34+
The above copyright notice and this permission notice shall be included in all
35+
copies or substantial portions of the Software.
36+
37+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43+
SOFTWARE.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# GenDAP
2+
3+
GenDAP is an OTP behaviour for building processes that implement the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol).
4+
5+
## Examples
6+
7+
TODO
8+
9+
## Installation
10+
11+
This package can be installed by adding `gen_dap` to your list of dependencies in `mix.exs`:
12+
13+
```elixir
14+
def deps do
15+
[
16+
{:gen_dap, "~> 0.0.1"}
17+
]
18+
end
19+
```
20+
21+
Documentation can be found at <https://hexdocs.pm/gen_dap>.
22+
23+
## Credits
24+
25+
This library is inspired by and based on [gen_lsp](https://github.com/elixir-tools/gen_lsp) by Mitchell Hanberg.

bin/generate

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "==> Generating Protocol"
6+
elixir \
7+
-e 'Mix.install([{:dap_codegen, github: "elixir-lsp/dap_codegen"}], force: true); DAPCodegen.generate(System.argv())' \
8+
-- \
9+
--path ./lib/gen_dap/protocol
10+
11+
echo "==> Removing trailing whitespace"
12+
case "$OSTYPE" in
13+
darwin*) sedc="gsed" ;;
14+
*) sedc="sed" ;;
15+
esac
16+
17+
"$sedc" -i 's/[ \t]*$//' ./lib/gen_dap/protocol/**/*.ex
18+
19+
echo "==> mix format"
20+
mix format

config/config.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Config
2+
3+
config :gen_dap,
4+
json_module: Jason

0 commit comments

Comments
 (0)