Skip to content
Open
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
76 changes: 76 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

version: 2.1
jobs:
build-test:
docker:
- image: cimg/base:current
steps:
# Checkout the code as the first step.
- checkout
- run:
name: InstallPreq
command: |
echo "Installing clang-tidy"
sudo apt-get update && sudo apt-get install -y clang-tidy
echo "Installed"
- run:
name: Build
command: |
echo "Building"
mkdir build && cd build
cmake -S ..
make -j $(nproc)
cd ../
echo "Built"
- run:
name: ninjaTest
command: |
cd build
./ninja_test --gtest_output=XML
echo "Testing Done"
- store_test_results:
path: build
- run:
name: ctest
command: |
echo "Start Testing"
cd build
ctest --output-junit results.xml
echo "Testing Done"
- store_test_results:
path: build/results.xml
- run:
name: Run Performance Tests
command: |
cd build
for test in build_log_perftest canon_perftest clparser_perftest elide_middle_perftest hash_collision_bench; do
echo "Running $test"
./$test
done
- run:
name: Run Compile .o and .so Tests
command: |
check_success() {
if [ $? -eq 0 ]; then
echo "$1"
else
echo "$1"
exit 1
fi
}

cd src/shadowdash

g++ -w -std=c++17 -fPIC -c manifest.cc manifest.h
check_success ".o compiled successfully"

g++ -w -shared -o manifest.so manifest.o
check_success ".so compiled successfully"

cd ../..


workflows:
build-test-workflow:
jobs:
- build-test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@
# Visual Studio files
/.vs/
/out/

# New Language files
src/shadowdash/manifest.o
src/shadowdash/manifest.so
src/shadowdash/manifest.h.gch
17 changes: 17 additions & 0 deletions commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
mkdir build && cd build
cmake -S ..
make -j $(nproc)
ls
ctest
sudo cp ninja /usr/local/bin/ (move nin to local/bin)
ninja --version

(cd ..)
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -G "Ninja" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE=Release ../llvm
ninja clang-tidy
export PATH=$PATH:/home/yuwei/Documents/llvm-project/build/bin
clang-tidy --version
87 changes: 87 additions & 0 deletions src/shadowdash/manifest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include "manifest.h"

using namespace shadowdash;

BuildsReturn manifest() {
// example of defining a variable named "flags"
// the value "-03" is a literal token
let(flags, "-O3"); // original language: flags = -03
let(pool_depth, "4"); // original language: pool_depth = 4
// variable examples

// examples of creating pool objects:
auto heavy_object_pool = pool_(bind(depth, "pool_depth"_v));
// passing the argument via macro
auto heavy_object_pool2 = pool_(binding("depth", {"pool_depth"_v}));
// passing the argument via creating a binding object
/*
in original language:
pool heavy_object_pool:
depth = pool_depth
*/
// pool examples

// examples of creating rules in the new language
make_rule(compile,
bind(command, "g++", "flags"_v, "-c", in, "-o", out),
bind(pool, "heavy_object_pool"_v)
);
/*
in original language:
rule compile:
command = gcc $flags -c $in -o $out
pool = heavy_object_pool
*/

make_rule(link,
bind(command, "g++", in, "-o", out)
);
// rule examples

// examples of creating builds in the new language:
auto build_c = build(list{ str{ "hello.o" } },
{},
compile,
list{ str{ "hello.cc" } },
{},
{},
{ bind(flags, "-O2"),
bind(pool, "console"_v) }
);
/*
in original language:
build hello.o : compile hello.cc
flags = -02
pool = console
*/

auto build_l = build(list{ str{ "hello" } },
{},
link,
list{ str{ "hello.o" } },
{},
{},
{}
);

auto build_p = build(list{ str{ "dummy" } },
{},
phony,
{},
{},
{},
{}
);
// build examples

// examples of adding defaults in new language
default_(str{ "hello" });
default_(list{ str{ "foo1" }, str{ "foo2" } });
/*
in original language:
default hello
default foo1 foo2
*/
// default examples
return {build_c, build_l, build_p}; // returns all the builds
}
Loading