Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate dsymbol #673

Merged
merged 4 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 25 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- master
release:
types: [published]

jobs:
Build:
Expand All @@ -17,13 +15,20 @@ jobs:
dc:
- ldc-latest
- dmd-latest
build: [debug, release]
arch:
- x86_64
libdparse-version: [min, max]
include:
# windows x86
- os: windows-latest
arch: x86
dc: ldc-latest
build: debug
libdparse-version: min
# old compiler tests
- { os: ubuntu-latest, dc: dmd-2.095.1, libdparse-version: min, build: debug, arch: x86_64 }
- { os: ubuntu-latest, dc: ldc-1.25.0, libdparse-version: min, build: debug, arch: x86_64 }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -39,11 +44,27 @@ jobs:

- name: Build
run: |
dub build --build=release --config=client --arch=${{ matrix.arch }}
dub build --build=release --config=server --arch=${{ matrix.arch }}
rdmd ./d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=${{ matrix.build }} --config=client --arch=${{ matrix.arch }}
rdmd ./d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=${{ matrix.build }} --config=server --arch=${{ matrix.arch }}

# Tests

- name: Build DSymbol
env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: |
cd dsymbol
rdmd ../d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub build --build=${{ matrix.build }}

- name: Test DSymbol
env:
DC: ${{matrix.dc}}
LIBDPARSE_VERSION: ${{ matrix.libdparse-version }}
run: |
cd dsymbol
rdmd ../d-test-utils/test_with_package.d $LIBDPARSE_VERSION libdparse -- dub test

- name: Linux Tests
if: contains(matrix.os, 'ubuntu')
run: |
Expand All @@ -58,54 +79,3 @@ jobs:
working-directory: tests
shell: bash
continue-on-error: true


# Package Release

- name: Package the artificats
if: github.event_name == 'release' && contains(matrix.dc, 'ldc')
shell: pwsh
working-directory: bin
run: |
if ("${{ matrix.os }}" -like 'windows*') {
7z a -tzip ..\dcd.zip dcd-client.exe dcd-server.exe
} elseif ("${{ matrix.os }}" -like 'macos*') {
gtar -cvzf ../dcd.tar.gz dcd-client dcd-server
} else {
tar -cvzf ../dcd.tar.gz dcd-client dcd-server
}

# Release

- name: Release Linux
if: github.event_name == 'release' && contains(matrix.os, 'ubuntu') && contains(matrix.dc, 'ldc')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: linux
with:
file: dcd.tar.gz
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz
mime: application/tar+gzip

- name: Release Macos
if: github.event_name == 'release' && contains(matrix.os, 'macos') && contains(matrix.dc, 'ldc')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: osx
with:
file: dcd.tar.gz
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz
mime: application/tar+gzip

- name: Release Windows
if: github.event_name == 'release' && contains(matrix.os, 'windows') && contains(matrix.dc, 'ldc')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: windows
with:
file: dcd.zip
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.zip
mime: application/zip
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish Releases
on:
release:
types: [published]

jobs:
Build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dc:
- ldc-latest
arch:
- x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup D
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

# Build

- name: Build
run: |
dub build --build=release --config=client --arch=${{ matrix.arch }}
dub build --build=release --config=server --arch=${{ matrix.arch }}

# Package Release

- name: Package the artificats
shell: pwsh
working-directory: bin
run: |
if ("${{ matrix.os }}" -like 'windows*') {
7z a -tzip ..\dcd.zip dcd-client.exe dcd-server.exe
} elseif ("${{ matrix.os }}" -like 'macos*') {
gtar -cvzf ../dcd.tar.gz dcd-client dcd-server
} else {
tar -cvzf ../dcd.tar.gz dcd-client dcd-server
}

# Release

- name: Release Linux
if: contains(matrix.os, 'ubuntu')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: linux
with:
file: dcd.tar.gz
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz
mime: application/tar+gzip

- name: Release Macos
if: contains(matrix.os, 'macos')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: osx
with:
file: dcd.tar.gz
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz
mime: application/tar+gzip

- name: Release Windows
if: contains(matrix.os, 'windows')
uses: WebFreak001/upload-asset@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OS: windows
with:
file: dcd.zip
name: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.zip
mime: application/zip
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
path = libdparse
url = https://github.com/dlang-community/libdparse.git
branch = master
[submodule "dsymbol"]
path = dsymbol
url = https://github.com/dlang-community/dsymbol.git
[submodule "stdx-allocator"]
path = stdx-allocator
url = https://github.com/dlang-community/stdx-allocator
Expand Down
5 changes: 0 additions & 5 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ for /r "libdparse/src" %%F in (*.d) do call set libdparse_modules=%%libdparse_mo
set msgspack_modules=
for /r "msgpack-d/src" %%F in (*.d) do call set msgspack_modules=%%msgspack_modules%% "%%F"

set stdx_allocator=
for /r "stdx-allocator/source/stdx/allocator" %%F in (*.d) do call set stdx_allocator=%%stdx_allocator%% "%%F"

set client_name=bin\dcd-client
set server_name=bin\dcd-server

Expand All @@ -59,11 +56,9 @@ set server_name=bin\dcd-server
%common_modules%^
%containers_modules%^
%msgspack_modules%^
%stdx_allocator%^
-Icontainers/src^
-Imsgpack-d/src^
-Ilibdparse/src^
-Istdx-allocator/source^
-wi -O -release^
-Jbin^
%MFLAGS%^
Expand Down
1 change: 0 additions & 1 deletion dsymbol
Submodule dsymbol deleted from f9a3d3
9 changes: 9 additions & 0 deletions dsymbol/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.d]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
32 changes: 32 additions & 0 deletions dsymbol/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Compiled Object files
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.a
*.lib

# Executables
*.exe

# DUB
.dub/
docs/
docs.json
__dummy.html

# Code coverage
*.lst

# Others
build/
*.~*
*.*~
dub.selections.json
trace.def
.vscode/
23 changes: 23 additions & 0 deletions dsymbol/LICENSE_1_0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions dsymbol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# dsymbol

Symbol lookup support for [libdparse](https://github.com/dlang-community/libdparse)
12 changes: 12 additions & 0 deletions dsymbol/dub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "dsymbol",
"description": "Symbol lookup support for libdparse",
"license": "BSL-1.0",
"authors": ["Brian Schott"],
"targetPath": "build",
"targetType": "library",
"dependencies": {
"libdparse": ">=0.20.0 <0.21.0",
"emsi_containers": "~>0.9.0"
}
}
84 changes: 84 additions & 0 deletions dsymbol/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
project('dsymbol', 'd',
meson_version: '>=0.44',
license: 'BSL-1.0',
version: '0.4.8'
)

project_soversion = '0'

pkgc = import('pkgconfig')
dparse_dep = dependency('dparse', version: '>= 0.9.0', fallback: ['dparse', 'dparse_dep'])
dcontainers_dep = dependency('dcontainers', version: '>= 0.8.0', fallback: ['dcontainers', 'dcontainers_dep'])

#
# Sources
#
dsymbol_src = [
'src/dsymbol/builtin/names.d',
'src/dsymbol/builtin/symbols.d',
'src/dsymbol/cache_entry.d',
'src/dsymbol/conversion/first.d',
'src/dsymbol/conversion/package.d',
'src/dsymbol/conversion/second.d',
'src/dsymbol/deferred.d',
'src/dsymbol/import_.d',
'src/dsymbol/modulecache.d',
'src/dsymbol/scope_.d',
'src/dsymbol/semantic.d',
'src/dsymbol/string_interning.d',
'src/dsymbol/symbol.d',
'src/dsymbol/tests.d',
'src/dsymbol/type_lookup.d',
]

src_dir = include_directories('src/')

#
# Targets
#
dsymbol_lib = library('dsymbol',
[dsymbol_src],
include_directories: [src_dir],
install: true,
version: meson.project_version(),
soversion: project_soversion,
dependencies: [dparse_dep, dcontainers_dep]
)

pkgc.generate(name: 'dsymbol',
libraries: [dsymbol_lib],
subdirs: 'd/dsymbol',
requires: ['dparse', 'dcontainers'],
version: meson.project_version(),
description: 'Library for lexing and parsing D source code.'
)

# for use by others which embed this as subproject
dsymbol_dep = declare_dependency(
link_with: [dsymbol_lib],
include_directories: [src_dir],
dependencies: [dparse_dep, dcontainers_dep]
)

#
# Tests
#
if meson.get_compiler('d').get_id() == 'llvm'
extra_args = ['-main', '-link-defaultlib-shared']
else
extra_args = ['-main']
endif

dsymbol_test_exe = executable('test_dsymbol',
[dsymbol_src],
include_directories: [src_dir],
dependencies: [dparse_dep, dcontainers_dep],
d_unittest: true,
link_args: extra_args
)
test('test_dsymbol', dsymbol_test_exe)

#
# Install
#
install_subdir('src/dsymbol/', install_dir: 'include/d/dsymbol/')
Loading