Skip to content

Commit

Permalink
Merge pull request #340 from dictu-lang/develop
Browse files Browse the repository at this point in the history
Release 0.14.0
  • Loading branch information
Jason2605 authored Nov 30, 2020
2 parents 06c6627 + 339dd5e commit 4923d44
Show file tree
Hide file tree
Showing 189 changed files with 248,180 additions and 1,349 deletions.
79 changes: 21 additions & 58 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,6 @@ on:
- master

jobs:
test-ubuntu:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-16.04, ubuntu-20.04]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests (HTTP)
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-ubuntu-cmake:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -42,7 +20,7 @@ jobs:
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
Expand All @@ -52,26 +30,6 @@ jobs:
sudo apt-get install -y libcurl4-openssl-dev
cmake -DCMAKE_BUILD_TYPE=Debug -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-mac:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]

steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP)
run: |
make debug DISABLE_HTTP=1
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests
run: |
make debug
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-mac-cmake:
name: Test on ${{ matrix.os }}
Expand All @@ -86,26 +44,31 @@ jobs:
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
- name: Remove build directory
run: |
rm -rf build
- name: Make dictu and run tests
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -B ./build
cmake --build ./build
./build/Dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
test-windows-cmake:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, windows-latest]
./dictu tests/runTests.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
steps:
- uses: actions/checkout@v2
- name: Make dictu and run tests (No HTTP No Linenoise)
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -DDISABLE_LINENOISE=1 -B build
cmake --build build
build\Debug\Dictu.exe tests/runTests.du
## Seems the MSVC compiler was updated on Actions and we are getting loads of compilation
## issues with what seems like standard library header files. While investigating windows
## compilation will be removed from Actions
#
# test-windows-cmake:
# name: Test on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [windows-2019, windows-latest]
#
# steps:
# - uses: actions/checkout@v2
# - name: Make dictu and run tests (No HTTP No Linenoise)
# run: |
# cmake -DCMAKE_BUILD_TYPE=Debug -DDISABLE_HTTP=1 -DDISABLE_LINENOISE=1 -B build
# cmake --build build
# Debug\dictu.exe tests/runTests.du
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ docs/_site/
cmake-build-debug/

cmake-build-release/

.vs/

dictu.exe

dictu.exe.manifest

CMakeSettings.json

dictu.ilk

dictu.pdb

test1.du
49 changes: 7 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,16 @@
cmake_minimum_required(VERSION 3.16.5)
project(Dictu C)
cmake_minimum_required(VERSION 3.16.3)
project(dictu_api C)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

set(DISABLE_HTTP OFF CACHE BOOL "Determines if HTTPS based features are compiled. HTTPS based features require cURL.")
set(DISABLE_LINENOISE OFF CACHE BOOL "Determines if the REPL uses linenoise. Linenoise requires termios.")

file(GLOB_RECURSE sources "c/*.c")
file(GLOB_RECURSE headers "c/*.h")
set(libraries)
option(BUILD_CLI "Build the CLI" ON)

if(DISABLE_HTTP)
list(FILTER sources EXCLUDE REGEX "http.c")
list(FILTER headers EXCLUDE REGEX "http.h")
add_compile_definitions(DISABLE_HTTP)
else()
list(APPEND libraries curl)
endif()
add_subdirectory(src)

if(DISABLE_LINENOISE)
add_compile_definitions(DISABLE_LINENOISE)
endif()

if(WIN32)
# ws2_32 is required for winsock2.h to work correctly
list(APPEND libraries ws2_32)
else()
list(APPEND libraries m)
endif()

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
set(CMAKE_C_FLAGS "/WX /W1")
set(CMAKE_C_FLAGS_DEBUG "/Zi")
set(CMAKE_C_FLAGS_RELEASE "/O2")
else()
set(CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wshadow -Wunused-function -Wunused-macros")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -flto")
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_definitions(DEBUG DEBUG_STRESS_GC DEBUG_FINAL_MEM)
endif()

add_executable(${PROJECT_NAME} ${sources} ${headers})

target_link_libraries(${PROJECT_NAME} ${libraries})
if (BUILD_CLI)
add_subdirectory(src/cli)
endif()
11 changes: 7 additions & 4 deletions Docker/DictuAlpineDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ FROM alpine

WORKDIR Dictu

RUN apk add make curl-dev gcc libc-dev --no-cache
RUN apk add make curl-dev gcc libc-dev cmake --no-cache

COPY . .
COPY CMakeLists.txt .
COPY src ./src/
COPY tests ./tests/

RUN make dictu \
RUN cmake -DCMAKE_BUILD_TYPE=Release -B build \
&& cmake --build ./build \
&& ./dictu tests/runTests.du \
&& cp dictu /usr/bin/ \
&& dictu tests/runTests.du \
&& rm -rf *

CMD ["dictu"]
19 changes: 12 additions & 7 deletions Docker/DictuUbuntuDockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM ubuntu
FROM ubuntu:latest

WORKDIR Dictu

RUN apt update \
&& apt install -y --no-install-recommends build-essential \
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& apt-get update \
&& apt-get install -y --no-install-recommends libcurl4-gnutls-dev\
&& apt-get install -y --no-install-recommends cmake libcurl4-gnutls-dev \
&& rm -rf /var/lib/apt/lists/*

COPY . .
COPY CMakeLists.txt .
COPY src ./src/
COPY tests ./tests/

RUN make dictu \
RUN cmake -DCMAKE_BUILD_TYPE=Release -B build \
&& cmake --build ./build \
&& ./dictu tests/runTests.du \
&& cp dictu /usr/bin/ \
&& dictu tests/runTests.du \
&& rm -rf *

CMD ["dictu"]
2 changes: 1 addition & 1 deletion Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Run the following command from the **root of the project** i.e, the `Dictu` fold

To build the *Alpine* version of Dictu -

```bash
```bash
$ docker build -t dictu:alpine -f Docker/DictuAlpineDockerfile .
```

Expand Down
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

30 changes: 5 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ CMake or there is an included makefile for users that are more familiar with tha

### CMake
```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ git clone -b master https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -B ./build
$ cmake --build ./build
$ ./build/Dictu
$ ./dictu
```

#### Compiling without HTTP
Expand All @@ -38,45 +38,25 @@ The HTTP class within Dictu requires [cURL](https://curl.haxx.se/) to be install
build Dictu without cURL, and in turn the HTTP class, build with the `DISABLE_HTTP` flag.

```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ git clone -b master https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_HTTP=1 -B ./build
$ cmake --build ./build
$ ./build/Dictu
$ ./dictu
```

#### Compiling without linenoise
[Linenoise](https://github.com/antirez/linenoise) is used within Dictu to enhance the REPL, however it does not build on windows
systems so a simpler REPL solution is used.

```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ git clone -b master https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_LINENOISE=1 -B ./build
$ cmake --build ./build
$ ./build/Dictu
```

### Makefile
```bash
$ git clone https://github.com/dictu-lang/Dictu.git
$ cd Dictu
$ make dictu
$ ./dictu examples/guessingGame.du
```

#### Compiling without HTTP

The HTTP class within Dictu requires [cURL](https://curl.haxx.se/) to be installed when building the interpreter. If you wish to
build Dictu without cURL, and in turn the HTTP class, build with the `DISABLE_HTTP` flag.

```bash
$ git clone https://github.com/Jason2605/Dictu.git
$ cd Dictu
$ make dictu DISABLE_HTTP=1
$ ./dictu examples/guessingGame.du
```

### Docker Installation

Refer to [Dictu Docker](https://github.com/dictu-lang/Dictu/blob/develop/Docker/README.md)
Expand Down
Loading

0 comments on commit 4923d44

Please sign in to comment.