Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into sk/test-rate-r…
Browse files Browse the repository at this point in the history
…ule-converter-rigorously
  • Loading branch information
skeating committed Dec 15, 2024
2 parents 8cb6215 + 89da8ed commit e11fd97
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 82 deletions.
43 changes: 18 additions & 25 deletions .github/workflows/store-artefact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,47 +276,40 @@ jobs:
package_option: ["-DWITH_ALL_PACKAGES=ON", "-DWITH_STABLE_PACKAGES=ON"]
cpp_standard: [98]
language_bindings:
["-DWITH_JAVA=True -DWITH_PYTHON=True -DWITH_CSHARP=True -DWITH_R=True"]
["-DWITH_JAVA=True -DWITH_PYTHON=True"]
container: ["quay.io/pypa/manylinux_2_28_x86_64"]
runs-on: ${{ matrix.platform }}
container: ${{ matrix.container}}

steps:
- uses: actions/checkout@v4
- name: install Swig 4 from source
run: |
yum install -y pcre-devel
echo "SWIG_DIR=/usr/local/swig/" >> "${GITHUB_ENV}"
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.0.2/swig-4.0.2.tar.gz/download > swig.tar.gz
tar -zxvf swig.tar.gz
cd swig-4.0.2/
./configure --disable-dependency-tracking --prefix=$SWIG_DIR
make clean
make -j 2
make install
swig -version

- name: install CMake using pip
- name: install CMake, ninja and swig using pip
run: |
/opt/python/cp38-cp38/bin/pip install cmake
/opt/python/cp38-cp38/bin/pip install cmake swig ninja
ln -s /opt/python/cp38-cp38/bin/cmake /usr/bin/cmake
ln -s /opt/python/cp38-cp38/bin/ctest /usr/bin/ctest
ln -s /opt/python/cp38-cp38/bin/swig /usr/bin/swig
ln -s /opt/python/cp38-cp38/bin/ninja /usr/bin/ninja
cmake --version
ctest --version
swig -version
ninja --version
- name: Install dependencies, configure, build
run: |
yum install -y libxml2-devel check-devel java-devel mono-devel R
yum install -y libxml2-devel check-devel java-devel
git clone https://github.com/libexpat/libexpat
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DEXPAT_BUILD_TESTS=OFF -DEXPAT_BUILD_TOOLS=OFF -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./dependencies -B libexpat -S libexpat/expat
export DEPENDENCY_DIR=$PWD/dependencies
export INSTALL_DIR=$PWD/install
cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DEXPAT_BUILD_TESTS=OFF -DEXPAT_BUILD_TOOLS=OFF -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=$DEPENDENCY_DIR -B libexpat -S libexpat/expat
cmake --build libexpat
cmake --install libexpat
cd ..
mkdir build
cd build
mkdir ../install
cmake ../libsbml \
-DCMAKE_INSTALL_PREFIX=../install \
cmake ../libsbml -G Ninja \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=${{matrix.cpp_standard}} \
-DWITH_CHECK=True \
Expand All @@ -327,15 +320,14 @@ jobs:
${{matrix.xml_parser_option}} \
${{matrix.package_option}} \
${{matrix.language_bindings}} \
-DWITH_CREATE_R_SOURCE=ON \
-DWITH_SKIP_R_BINARY=ON \
-DPYTHON_EXECUTABLE=/opt/python/cp38-cp38/bin/python \
-DPYTHON_INCLUDE_DIR=/opt/python/cp38-cp38/include/python3.8/ \
-DWITH_STATIC_RUNTIME=ON \
-DLIBSBML_DEPENDENCY_DIR=$DEPENDENCY_DIR \
-DEXPAT_LIBRARY=$DEPENDENCY_DIR/lib64/libexpat.a \
-DEXPAT_INCLUDE_DIR=$DEPENDENCY_DIR/include \
-DPYTHON_USE_DYNAMIC_LOOKUP=ON
cmake --build . --config $BUILD_TYPE
# mkdir r-binaries
# R CMD INSTALL -l r-binaries --build ./src/bindings/r/out/libSBML_5.19.3.tar.gz
- name: Test
run: |
Expand Down Expand Up @@ -369,4 +361,5 @@ jobs:
name:
Manylinux nightly (zip, libSBML ${{env.LIBSBML_VERSION}},
${{env.ARTIFACT_NAME_SUFFIX}})-${{ strategy.job-index }}
path: ../install
path:
install/
4 changes: 3 additions & 1 deletion src/sbml/SBMLTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ SBMLTransforms::clearComponentValues(const Model* m)
}

// otherwise remove only specific set
mModelValues.erase(m);
if (!mModelValues.empty()) {
mModelValues.erase(m);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,8 @@ ListOfGlobalRenderInformation::getAllElements(ElementFilter* filter)
{
List* ret = new List();
List* sublist = ListOf::getAllElements(filter);
ret->transferFrom(sublist);
delete sublist;

ADD_FILTERED_POINTER(ret, sublist, mDefaultValues, filter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,8 @@ ListOfLocalRenderInformation::getAllElements(ElementFilter* filter)
{
List* ret = new List();
List* sublist = ListOf::getAllElements(filter);
ret->transferFrom(sublist);
delete sublist;

ADD_FILTERED_POINTER(ret, sublist, mDefaultValues, filter);

Expand Down
2 changes: 1 addition & 1 deletion src/sbml/packages/render/sbml/RenderCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ RenderCurve::createObject(XMLInputStream& stream)

const std::string& name = stream.peek().getName();

if (name == "listOfCurveElements")
if (name == "listOfCurveElements" || name == "listOfElements")
{
if (mRenderPoints.size() != 0 && getErrorLog() != NULL)
{
Expand Down
2 changes: 2 additions & 0 deletions src/sbml/packages/render/sbml/Style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ Style::createGroup()

delete renderns;
this->setGroup(g);
delete g;

connectToChild();

Expand Down Expand Up @@ -1280,6 +1281,7 @@ Style::createObject(XMLInputStream& stream)
RenderGroup* g = new RenderGroup(renderns);
g->setElementName(name);
setGroup(g);
delete g;
obj = &mGroup;
}

Expand Down
117 changes: 62 additions & 55 deletions src/sbml/packages/render/sbml/Transformation2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,65 +714,72 @@ Transformation2D::addExpectedAttributes(ExpectedAttributes& attributes)
*/
void
Transformation2D::readAttributes(const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes)
{
unsigned int level = getLevel();
unsigned int version = getVersion();
unsigned int pkgVersion = getPackageVersion();
unsigned int numErrs;
SBMLErrorLog* log = getErrorLog();

if (log && getParentSBMLObject() &&
static_cast<ListOfDrawables*>(getParentSBMLObject())->size() < 2)
{
numErrs = log->getNumErrors();
for (int n = numErrs-1; n >= 0; n--)
{
if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownPackageAttribute);
log->logPackageError("render", RenderUnknown, pkgVersion, level,
version, details, getLine(), getColumn());
}
else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownCoreAttribute);
log->logPackageError("render", RenderUnknown, pkgVersion, level,
version, details, getLine(), getColumn());
}
const ExpectedAttributes& expectedAttributes)
{
unsigned int level = getLevel();
unsigned int version = getVersion();
unsigned int pkgVersion = getPackageVersion();
unsigned int numErrs;
SBMLErrorLog* log = getErrorLog();

if (log && getParentSBMLObject()) {
bool isSizeOne = false;
int type = getParentSBMLObject()->getTypeCode();
switch (type) {
case SBML_LIST_OF:
if (static_cast<ListOf*>(getParentSBMLObject())->size() < 2)
{
isSizeOne = true;
}
break;
case SBML_RENDER_LINEENDING:
case SBML_RENDER_STYLE_BASE:
case SBML_RENDER_LOCALSTYLE:
case SBML_RENDER_GLOBALSTYLE:
// These objects all have a single RenderGroup child, so the size can never be greater than 2.
isSizeOne = true;
break;
case SBML_RENDER_GROUP:
{
//A RenderGroup can have multiple Transformation2D children.
RenderGroup* rg = static_cast<RenderGroup*>(getParentSBMLObject());
if (rg->getNumElements() < 2)
{
isSizeOne = false;
}
break;
}
default:
assert(false); //Some situation we didn't think through; could be anything.
isSizeOne = true;
}
if (isSizeOne) {
numErrs = log->getNumErrors();
for (int n = numErrs - 1; n >= 0; n--)
{
if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownPackageAttribute);
log->logPackageError("render", RenderUnknown, pkgVersion, level,
version, details, getLine(), getColumn());
}
else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
{
const std::string details = log->getError(n)->getMessage();
log->remove(UnknownCoreAttribute);
log->logPackageError("render", RenderUnknown, pkgVersion, level,
version, details, getLine(), getColumn());
}
}
}
}
}

Transformation::readAttributes(attributes, expectedAttributes);

//if (log)
//{
// numErrs = log->getNumErrors();

// for (int n = numErrs-1; n >= 0; n--)
// {
// if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
// {
// const std::string details = log->getError(n)->getMessage();
// log->remove(UnknownPackageAttribute);
// log->logPackageError("render", RenderUnknown, pkgVersion, level,
// version, details);
// }
// else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
// {
// const std::string details = log->getError(n)->getMessage();
// log->remove(UnknownCoreAttribute);
// log->logPackageError("render",
// RenderTransformation2DAllowedCoreAttributes, pkgVersion, level,
// version, details);
// }
// }
//}
Transformation::readAttributes(attributes, expectedAttributes);

std::string s;
attributes.readInto("transform", s);
if(!s.empty())
if (!s.empty())
{
this->parseTransformation(s);
}
Expand Down
Loading

0 comments on commit e11fd97

Please sign in to comment.