Skip to content
Merged
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
45 changes: 14 additions & 31 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,7 @@ jobs:
#### 2. R package installation (with system and R package dependencies): ####
#############################################################################

## 2a. Cache R packages:
#- name: Query R package dependencies
# run: |
# install.packages('remotes')
# saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
# writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
# shell: Rscript {0}

#- name: Cache R packages
# if: runner.os != 'Windows'
# uses: actions/cache@v3
# with:
# path: ${{ env.R_LIBS_USER }}
# key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
# restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-


## 2b. System dependencies:
## 2a. System dependencies:
- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: |
Expand All @@ -121,16 +104,16 @@ jobs:
if [ -f "$gfortranFile" ] ; then
rm "$gfortranFile"
fi
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.11-config'
rm -f '/usr/local/bin/2to3'
rm -f '/usr/local/bin/2to3-3.11'
rm -f '/usr/local/bin/idle3'
rm -f '/usr/local/bin/idle3.11'
rm -f '/usr/local/bin/pydoc3'
rm -f '/usr/local/bin/pydoc3.11'
rm -f '/usr/local/bin/python3'
rm -f '/usr/local/bin/python3.11'
rm -f '/usr/local/bin/python3-config'
rm -f '/usr/local/bin/python3.11-config'
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK= # This (the value should actually be empty...) prevents Homebrew from re-installing R, which will lead to .Platform$pkgType = "source".
brew install gdal udunits
shell: bash
Expand All @@ -146,14 +129,14 @@ jobs:
shell: bash


## 2c. R packages needed for this yaml script (not related to the Rstox package itself):
## 2b. R packages needed for this yaml script (not related to the Rstox package itself):
- name: Install CRANdependencies
run: |
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "drat"))
shell: Rscript {0}


## 2d. Rstox packages and dependencies (the complicated if condition is needed since the reference to branch name is not consistent across event names). There is the issue that R sorts packge versions alphabetically, while StoX uses semantic versioning. Consequently a pre-release such as 1.2.3-9001 will be considered as newer than the official release 1.2.3 by R. We have solved this by separating the pre-releases and official releases into different repos "unstableRepo" and "testingRepo" for pre-releases and "repo" of official releases). This potentially breaks with remotes::install_deps() as it silently appends the Additional_repositories from the DESCRIPTION file to the repos, but since this would only be a problem if a pre-release is ranked as newer than the official release it will not be a problem when installing dependencies from the "repo" since the Additional_repositories points to that same repo:
## 2c. Rstox packages and dependencies (the complicated if condition is needed since the reference to branch name is not consistent across event names). There is the issue that R sorts packge versions alphabetically, while StoX uses semantic versioning. Consequently a pre-release such as 1.2.3-9001 will be considered as newer than the official release 1.2.3 by R. We have solved this by separating the pre-releases and official releases into different repos "unstableRepo" and "testingRepo" for pre-releases and "repo" of official releases). This potentially breaks with remotes::install_deps() as it silently appends the Additional_repositories from the DESCRIPTION file to the repos, but since this would only be a problem if a pre-release is ranked as newer than the official release it will not be a problem when installing dependencies from the "repo" since the Additional_repositories points to that same repo:
- name: Install R package dependencies from the unstableRepo
if: (github.event_name == 'push' && github.ref_name == 'develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop')
run: |
Expand Down Expand Up @@ -245,7 +228,7 @@ jobs:
shell: Rscript {0}


## 2e. Session info:
## 2d. Session info:
- name: Session info
run: |
options(width = 100)
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- name: Install macOS system dependencies
if: runner.os == 'macOS'
- name: Install MacOS system dependencies
# We are on macOS as per the "runs-on":
#if: runner.os == 'macOS'
run: |
# gfortran may not exist in a period after a new R minor release:
gfortranFile='/usr/local/bin/gfortran'
Expand Down Expand Up @@ -76,5 +77,7 @@ jobs:
run: R CMD INSTALL .

- name: Deploy package
run: pkgdown::deploy_to_branch(new_process = FALSE)
shell: Rscript {0}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RstoxFramework
Version: 4.2.0-9001
Date: 2025-06-20
Version: 4.2.0-9002
Date: 2025-09-03
Title: The Engine of StoX
Authors@R: c(
person(given = "Arne Johannes",
Expand Down Expand Up @@ -51,14 +51,14 @@ Imports:
jsonvalidate (>= 1.3.0),
methods (>= 3.6.0),
ncdf4 (>= 1.18),
RstoxBase (>= 2.1.3),
RstoxData (>= 2.2.0-9001),
RstoxBase (>= 2.2.0-9002),
RstoxData (>= 2.2.0-9002),
scales (>= 1.1.0),
semver (>= 0.2.0),
sf (>= 0.9.0),
stringi (>= 1.4.0)
Suggests:
RstoxFDA (>= 1.2.0),
RstoxFDA (>= 1.7.0-9001),
tinytest (>= 1.2.0)
Additional_repositories:
https://stoxproject.github.io/repo
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# RstoxFramework v4.2.0-9002 (2025-09-01)
* Changed how help pages are generated, from generating the html on the fly using getObjectHelpAsHtml() to instead fetching html from the new RstoxDefinition object named "objectHelp", which is compiled from htmls generated by RstoxBuild for the individual Rstox packages. This saves significant time when moving between processes in the StoX GUI (roughly half the time compared to StoX 4.1.4).
* Renamed UseDefaultTextSettings to UseDefaultLabelSettings in PlotReportBootstrap().


# RstoxFramework v4.2.0-9001 (2025-04-30)
* Added support for writing gpx files from RstoxBase::WriteSurveyPlan().

Expand Down
67 changes: 56 additions & 11 deletions R/Definitions.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ initiateRstoxFramework <- function(){
processDataFunctions <- availableFunctions[sapply(stoxLibrary, "[[", "functionType") == "processData"]


# Get the documentation of every exported object from all Rstox packages as html:
objectHelp <- getObjectHelp(officialStoxLibraryPackagesAll)




# Define the supported backward compatibility actions. The order of the actions is defined here!!!:
backwardCompatibilityActionNames <- c(
Expand Down Expand Up @@ -329,6 +334,13 @@ initiateRstoxFramework <- function(){
modelName = "report",
parameterName = "AggregationFunction",
newParameterName = "ReportFunction"
),
list(
changeVersion = "4.2.0-9002",
functionName = "PlotReportBootstrap",
modelName = "report",
parameterName = "UseDefaultTextSettings",
newParameterName = "UseDefaultLabelSettings"
)
),

Expand Down Expand Up @@ -632,7 +644,8 @@ initiateRstoxFramework <- function(){
#"StoX_shapefile"
"ggplot",
#"BootstrapData",
"StoXNetCDF4File"
"StoXNetCDF4File",
"Ruter"
)

outputTypes <- list(
Expand All @@ -643,14 +656,16 @@ initiateRstoxFramework <- function(){
integer = "table",
logical = "table",
sf = "geojson",
ggplot = "plot"
ggplot = "plot",
Ruter = "table"
)

vectorClasses <- c(
"character",
"numeric",
"integer",
"logical"
"logical",
"Ruter"
)


Expand Down Expand Up @@ -1057,7 +1072,7 @@ orderBackwardCompatibilityOne <- function(x) {
}


# This function gets the stoxFunctionAttributes of the specified packages.
# This function gets the stoxFunctionAttributes and function attributes of the specified packages:
getStoxLibrary <- function(packageNames, requestedFunctionAttributeNames) {

# Validate the pakcages:
Expand Down Expand Up @@ -1102,6 +1117,22 @@ getStoxLibrary <- function(packageNames, requestedFunctionAttributeNames) {
}


# This function gets the help as HTML for every exported object of the specified packages:
getObjectHelp <- function(packageNames) {

# Get a list of the 'stoxFunctionAttributes' from each package:
objectDocumentation <- lapply(packageNames, readFunctionArguments.rds)

# Collapse to one list:
objectDocumentation <- unlist(objectDocumentation, recursive = FALSE)

# Get only the help:
htmlHelp <- lapply(objectDocumentation, "[[", "htmlHelp")

return(htmlHelp)
}


# Define the default process property format:
defaultProcessPropertyFormat <- list(
none = list(
Expand Down Expand Up @@ -1276,10 +1307,13 @@ getBackwardCompatibility <- function(packageName) {


getDefaultOutputFileType <- function(processOutput) {

if(length(processOutput)) {
# Support for class specified in the output of function:
classes <- unique(c(class(processOutput), class(processOutput[[1]])))
classes2 <- class(processOutput[[1]][[1]])

#### Detect classes in the root or first list element:
if("StoXNetCDF4File" %in% classes) {
ext <- "nc"
}
Expand All @@ -1300,35 +1334,46 @@ getDefaultOutputFileType <- function(processOutput) {
# Set file extension:
ext <- "txt"
}
else if("Ruter" %in% classes) {
# Set file extension:
ext <- "txt"
# This is the default, and is changed to the value specified by the user in the process later in reportFunctionOutputOne().
}
else if("matrix" %in% classes || any(getRstoxFrameworkDefinitions("vectorClasses") %in% classes)) {
# Set file extension:
ext <- "csv"
}
else if("ggplot" %in% classes) {
# Set file extension:
ext <- RstoxBase::getRstoxBaseDefinitions("defaultPlotOptions")$defaultPlotFileOptions$Format # "png"
ext <- RstoxBase::getRstoxBaseDefinitions("defaultPlotOptions")$default_general_file_plot_arguments$Format # "png"
# This is the default, and is changed to the value specified by the user in the process later in reportFunctionOutputOne().
}
#### Detect also classes in the recursive list element:
# List of lists of outputs:
else if("sf" %in% class(processOutput[[1]][[1]])) {
else if("sf" %in% classes2) {
# Set file extension:
ext <- "geojson"
}
else if("data.table" %in% class(processOutput[[1]][[1]])) {
else if("data.table" %in% classes2) {
# Set file extension:
ext <- "txt"
}
else if("Ruter" %in% classes2) {
# Set file extension:
ext <- "txt"
# This is the default, and is changed to the value specified by the user in the process later in reportFunctionOutputOne().
}
else if("matrix" %in% class(processOutput[[1]][[1]]) || any(getRstoxFrameworkDefinitions("vectorClasses") %in% class(processOutput[[1]][[1]]))) {
else if("matrix" %in% classes2 || any(getRstoxFrameworkDefinitions("vectorClasses") %in% classes2)) {
# Set file extension:
ext <- "csv"
}
else if("ggplot" %in% class(processOutput[[1]][[1]])) {
else if("ggplot" %in% classes2) {
# Set file extension:
ext <- RstoxBase::getRstoxBaseDefinitions("defaultPlotOptions")$defaultPlotFileOptions$Format # "png"
ext <- RstoxBase::getRstoxBaseDefinitions("defaultPlotOptions")$default_general_file_plot_arguments$Format # "png"
# This is the default, and is changed to the value specified by the user in the process later in reportFunctionOutputOne().
}
else {
stop("Unknown process output: [[1]]: ", classes, ", [[1]][[1]]: ", class(processOutput[[1]][[1]]))
stop("Unknown process output: [[1]]: ", classes, ", [[1]][[1]]: ", classes2)
}
}

Expand Down
Loading
Loading