diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 531f0bb..d291936 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,19 +48,9 @@ jobs: cargo install cross cross build --release --target ${{ matrix.target }} --features no_format -p luals - - name: package-unix - if: ${{ matrix.os != 'windows-latest' }} + - name: package run: | - mkdir -p ${{ github.workspace }}/artifact - cp ${{ github.workspace }}/target/${{ matrix.target }}/release/lua-language-server ${{ github.workspace }}/artifact/ - cp -r "${{ github.workspace }}/resources" "${{ github.workspace }}/artifact/" - - name: package-windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - New-Item -ItemType Directory -Path "${{ github.workspace }}/artifact" - Copy-Item -Path ${{ github.workspace }}\target\${{ matrix.target }}\release\lua-language-server.exe -Destination ${{ github.workspace }}\artifact\ - Copy-Item -Path ${{ github.workspace }}\resources -Destination ${{ github.workspace }}\artifact\ -Recurse - shell: pwsh + python publish/workflow_copy_files.py . "${{ github.workspace }}/artifact" - name: Upload uses: actions/upload-artifact@v3 with: diff --git a/crates/basic/src/parser/lua_syntax_tree.rs b/crates/basic/src/parser/lua_syntax_tree.rs index 5c385fc..4d2d355 100644 --- a/crates/basic/src/parser/lua_syntax_tree.rs +++ b/crates/basic/src/parser/lua_syntax_tree.rs @@ -30,8 +30,6 @@ impl LuaSyntaxTree { } impl LuaUserData for LuaSyntaxTree { - fn add_fields>(fields: &mut F) {} - fn add_methods>(methods: &mut M) { methods.add_method("getRoot", |_, this, ()| Ok(this.get_root())); // methods.add_method("get_chunk_node", |_, this, ()| Ok(this.get_chunk_node())); diff --git a/publish/workflow_copy_files.py b/publish/workflow_copy_files.py new file mode 100644 index 0000000..1e40074 --- /dev/null +++ b/publish/workflow_copy_files.py @@ -0,0 +1,40 @@ +#! /usr/bin/env python3 +import os +import shutil +import argparse + +parser = argparse.ArgumentParser(description='Copy specified directories from source to target.') +parser.add_argument('source_dir', help='Source directory path') +parser.add_argument('target_dir', help='Target directory path') +args = parser.parse_args() + +directories = ['locale', 'bin', 'meta', 'script'] +files = ['main.lua', "changelog.md", "LICENSE"] + +if os.path.exists(args.target_dir): + shutil.rmtree(args.target_dir) +os.makedirs(args.target_dir) + +def copy_directories(source_dir, target_dir, directories): + if not os.path.exists(target_dir): + os.makedirs(target_dir) + for directory in directories: + src_path = os.path.join(source_dir, directory) + dst_path = os.path.join(target_dir, directory) + if os.path.exists(src_path): + shutil.copytree(src_path, dst_path) + else: + print(f"Directory {src_path} does not exist.") + +copy_directories(args.source_dir, args.target_dir, directories) + +def copy_files(source_dir, target_dir, files): + for file in files: + src_path = os.path.join(source_dir, file) + dst_path = os.path.join(target_dir, file) + if os.path.exists(src_path): + shutil.copy2(src_path, dst_path) + else: + print(f"File {src_path} does not exist.") + +copy_files(args.source_dir, args.target_dir, files) \ No newline at end of file