forked from ninja-build/ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
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
waynewangyuxuan
wants to merge
1
commit into
nyuoss:team-4-language
Choose a base branch
from
YuWei-CH:new-language-final
base: team-4-language
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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