diff --git a/.appveyor.yml b/.appveyor.yml index fd1e9ba..8a65ba5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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" (New-Object System.Net.WebClient).DownloadFile($url, "C:\dmd.7z"); 7z x C:\dmd.7z -oC:\ > $null; $env:DC="dmd" diff --git a/.travis.yml b/.travis.yml index 945fad4..f32e263 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..d6434d6 --- /dev/null +++ b/meson.build @@ -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@0@.so.@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 +) + + +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(), +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..907376e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('run_test', type : 'boolean', value : false) diff --git a/travis.sh b/travis.sh index 3250049..047b43f 100755 --- a/travis.sh +++ b/travis.sh @@ -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