Skip to content

Commit

Permalink
Gradle tasks and script for building docsite
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpeters1208 committed Nov 14, 2023
1 parent 968bb16 commit b0efbbe
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
40 changes: 40 additions & 0 deletions R/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def buildRClient = Docker.registerDockerTask(project, 'rClient') {
include 'rdeephaven/R/**'
include 'rdeephaven/src/*.cpp'
include 'rdeephaven/src/Makevars'
include 'rdeephaven/vignettes/*.Rmd'
}
}
dockerfile {
Expand All @@ -64,6 +65,7 @@ def buildRClient = Docker.registerDockerTask(project, 'rClient') {
copyFile('rdeephaven/R/', "${prefix}/src/rdeephaven/R/")
copyFile('rdeephaven/src/*.cpp', "${prefix}/src/rdeephaven/src/")
copyFile('rdeephaven/src/Makevars', "${prefix}/src/rdeephaven/src/")
copyFile('rdeephaven/vignettes/*.Rmd', "${prefix}/src/rdeephaven/vignettes/")
copyFile('r-build.sh', "${prefix}/bin/rdeephaven")
runCommand("PREFIX=${prefix}; " +
'''set -eux ; \
Expand Down Expand Up @@ -155,5 +157,43 @@ def rClientDoc = Docker.registerDockerTask(project, 'rClientDoc') {
containerOutPath = "${prefix}/src/rdeephaven/man"
}

def rClientSite = Docker.registerDockerTask(project, 'rClientSite') {
// Only tested on x86-64, and we only build dependencies for x86-64
platform = 'linux/amd64'
copyIn {
from(layout.projectDirectory) {
include 'r-site.sh'
include 'rdeephaven/man/**'
}
}
copyOut {
into layout.projectDirectory.dir('rdeephaven/docs')
}
dockerfile {
from('deephaven/r-client-doc:local-build')
// We need the contents of 'man' to build the docsite
copyFile('rdeephaven/man/**', "${prefix}/src/rdeephaven/man/")
runCommand("mkdir -p ${prefix}/src/rdeephaven/docs")
runCommand('''echo "status = tryCatch(" \
" {" \
" install.packages('pkgdown', repos='http://cran.us.r-project.org'); " \
" 0" \
" }," \
" error=function(e) 1," \
" warning=function(w) 2" \
");" \
"print(paste0('status=', status));" \
"quit(save='no', status=status)" | \
MAKE="make -j`getconf _NPROCESSORS_ONLN`" R --no-save --no-restore
''')
// Keep this after the package installs above;
// it is likely it changes more frequently.
copyFile('r-site.sh', "${prefix}/bin/rdeephaven")
}
parentContainers = [ project.tasks.getByName('rClientDoc') ]
entrypoint = ["${prefix}/bin/rdeephaven/r-site.sh"]
containerOutPath = "${prefix}/src/rdeephaven/docs"
}

deephavenDocker.shouldLogIfTaskFails testRClient
tasks.check.dependsOn(testRClient)
3 changes: 3 additions & 0 deletions R/r-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

echo "HELLO THERE"

set -euo pipefail

for var in DHCPP NCPUS LD_LIBRARY_PATH; do
Expand All @@ -20,6 +22,7 @@ rm -f src/*.o src/*.so

MAKE="make -j${NCPUS}"
cd .. && \
rm -f rdeephaven_*.tar.gz && \
R CMD build rdeephaven && \
R CMD INSTALL --no-multiarch --with-keep.source rdeephaven_*.tar.gz && \
rm -f rdeephaven_*.tar.gz && \
Expand Down
26 changes: 26 additions & 0 deletions R/r-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -euo pipefail

if [ -z "${DH_PREFIX}" ]; then
echo "$0: Environment variable DH_PREFIX is not set, aborting." 1>&2
exit 1
fi

source $DH_PREFIX/env.sh

cd $DH_PREFIX/src/rdeephaven

R --no-save --no-restore <<EOF
library('pkgdown')
status = tryCatch(
{
print("hello!")
pkgdown::build_site()
0
},
error=function(e) 1
)
print(paste0('status=', status))
quit(save='no', status=status)
EOF
4 changes: 2 additions & 2 deletions docker/registry/cpp-clients-multi-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
io.deephaven.project.ProjectType=DOCKER_REGISTRY
deephaven.registry.imageName=ghcr.io/deephaven/cpp-clients-multi-base:latest
deephaven.registry.imageId=ghcr.io/deephaven/cpp-clients-multi-base@sha256:ea81ee9c948f569d0f278ac40c49ad5a520ae0fe0fcc43ed2959dd43a37ccd9f
deephaven.registry.imageName=alexpeters/cpp-clients-multi-base:local-build
deephaven.registry.imageId=alexpeters/cpp-clients-multi-base:local-build
deephaven.registry.platform=linux/amd64

0 comments on commit b0efbbe

Please sign in to comment.