Skip to content

Commit f98f0e3

Browse files
committed
D bindings
Signed-off-by: Matheus C. França <matheus-catarino@hotmail.com>
1 parent 737012f commit f98f0e3

File tree

19 files changed

+760
-0
lines changed

19 files changed

+760
-0
lines changed

.devcontainer/post_create.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ opam install -y dune ounit2 ocamlformat
6969

7070
# Setup for Cpp binding
7171
sudo apt install -y ninja-build
72+
73+
# Setup for D binding
74+
sudo apt install -y dmd dub

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ integrations export-ignore
88

99
bindings/c export-ignore
1010
bindings/cpp export-ignore
11+
bindings/d export-ignore
1112
bindings/dotnet export-ignore
1213
bindings/go export-ignore
1314
bindings/haskell export-ignore
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Bindings D CI
19+
20+
on:
21+
push:
22+
branches:
23+
- main
24+
tags:
25+
- "*"
26+
pull_request:
27+
branches:
28+
- main
29+
paths:
30+
- "core/**"
31+
- "bindings/c/**"
32+
- "bindings/d/**"
33+
- ".github/workflows/ci_bindings_d.yml"
34+
workflow_dispatch:
35+
36+
concurrency:
37+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
38+
cancel-in-progress: true
39+
40+
permissions:
41+
contents: read
42+
43+
jobs:
44+
test:
45+
strategy:
46+
matrix:
47+
dlang: ["ldc-latest", "dmd-latest"]
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: dlang-community/setup-dlang@v2
52+
with:
53+
compiler: ${{ matrix.dlang }}
54+
55+
- name: Setup Rust toolchain
56+
uses: ./.github/actions/setup
57+
58+
- name: Build D binding
59+
working-directory: bindings/d
60+
run: dub build
61+
62+
- name: Check diff
63+
run: git diff --exit-code
64+
65+
- name: Check
66+
working-directory: bindings/d
67+
run: dub lint
68+
69+
- name: Run tests
70+
working-directory: bindings/d
71+
run: dub test && cd test && dub

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ extend-exclude = [
3636
# Generated pnpm locks.
3737
"website/pnpm-lock.yaml",
3838
"CHANGELOG.md",
39+
# dscanner config
40+
"bindings/d/dscanner.ini",
3941
]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ OpenDAL offers a unified data access layer, empowering users to seamlessly and e
1414
| [Rust Core] | [![Rust Core Image]][Rust Core Link] | [![Docs Release]][Rust Core Release Docs] [![Docs Dev]][Rust Core Dev Docs] |
1515
| [C Binding] | - | [![Docs Dev]][C Binding Dev Docs] |
1616
| [Cpp Binding] | - | [![Docs Dev]][Cpp Binding Dev Docs] |
17+
| [D Binding] | - | - |
1718
| [Dotnet Binding] | - | - |
1819
| [Go Binding] | [![Go Binding Image]][Go Binding Link] | [![Docs Release]][Go Release Docs] |
1920
| [Haskell Binding] | - | - |
@@ -38,6 +39,7 @@ OpenDAL offers a unified data access layer, empowering users to seamlessly and e
3839
[C Binding Dev Docs]: https://opendal.apache.org/docs/c/
3940
[Cpp Binding]: bindings/cpp/README.md
4041
[Cpp Binding Dev Docs]: https://opendal.apache.org/docs/cpp/
42+
[D Binding]: bindings/d/README.md
4143
[Dotnet Binding]: bindings/dotnet/README.md
4244
[Go Binding]: bindings/go/README.md
4345
[Go Binding Image]: https://badge.fury.io/go/github.com%2Fapache%2Fopendal%2Fbindings%2Fgo.svg

bindings/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This folder contains the bindings for OpenDAL. Currently, we support the followi
1313
* [C](c/README.md)
1414
* [C++](cpp/README.md)
1515
* [C#](dotnet/README.md)
16+
* [D](d/README.md)
1617
* [Go](go/README.md)
1718
* [Haskell](haskell/README.md)
1819
* [Lua](lua/README.md)

bindings/d/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.dub
2+
docs.json
3+
__dummy.html
4+
docs/
5+
/d
6+
d.so
7+
d.dylib
8+
d.dll
9+
d.a
10+
d.lib
11+
d-test-*
12+
*.exe
13+
*.pdb
14+
*.o
15+
*.obj
16+
*.lst
17+
*.h
18+
*.a
19+
*.ninja_log
20+
tests*

bindings/d/CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Contributing
2+
3+
- [Contributing](#contributing)
4+
- [Setup](#setup)
5+
- [Using a dev container environment](#using-a-dev-container-environment)
6+
- [Bring your own toolbox](#bring-your-own-toolbox)
7+
- [Build](#build)
8+
- [Test](#test)
9+
10+
## Setup
11+
12+
### Using a dev container environment
13+
14+
OpenDAL provides a pre-configured [dev container](https://containers.dev/) that could be used in [GitHub Codespaces](https://github.com/features/codespaces), [VSCode](https://code.visualstudio.com/), [JetBrains](https://www.jetbrains.com/remote-development/gateway/), [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/). Please pick up your favourite runtime environment.
15+
16+
The fastest way is:
17+
18+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/apache/opendal?quickstart=1&machine=standardLinux32gb)
19+
20+
### Bring your own toolbox
21+
22+
To build OpenDAL D binding locally, you need:
23+
24+
- [dmd/ldc/gdc](https://dlang.org/download)
25+
26+
27+
## Build
28+
29+
First, build the C bindings:
30+
31+
```shell
32+
dub build -b release
33+
```
34+
35+
> **Note**:
36+
>
37+
> - `dub build` adds the header file `opendal.h` under `../c/include`
38+
> - The library is under `../../target/debug` or `../../target/release` after building.
39+
40+
## Test
41+
42+
To build and run the tests.
43+
44+
```shell
45+
$ dub test
46+
Generating test runner configuration 'opendal-test-unittest' for 'unittest' (library).
47+
Starting Performing "unittest" build using /usr/bin/ldc2 for x86_64.
48+
Building opendal ~master: building configuration [opendal-test-unittest]
49+
Pre-build Running commands
50+
Finished `release` profile [optimized] target(s) in 0.08s
51+
Cargo build completed successfully
52+
Linking opendal-test-unittest
53+
Running opendal-test-unittest
54+
Basic Operator creation and write test passed
55+
1 modules passed unittests
56+
```
57+
58+

bindings/d/DEPENDENCIES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Dependencies
2+
3+
OpenDAL D Binding is based on the C Binding.
4+
There are no extra runtime dependencies except those conveyed from C Binding.

bindings/d/DEPENDENCIES.rust.tsv

Whitespace-only changes.

0 commit comments

Comments
 (0)