bazel work

This commit is contained in:
2019-01-10 21:46:00 -08:00
parent 3a10624966
commit 87d2b360bb
5 changed files with 50 additions and 5 deletions

1
BUILD
View File

@@ -5,6 +5,7 @@ cc_binary(
"ncac.h", "ncac.h",
], ],
deps = [ deps = [
"//asana",
"//ui", "//ui",
"@system_include//:curses" "@system_include//:curses"
], ],

View File

@@ -7,5 +7,19 @@ cc_library(
srcs = ["libcurses.dylib"], srcs = ["libcurses.dylib"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
cc_library(
name = "curl",
srcs = ["libcurl.dylib"],
visibility = ["//visibility:public"],
)
""", """,
) )
new_http_archive(
name = "gtest",
url = "https://github.com/google/googletest/archive/release-1.8.0.tar.gz",
sha256 = "58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8",
build_file = "gtest.BUILD",
strip_prefix = "googletest-release-1.8.0",
)

13
gtest.BUILD Normal file
View File

@@ -0,0 +1,13 @@
cc_library(
name = "main",
srcs = glob(
["src/*.cc"],
exclude = ["src/gtest-all.cc"]
),
hdrs = glob([
"include/**/*.h",
"src/*.h"
]),
copts = ["-Iexternal/gtest/include"],
visibility = ["//visibility:public"],
)

1
ncac Symbolic link
View File

@@ -0,0 +1 @@
bazel-bin/ncac

26
ncac.cc
View File

@@ -4,7 +4,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <term.h> #include <term.h>
#include <iostream>
#include "ui/base.h" #include "ui/base.h"
#include "asana/fetch.h"
int main(int argc, char **argv) { int main(int argc, char **argv) {
@@ -23,7 +26,7 @@ int main(int argc, char **argv) {
case 'b': case 'b':
ui::draw_text("Goodbye, world!", &curs_x, &curs_y); ui::draw_text("Goodbye, world!", &curs_x, &curs_y);
break; break;
default: case 'q':
finish(SIGTERM); finish(SIGTERM);
break; break;
} }
@@ -33,15 +36,28 @@ int main(int argc, char **argv) {
static void finish(int sig) { static void finish(int sig) {
endwin(); endwin();
asana::deinit();
exit(0); exit(0);
} }
static void setup() { static void setup() {
// initialize ncurses // initialize the asana client
initscr(); if (!asana::init()) {
cbreak(); std::cerr << "Unable to initialize the Asana client\n" << EOF;
exit(1);
}
// don't echo input // initialize ncurses
if (!initscr()) {
std::cerr << "Unable to initialize the curses screen.\n" << EOF;
exit(1);
}
// don't buffer or echo input
if (cbreak() == ERR) {
std::cerr << "Unable to initialize.\n" << EOF;
exit(1);
}
noecho(); noecho();
nonl(); nonl();