Skip to content
Draft
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
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y gcc gfortran libbz2-dev fort77 bzip2 xorg-dev liblzma-dev libblas-dev gfortran gcc-multilib gobjc++ aptitude libreadline-dev\
libjpeg-dev libssl-dev libcurl4-openssl-dev libxml2-dev libpng-dev build-essential git libpcre2-dev littler \
xvfb xauth xfonts-base texlive-latex-base texlive-fonts-extra pandoc openssh-server gdb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# install dyntrace
RUN git clone https://github.com/PRL-PRG/R-dyntrace.git && cd R-dyntrace && bash -c "git checkout r-4.0.2" && \
./build --with-readline=no --with-x=no
# Install ssh for Clion debugging
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
# Install injectr
RUN cd /home && git clone https://github.com/nsaripalli/injectr.git && cd injectr && git checkout patch-1 && \
xvfb-run --auto-servernum --server-num=1 make R="/R-dyntrace/bin/R" clean build install
RUN /R-dyntrace/bin/R -s -e "install.packages(c('devtools', 'string', 'lintr', 'dplyr', 'covr','pryr'), repos = 'http://cran.rstudio.com/')"
WORKDIR /home/instrumentr
ADD . /home/instrumentr
# Install instrumentr
RUN cd /home/instrumentr && xvfb-run --auto-servernum --server-num=1 make R="/R-dyntrace/bin/R" clean document build check install
CMD /bin/bash
ENTRYPOINT /R-dyntrace/bin/R R --file=test1.R --no-save --debugger=gdb
31 changes: 22 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
R := R
SOURCEDIR := src
INCLUDEDIR := inst/include
DOCKER := docker

SOURCES := $(shell find $(SOURCEDIR) -name '*.cpp')
INCLUDES := $(shell find $(INCLUDEDIR) -name '*.hpp') $(shell find $(SOURCEDIR) -name '*.h')
Expand All @@ -12,7 +13,7 @@ SCAN_BUILD := scan-build

all: clean document build check

build: document
build: install-dplyr document
$(R) CMD build .

check: build
Expand All @@ -27,25 +28,31 @@ install: clean
$(R) CMD INSTALL .

uninstall:
$(R) --slave -e "remove.packages('instrumentr')"
$(R) -s -e "remove.packages('instrumentr')"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

slave is deprecated wch/r-source@f1ff49e


generate-callback-api:
$(R) --slave --file=inst/meta/generate-callback-api.R --args R/callbacks.R
generate-callback-api: install-stringr
$(R) -s --file=inst/meta/generate-callback-api.R --args R/callbacks.R

document: generate-callback-api install-devtools
$(R) --slave -e "devtools::document()"
$(R) -s -e "devtools::document()"

test: install-devtools
$(R) --slave -e "devtools::test()"
$(R) -s -e "devtools::test()"

lintr: install-lintr
$(R) --slave -e "quit(status = length(print(lintr::lint_package())) != 0)"
$(R) -s -e "quit(status = length(print(lintr::lint_package())) != 0)"

install-devtools:
$(R) --slave -e "if (!require('devtools')) install.packages('devtools')"
$(R) -s -e "if (!require('devtools')) install.packages('devtools', repos = 'http://cran.rstudio.com/')"

install-stringr:
$(R) -s -e "if (!require('string')) install.packages('stringr', repos = 'http://cran.rstudio.com/')";

install-lintr:
$(R) --slave -e "if (!require('lintr')) install.packages('lintr')"
$(R) -s -e "if (!require('lintr')) install.packages('lintr', repos = 'http://cran.rstudio.com/')"

install-dplyr:
$(R) -s -e "if (!require('dplyr')) install.packages('dplyr', repos = 'http://cran.rstudio.com/')"

clang-tidy: clean
$(SCAN_BUILD) make build
Expand All @@ -67,3 +74,9 @@ cppcheck:
-I inst/include/ \
$(SOURCES) \
$(INCLUDES)

build-docker:
$(DOCKER) build -t instrumentr .

run-docker:
$(DOCKER) run -it instrumentr