Skip to content

Commit

Permalink
Move source to prepare for more work.
Browse files Browse the repository at this point in the history
Fix Makefile and Dockerfile.
  • Loading branch information
gbrail committed Jan 9, 2020
1 parent 4653dcb commit 226decb
Show file tree
Hide file tree
Showing 46 changed files with 104 additions and 104 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
apib
apibmon
testserver
bin/
*.o
bazel-*
.vscode
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM ubuntu:18.04 AS builder
RUN apt-get update
RUN apt-get install -y g++ git pkg-config python3 unzip wget zip zlib1g-dev
RUN apt-get install -y g++ git make pkg-config python3 unzip wget zip zlib1g-dev
RUN wget https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-linux-x86_64.sh
RUN bash ./bazel-0.29.1-installer-linux-x86_64.sh
WORKDIR /apib
COPY . .
RUN bazel test -c opt ...
RUN bazel build -c opt //src:apib
RUN make bin/apib

FROM ubuntu:18.04
COPY --from=0 /apib/bazel-bin/src/apib /apib
COPY --from=0 /apib/bin/apib /apib
RUN apt-get update && apt-get install -y ca-certificates
ENTRYPOINT ["/apib"]
29 changes: 16 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

BAZ_OPTS=-c opt --copt='-O3'

all: apib apibmon
.PHONY: apib apibmon test testserver
all: bin/apib bin/apibmon
.PHONY: bin/apib bin/apibmon test bin/testserver

apib:
bazel build $(BAZ_OPTS) //src:apib
cp ./bazel-bin/src/apib .
chmod u+w ./apib
bin/apib: bin
bazel build $(BAZ_OPTS) //apib
cp ./bazel-bin/apib/apib ./bin/apib
chmod u+w ./bin/apib

apibmon:
bazel build $(BAZ_OPTS) //src:apibmon
cp ./bazel-bin/src/apibmon .
chmod u+w ./apibmon
bin/apibmon: bin
bazel build $(BAZ_OPTS) //apib:apibmon
cp ./bazel-bin/apib/apibmon ./bin/apibmon
chmod u+w ./bin/apibmon

testserver:
bin/testserver: bin
bazel build $(BAZ_OPTS) //test:testserver
cp ./bazel-bin/test/testserver .
chmod u+w ./testserver
cp ./bazel-bin/test/testserver ./bin/testserver
chmod u+w ./bin/testserver

bin:
mkdir bin

test:
bazel test $(BAZ_OPTS) ...
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ http_archive(
build_file = "@//:libev.build",
sha256 = "2d5526fc8da4f072dd5c73e18fbb1666f5ef8ed78b73bba12e195cfdd810344e",
strip_prefix = "libev-4.27",
urls = ["http://dist.schmorp.de/libev/libev-4.27.tar.gz"],
urls = ["http://dist.schmorp.de/libev/Attic/libev-4.27.tar.gz"],
)

http_archive(
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/apib_commandqueue.cc → apib/apib_commandqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_commandqueue.h"
#include "apib/apib_commandqueue.h"

namespace apib {

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/apib_cpu_bsd.cc → apib/apib_cpu_bsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ limitations under the License.

#include <cstring>

#include "src/apib_cpu.h"
#include "src/apib_time.h"
#include "apib/apib_cpu.h"
#include "apib/apib_time.h"

namespace apib {

Expand Down
2 changes: 1 addition & 1 deletion src/apib_cpu_generic.cc → apib/apib_cpu_generic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

#include <unistd.h>

#include "src/apib_cpu.h"
#include "apib/apib_cpu.h"

namespace apib {

Expand Down
6 changes: 3 additions & 3 deletions src/apib_cpu_proc.cc → apib/apib_cpu_proc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ limitations under the License.
#include <iostream>

#include "absl/strings/numbers.h"
#include "src/apib_cpu.h"
#include "src/apib_lines.h"
#include "src/apib_time.h"
#include "apib/apib_cpu.h"
#include "apib/apib_lines.h"
#include "apib/apib_time.h"

#define PROC_BUF_LEN 8192

Expand Down
2 changes: 1 addition & 1 deletion src/apib_io_basic.cc → apib/apib_io_basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#include <cassert>
#include <iostream>

#include "src/apib_iothread.h"
#include "apib/apib_iothread.h"

namespace apib {

Expand Down
2 changes: 1 addition & 1 deletion src/apib_io_socket.cc → apib/apib_io_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

#include <cassert>

#include "src/apib_iothread.h"
#include "apib/apib_iothread.h"

namespace apib {

Expand Down
14 changes: 7 additions & 7 deletions src/apib_iothread.cc → apib/apib_iothread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_iothread.h"
#include "apib/apib_iothread.h"

#include <cassert>
#include <functional>
Expand All @@ -23,12 +23,12 @@ limitations under the License.

#include "absl/strings/str_join.h"
#include "ev.h"
#include "src/apib_lines.h"
#include "src/apib_rand.h"
#include "src/apib_reporting.h"
#include "src/apib_time.h"
#include "src/apib_url.h"
#include "src/apib_util.h"
#include "apib/apib_lines.h"
#include "apib/apib_rand.h"
#include "apib/apib_reporting.h"
#include "apib/apib_time.h"
#include "apib/apib_url.h"
#include "apib/apib_util.h"

namespace apib {

Expand Down
10 changes: 5 additions & 5 deletions src/apib_iothread.h → apib/apib_iothread.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ limitations under the License.

#include "ev.h"
#include "http_parser.h"
#include "src/apib_commandqueue.h"
#include "src/apib_lines.h"
#include "src/apib_oauth.h"
#include "src/apib_rand.h"
#include "src/apib_url.h"
#include "apib/apib_commandqueue.h"
#include "apib/apib_lines.h"
#include "apib/apib_oauth.h"
#include "apib/apib_rand.h"
#include "apib/apib_url.h"

namespace apib {

Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/apib_main.cc → apib/apib_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ limitations under the License.
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "src/apib_cpu.h"
#include "src/apib_iothread.h"
#include "src/apib_oauth.h"
#include "src/apib_reporting.h"
#include "src/apib_url.h"
#include "src/apib_util.h"
#include "apib/apib_cpu.h"
#include "apib/apib_iothread.h"
#include "apib/apib_oauth.h"
#include "apib/apib_reporting.h"
#include "apib/apib_url.h"
#include "apib/apib_util.h"
#include "third_party/base64.h"

using apib::eqcase;
Expand Down
8 changes: 4 additions & 4 deletions src/apib_mon.cc → apib/apib_mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
* This is a program that returns CPU information over the network.
*/

#include "src/apib_mon.h"
#include "apib/apib_mon.h"

#include <arpa/inet.h>
#include <fcntl.h>
Expand All @@ -33,9 +33,9 @@ limitations under the License.
#include <iostream>
#include <sstream>

#include "src/apib_cpu.h"
#include "src/apib_lines.h"
#include "src/apib_util.h"
#include "apib/apib_cpu.h"
#include "apib/apib_lines.h"
#include "apib/apib_util.h"

using std::cerr;
using std::cout;
Expand Down
2 changes: 1 addition & 1 deletion src/apib_mon.h → apib/apib_mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.

#include "absl/strings/string_view.h"
#include "ev.h"
#include "src/apib_cpu.h"
#include "apib/apib_cpu.h"

namespace apib {

Expand Down
2 changes: 1 addition & 1 deletion src/apib_mon_main.cc → apib/apib_mon_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

#include <iostream>

#include "src/apib_mon.h"
#include "apib/apib_mon.h"

int main(int argc, char** argv) {
apib::MonServer mon;
Expand Down
8 changes: 4 additions & 4 deletions src/apib_oauth.cc → apib/apib_oauth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_oauth.h"
#include "apib/apib_oauth.h"

#include <assert.h>
#include <openssl/bio.h>
Expand All @@ -28,9 +28,9 @@ limitations under the License.

#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "src/apib_rand.h"
#include "src/apib_time.h"
#include "src/apib_url.h"
#include "apib/apib_rand.h"
#include "apib/apib_time.h"
#include "apib/apib_url.h"
#include "third_party/base64.h"

#define MAX_NUM_SIZE 256
Expand Down
4 changes: 2 additions & 2 deletions src/apib_oauth.h → apib/apib_oauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ limitations under the License.

#include <string>

#include "src/apib_rand.h"
#include "src/apib_url.h"
#include "apib/apib_rand.h"
#include "apib/apib_url.h"

namespace apib {

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/apib_reporting.cc → apib/apib_reporting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_reporting.h"
#include "apib/apib_reporting.h"

#include <arpa/inet.h>
#include <netdb.h>
Expand All @@ -36,8 +36,8 @@ limitations under the License.
#include <vector>

#include "absl/strings/str_format.h"
#include "src/apib_cpu.h"
#include "src/apib_time.h"
#include "apib/apib_cpu.h"
#include "apib/apib_time.h"

using absl::StrFormat;
using std::cerr;
Expand Down
2 changes: 1 addition & 1 deletion src/apib_reporting.h → apib/apib_reporting.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ limitations under the License.
#include <string>
#include <vector>

#include "src/apib_iothread.h"
#include "apib/apib_iothread.h"

namespace apib {

Expand Down
4 changes: 2 additions & 2 deletions src/apib_time.cc → apib/apib_time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_time.h"
#include "apib/apib_time.h"

#include <cassert>
#include <ctime>

#include "src/apib_util.h"
#include "apib/apib_util.h"

namespace apib {

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/apib_url.cc → apib/apib_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ limitations under the License.
#include <sstream>

#include "http_parser.h"
#include "src/apib_lines.h"
#include "src/apib_util.h"
#include "apib/apib_lines.h"
#include "apib/apib_util.h"

#define URL_BUF_LEN 8192
#define INITIAL_URLS 16
Expand Down
2 changes: 1 addition & 1 deletion src/apib_url.h → apib/apib_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ limitations under the License.
#include <vector>

#include "absl/strings/string_view.h"
#include "src/apib_rand.h"
#include "apib/apib_rand.h"

namespace apib {

Expand Down
2 changes: 1 addition & 1 deletion src/apib_util.cc → apib/apib_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include "src/apib_util.h"
#include "apib/apib_util.h"

#include <cassert>
#include <locale>
Expand Down
File renamed without changes.
Loading

0 comments on commit 226decb

Please sign in to comment.