Skip to content
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
5 changes: 3 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ skip_tags: false

install:
- ps: |
$latest = (Invoke-WebRequest "http://downloads.dlang.org/releases/LATEST").toString();
$url = "http://downloads.dlang.org/releases/2.x/$($latest)/dmd.$($latest).windows.7z";
#$latest = (Invoke-WebRequest "http://downloads.dlang.org/releases/LATEST").toString();
#$url = "http://downloads.dlang.org/releases/2.x/$($latest)/dmd.$($latest).windows.7z";
$url = "http://downloads.dlang.org/releases/2.x/2.088.1/dmd.2.088.1.windows.7z"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you want this...

Copy link
Contributor Author

@bioinfornatics bioinfornatics Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current io code can build up to dmdfe 2.088.1
Updating io code should be done in another pull request

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can update this when the bugs are fixed in the latest compiler.

(New-Object System.Net.WebClient).DownloadFile($url, "C:\dmd.7z");
7z x C:\dmd.7z -oC:\ > $null;
$env:DC="dmd"
Expand Down
131 changes: 118 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,130 @@
language: d
addons:
apt:
update: true
packages:
- libevent-dev
- libssl-dev
- pkg-config
- zlib1g-dev
matrix:
- libevent-dev
- libssl-dev
- pkg-config
- zlib1g-dev
- ninja-build
- python3
- python3-pip
- python3-setuptools
# - meson # is too old
homebrew:
update: true
packages:
- ninja
- python
# - meson # is too old
jobs:
include:
- d: dmd
- name: "ldc-latest D compiler on Xenial Linux using dub"
os: linux
dist: xenial
d: ldc
env:
- COVERAGE=false
- BUILD_TOOL='dub'
- name: "ldc-latest D compiler on Xenial Linux using meson"
os: linux
dist: xenial
d: ldc
env:
- COVERAGE=false
- BUILD_TOOL='meson'
- name: "dmd-latest D compiler on Xenial Linux using dub"
os: linux
dist: xenial
d: dmd
env:
- COVERAGE=false
- BUILD_TOOL='dub'
- name: "dmd-2.088.1 D compiler on Xenial Linux using dub"
os: linux
dist: xenial
d: dmd-2.088.1
env:
- COVERAGE=true
- { secure: O4OECnzSKN2Jf5su/wnxVQGx4iIVcE8DmZLT/WN4KDcHg+jQovwvxRizZEGDB9guX/3bZb321kIi4iXP8G/Z2D9rakdzFlG70Drf60w9kveg0QQEMdavAFKsjokNHuYBNhf7QaGZt8O4IvqMmckZ7NJQyiCY7bq9gV5eWz9QWUB2kMy9fHVS3nsR957ZvmDPqyVjcqCx1y9eUda6IeiD1XD/g7cBuOaN3Zg8ozhGTTr6dbFFdVZLqUbGf2tE/Mq1poqcys3qntClpe8iM2f9Ac2d7hCMjiE9HHT/Q5+ZpHh5dnMa1A8lbJT1lRCYokgxwrL7umjXOf7MA0v4SmtNlfU+GX6C7CjoGNghgDxACCsmKBKbYSICmZLxPFYJ/lmoqU8uzxXaXFFFBBL8xsmJznTKgM0TMTUoxJy06L71T37Bf5Yi3OxAisN9tBftffIHRv+UBoEn2+7I6WmKDkobGNIIj46mM0IKpzxUlF4je10yJlzPGm0PzSDm/ogH8JY3ednEvPFYBwlooWvBEAZpNbMl0tuezaAuYn8/qfpu5aTwvEe7tA0ugBVwBrH676DJQoAZFIji0k43pQfHc/2LIV+n5s5gkLYdFDuuUKbtijzqD4dDdn/pBB6gpzv2ZxBjOoIhCGwJoPMVpE/RLf+HJzdfHRRxdhvRbDon7vbnMz0= }
script: ./travis.sh
after_success: bash <(curl -s https://codecov.io/bash)
- os: osx
- BUILD_TOOL='dub'
- name: "dmd-latest D compiler on Xenial Linux using meson"
os: linux
dist: xenial
d: dmd
env:
- COVERAGE=true
script: ./travis.sh
after_success: bash <(curl -s https://codecov.io/bash)
- COVERAGE=false
- BUILD_TOOL='meson'
- name: "dmd-2.088.1 D compiler on Xenial Linux using meson"
os: linux
dist: xenial
d: dmd-2.088.1
env:
- COVERAGE=false
- BUILD_TOOL='meson'
- name: "dmd-nightly D compiler on Xenial Linux using dub"
os: linux
dist: xenial
d: dmd-nightly
env:
- COVERAGE=false
- BUILD_TOOL='dub'
- name: "dmd-latest D compiler on macOS using dub"
os: osx
osx_image: xcode11.2
d: dmd
env:
- COVERAGE=false
- BUILD_TOOL='dub'
- name: "dmd-2.088.1 D compiler on macOS using dub"
os: osx
osx_image: xcode11.2
d: dmd-2.088.1
env:
- COVERAGE=false
- BUILD_TOOL='dub'
allow_failures:
- d: dmd-nightly
- d: dmd
env:
- COVERAGE=false
- BUILD_TOOL='dub'
- d: dmd
env:
- COVERAGE=false
- BUILD_TOOL='meson'
- d: ldc
env:
- COVERAGE=false
- BUILD_TOOL='dub'

before_deploy:
- |
dub build -b ddox
# push docs to gh-pages branch
cd docs || exit 1
git init
git config user.name 'Travis-CI'
git config user.email '<>'
git add .
git commit -m 'Deployed to Github Pages'
git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}" master:gh-pages

deploy:
provider: pages
api_key:
secure: O4OECnzSKN2Jf5su/wnxVQGx4iIVcE8DmZLT/WN4KDcHg+jQovwvxRizZEGDB9guX/3bZb321kIi4iXP8G/Z2D9rakdzFlG70Drf60w9kveg0QQEMdavAFKsjokNHuYBNhf7QaGZt8O4IvqMmckZ7NJQyiCY7bq9gV5eWz9QWUB2kMy9fHVS3nsR957ZvmDPqyVjcqCx1y9eUda6IeiD1XD/g7cBuOaN3Zg8ozhGTTr6dbFFdVZLqUbGf2tE/Mq1poqcys3qntClpe8iM2f9Ac2d7hCMjiE9HHT/Q5+ZpHh5dnMa1A8lbJT1lRCYokgxwrL7umjXOf7MA0v4SmtNlfU+GX6C7CjoGNghgDxACCsmKBKbYSICmZLxPFYJ/lmoqU8uzxXaXFFFBBL8xsmJznTKgM0TMTUoxJy06L71T37Bf5Yi3OxAisN9tBftffIHRv+UBoEn2+7I6WmKDkobGNIIj46mM0IKpzxUlF4je10yJlzPGm0PzSDm/ogH8JY3ednEvPFYBwlooWvBEAZpNbMl0tuezaAuYn8/qfpu5aTwvEe7tA0ugBVwBrH676DJQoAZFIji0k43pQfHc/2LIV+n5s5gkLYdFDuuUKbtijzqD4dDdn/pBB6gpzv2ZxBjOoIhCGwJoPMVpE/RLf+HJzdfHRRxdhvRbDon7vbnMz0=
cleanup: true
keep_history: true
on:
branch: master
condition: $TRAVIS_OS_NAME = "linux"


script:
- ./travis.sh


branches:
only:
- master
90 changes: 90 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
project('io', 'd', default_options: ['optimization=3'], version: '0.2.3', license: 'BSL-1.0' )
common_project_arguments = ['-release'] #, '--d-debug'
add_project_arguments(common_project_arguments, language: 'd')

# semver
version = meson.project_version().split('.')
major_version = version[0].to_int()
minor_version = version[1].to_int()
micro_version = version[2].to_int()

# base
dc = meson.get_compiler('d')

# Source files

sources = [ 'src/std/io/driver/package.d',
'src/std/io/driver/sync.d',
'src/std/io/exception.d',
'src/std/io/file.d',
'src/std/io/internal/iovec.d',
'src/std/io/internal/string.d',
'src/std/io/net/addr.d',
'src/std/io/net/dns.d',
'src/std/io/net/package.d',
'src/std/io/net/socket.d',
'src/std/io/net/tcp.d',
'src/std/io/net/udp.d',
'src/std/io/package.d'
]
inc_dir = include_directories('src/')

# Compiler and linker flags
common_dflags = []
common_ldflags = []

# library
if host_machine.system() == 'linux'
common_ldflags += [ '-Wl,-z,relro', '-Wl,-z,now' ]
endif

lib_type = get_option('default_library')
if lib_type == 'shared'
libio_soname = 'lib@[email protected].@1@'.format(meson.project_name(), major_version)
common_ldflags += ['-shared' ]
if dc.get_id() == 'llvm'
common_ldflags += [ '-soname', libio_soname ]
endif
endif


io_lib = library(meson.project_name(),
sources,
include_directories: inc_dir,
link_args : common_ldflags,
install: true,
version: meson.project_version(),
d_unittest: false
Copy link
Owner

@schveiguy schveiguy Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make a separate executable with unittests turned on?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the meson site, looks like we can do that with:

io_test_exe = executable('io_test', sources, d_unittest: true)
test('iotest', io_test_exe)

I think we would have to add a main function somewhere, and add that to the sources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the option run_test

$ meson build -Drun_test=true
$ ninja build test

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Let's see how it goes, and I'll merge if things look good. Thanks for all the effort here! Always good to spread libraries into alternate build mechanisms.

Copy link
Contributor Author

@bioinfornatics bioinfornatics Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your words of encouragement.
I think meson is a good thing for D libraries as the build system can to be used for linux distro packaging. Moreover it can generate pkg-config file and dub file. It can query dub repository and many others things :-)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

)


io_dep = declare_dependency(
link_with: [io_lib],
include_directories: inc_dir,
dependencies: [],
)

if get_option('run_test')
configure_file(input: 'LICENSE.txt', output:'LICENSE.txt', copy: true)
io_test_exe = executable(meson.project_name() + '-test',
sources, include_directories: inc_dir,
d_unittest: true,
link_args: ['-main'],
d_args: ['-cov']
)
test(meson.project_name() + '-test', io_test_exe)
endif

# Compat variables for pkgconfig
pkg = import('pkgconfig')
pkg.generate(io_lib,
description: 'Core I/O functionality.',
subdirs: 'd/' + meson.project_name(),
url: 'https://github.com/MartinNowak/io'
)


install_subdir('src/',
strip_directory : true,
install_dir: 'include/d/' + meson.project_name(),
)
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('run_test', type : 'boolean', value : false)
33 changes: 17 additions & 16 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ fi

: ${CONFIG:=library} # env CONFIG=dip1000 ./travis.sh

if [ -n "${COVERAGE:-}" ]; then
dub test -b unittest-cov -c $CONFIG
else
dub test -c $CONFIG
fi

if [ ! -z "${GH_TOKEN:-}" ]; then
dub build -b ddox
case "${BUILD_TOOL}" in
meson)
pip3 install --user --upgrade pip
pip install --user --upgrade meson
meson builddir -Drun_test=true
ninja -C builddir test
;;
dub)
dub test -c ${CONFIG}
;;
*)
echo 'Unknown build tool named: '"${BUILD_TOOL}"
exit 1
;;
esac

# push docs to gh-pages branch
cd docs
git init
git config user.name 'Travis-CI'
git config user.email '<>'
git add .
git commit -m 'Deployed to Github Pages'
git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}" master:gh-pages
if "${COVERAGE}"; then
dub test -b unittest-cov -c ${CONFIG}
fi