Skip to content

Commit

Permalink
chore: add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
sssooonnnggg committed Nov 21, 2024
1 parent d8a7eb3 commit 68d2a69
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 14 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish

permissions:
contents: write

on:
push:
tags:
- "v*.*.*"

jobs:
create-release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
- name: Checkout cppdap
uses: actions/checkout@v4
with:
repository: google/cppdap
path: cppdap
- name: Checkout luau
uses: actions/checkout@v4
with:
repository: luau-lang/luau
path: luau
- name: configure
run: cmake -DCPP_DAP_ROOT=./cppdap -DLUAU_ROOT=./luau -S . -B build --preset publish-configure
- name: build
run: cmake --build --preset publish-build
- name: pack
run: 7z a luaud.zip .\build\luaud\luau.exe
- uses: softprops/action-gh-release@v2
with:
files: luaud.zip
2 changes: 0 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"${workspaceRoot}/tests/main.lua"
],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
// "console": "externalTerminal",
"preLaunchTask": "CMake: build"
Expand All @@ -29,7 +28,6 @@
"${workspaceRoot}/tests/main.lua"
],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
// "console": "externalTerminal"
}
Expand Down
31 changes: 22 additions & 9 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"version": 8,
"configurePresets": [
{
"name": "Windows-clang-debug",
"displayName": "Windows-clang-debug",
"name": "windows-clang-debug",
"displayName": "windows-clang-debug",
"generator": "Ninja",
"toolchainFile": "${sourceDir}/cmake/toolchains/windows-clang.cmake",
"binaryDir": "${sourceDir}/build",
Expand All @@ -15,24 +15,37 @@
}
},
{
"name": "Windows-clang-release",
"displayName": "Windows-clang-release",
"inherits": "Windows-clang-debug",
"name": "windows-clang-release",
"displayName": "windows-clang-release",
"inherits": "windows-clang-debug",
"binaryDir": "${sourceDir}/build"
},
{
"name": "publish-configure",
"displayName": "publish-configure",
"inherits": "Windows-clang-release",
"toolchainFile": "",
"generator": "Visual Studio 17 2022"
}
],
"buildPresets": [
{
"name": "DebugBuild",
"displayName": "Debug",
"name": "debug-build",
"displayName": "debug-build",
"configurePreset": "Windows-clang-debug",
"configuration": "Debug"
},
{
"name": "ReleaseBuild",
"displayName": "Release",
"name": "release-build",
"displayName": "release-build",
"configurePreset": "Windows-clang-release",
"configuration": "RelWithDebInfo"
},
{
"name": "publish-build",
"displayName": "publish-build",
"configurePreset": "publish-build",
"configuration": "RelWithDebInfo"
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ A debugger for Luau with debug adapter protocol(DAP) support.
- Or use other IDE such as VSCode or Visual Studio

## Usage

- Download or build `luaud` executable
- Install `luau-debugger` extension
- Open lua folders in VSCode
- Add a launch configuration in `launch.json`
Expand Down
97 changes: 97 additions & 0 deletions extensions/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Luau debugger

A debugger for Luau with debug adapter protocol(DAP) support.

## Overview

```bash
└── luau_debugger
|
├── debugger # Debugger implementation, include a DAP server and
| # a debugger implemented with luau internal debug
| # api directly without hooking
|
├── luaud # A Luau executable with debugger support, for testing purpose
├── extensions # VSCode extension for Luau debugger
└── tests # Tests with lua scripts
```

## Dependencies

- luau
- cppdap
- C++ DAP(Debug Adapter Protocol) library, help to simplify the implementation of a DAP server

## Build
- Clone `cppdap` and `luau` repository to local
- Set `CPP_DAP_ROOT` and `LUAU_ROOT` in `CMakePresets.json`
- Build using CMake Presets by CLI
- `cmake -S . -B build --preset <configure preset>`
- `cmake --build --preset <build preset>`
- Or use other IDE such as VSCode or Visual Studio

## Usage
- Download or build `luaud` executable
- Install `luau-debugger` extension
- Open lua folders in VSCode
- Add a launch configuration in `launch.json`
```json
{
"configurations": [
{
"type": "luau",
"request": "attach",
"name": "attach to luau debugger",
"address": "localhost",
"port": 58000
}
]
}
```
- Using `luaud` to execute lua script with debug support
```bash
luaud 58000 <script>
```
- Press `F5` to start debugging

## Features

- [ ] Debugger features
- [x] Attach
- [ ] Launch
- [x] Stop on entry
- [x] Breakpoints
- [x] Add break points when running (Considering thread safety)
- [x] Continue
- [ ] Force break
- [x] StackTrace
- [x] Scopes
- [x] Get variables
- [x] Locals
- [x] Upvalues
- [ ] Display variables
- [x] nil
- [x] boolean
- [x] number
- [x] string
- [x] table
- [x] nested table
- [x] table with cycle reference
- [x] vector
- [x] function
- [ ] userdata
- [ ] Set variables
- [x] Repl
- [x] Watch
- [x] Hover
- [x] Single step
- [x] Step in
- [x] Step over
- [x] Step out
- [x] Disconnect and reconnect
- [ ] Log
- [ ] Coroutine

## Notice

- To avoid debug info to be stripped by luau compiler, `Luau::CompileOptions::debugLevel` should be set to `2`
4 changes: 2 additions & 2 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "luau-debugger",
"displayName": "A Luau Debugger",
"version": "0.0.1",
"version": "0.0.2",
"publisher": "sssooonnnggg",
"description": "A Luau debugger",
"author": {
Expand Down Expand Up @@ -82,7 +82,7 @@
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"vscode:prepublish": "copy ..\\..\\README.md README.md && npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./"
},
Expand Down

0 comments on commit 68d2a69

Please sign in to comment.