Skip to content

Commit

Permalink
Add needs_compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jan 7, 2024
1 parent 4f1851c commit 8d569a8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
rmarkdown,
yaml,
xml2
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Remotes:
ropensci/postdoc,
r-lib/remotes
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export(get_package_datasets)
export(install_dependencies)
export(install_sysdeps)
export(maintainer_info_base64)
export(needs_compilation)
export(read_description_field)
export(render_article)
export(render_html_manual)
Expand Down
7 changes: 7 additions & 0 deletions R/buildtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,13 @@ generate_metadata_files <- function(package, repo, subdir, outdir, pkgdir, git_u
jsonlite::write_json(Filter(function(x){!is.null(x)}, contents), path = file.path(extra_dir, 'contents.json'))
}

#' @export
#' @rdname buildtools
needs_compilation <- function(package){
desc <- as.data.frame(read.dcf(system.file('DESCRIPTION', package = package)))
desc$NeedsCompilation
}

#' @export
#' @rdname buildtools
maintainer_info_base64 <- function(path = '.'){
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ outputs:
description: 'Base64 encoded JSON list with commit data'
GITSTATS:
description: 'Base64 encoded JSON list with git stats'
NEEDS_COMPILATION:
description: 'If the source package has a src dir'

runs:
using: 'docker'
image: 'docker://ghcr.io/r-universe-org/build-source'
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ if [ "$MANUAL_FAILURE" ]; then
cat stderr_manual.txt
fi

# Test if package needs compilation (R simply checks if there is a 'src' dir)
NEEDS_COMPILATION=$(Rscript -e "cat(buildtools::needs_compilation('${PACKAGE}'))")
if [ "$NEEDS_COMPILATION" == "yes" ]; then
echo "NEEDS_COMPILATION=yes" >> $GITHUB_OUTPUT
fi

# Find readme URL
export README_URL=$(Rscript -e "cat(buildtools::find_readme_url('$URL', '$SUBDIR'))")
if [ "$README_URL" ]; then
Expand Down
3 changes: 3 additions & 0 deletions man/buildtools.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d569a8

Please sign in to comment.