Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team 4 - New Language Design Final #26

Open
wants to merge 1 commit into
base: team-4-language
Choose a base branch
from
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 @@

Copy link

Choose a reason for hiding this comment

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

this seems like a full blown new file instead of just adding your test?

Copy link

Choose a reason for hiding this comment

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

@kyotov we have fixed this in our new PR: #29

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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@
# Visual Studio files
/.vs/
/out/

commands.md

# New Language files
src/shadowdash/manifest.o
src/shadowdash/manifest.so
src/shadowdash/manifest.h.gch
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