Skip to content

Commit

Permalink
Build the source tarball in Jenkins, including docs
Browse files Browse the repository at this point in the history
TODO:
* Also upload the source tarball from here (instead of other jobs).
* Install the documentation if it exists
  • Loading branch information
sjoelund committed Mar 28, 2023
1 parent 92b6780 commit 60777f0
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 5 deletions.
21 changes: 21 additions & 0 deletions Jenkinsfile
Expand Up @@ -530,6 +530,9 @@ pipeline {
sh "mv doc/UsersGuide/build/epub/OpenModelicaUsersGuide.epub OpenModelicaUsersGuide-${common.tagName()}.epub"
archiveArtifacts "OpenModelicaUsersGuide-${common.tagName()}*.*"
stash name: 'usersguide', includes: "OpenModelicaUsersGuide-${common.tagName()}*.*"

sh "make -C doc"
stash name: 'doc-tarball', includes: "doc/openmodelica-doc_*.orig.tar.xz"
}
}

Expand Down Expand Up @@ -795,6 +798,24 @@ pipeline {
sshPublisher(publishers: [sshPublisherDesc(configName: 'OpenModelicaUsersGuide', transfers: [sshTransfer(sourceFiles: "OpenModelicaUsersGuide-${common.tagName()}*,${common.tagName()}/**")])])
}
}
stage('make-source-tarball') {
agent {
docker {
image 'docker.openmodelica.org/build-deps:v1.16.3'
label 'linux'
alwaysPull true
}
}
when {
beforeAgent true
}
steps {
echo "${env.NODE_NAME}"
unstash 'doc-tarball'
sh "make source-dist"
stash name: 'source-dist', includes: "openmodelica_*.orig.tar.xz"
}
}
}
}
stage('publish') {
Expand Down
12 changes: 12 additions & 0 deletions Makefile.in
Expand Up @@ -205,3 +205,15 @@ config.status: configure
./config.status -recheck
configure: configure.ac
autoconf

SOURCE_DIR=openmodelica_@SOURCE_REVISION_NO_PKG@
source-dist:
rm -rf "$(SOURCE_DIR)"
mkdir -p "$(SOURCE_DIR)"
git ls-files --recurse-submodules | tar caf - -T- | tar xC "$(SOURCE_DIR)"
echo "@SOURCE_REVISION_NO_PKG@" > "$(SOURCE_DIR)/REVISION"
echo "OMEdit @SOURCE_REVISION_NO_PKG@" > "$(SOURCE_DIR)/OMEdit/REVISION"
rm -rf "$(SOURCE_DIR)/testsuite" "$(SOURCE_DIR)/libraries" "$(SOURCE_DIR)/doc" "$(SOURCE_DIR)/OMOptim" "$(SOURCE_DIR)/OMSimulator/OMTLMSimulator/CompositeModels" "$(SOURCE_DIR)/OMSimulator/testsuite"
mkdir -p "$(SOURCE_DIR)/doc"
tar xCJf "$(SOURCE_DIR)/doc" doc/openmodelica-doc_@SOURCE_REVISION_NO_PKG@.orig.tar.xz
tar cJf "$(SOURCE_DIR).orig.tar.xz" "$(SOURCE_DIR)"
1 change: 1 addition & 0 deletions common/m4/semver.m4
Expand Up @@ -2,5 +2,6 @@ AC_SUBST(SOURCE_REVISION)

AC_MSG_CHECKING([for revision])
SOURCE_REVISION=`$ac_pwd/common/semver.sh $PACKAGE_NAME`
SOURCE_REVISION_NO_PKG=`$ac_pwd/common/semver.sh`
AC_MSG_RESULT([$SOURCE_REVISION])

4 changes: 2 additions & 2 deletions common/semver.sh
Expand Up @@ -6,8 +6,8 @@ if test -f REVISION; then
elif test "${PWD##*/}" != "OpenModelica" && test -f ../REVISION; then
SOURCE_REVISION="OpenModelica `test -f ../REVISION && head -n1 ../REVISION`"
elif test -z "$SOURCE_REVISION"; then
DESCRIBE_SHORT=`git describe --match "v[0-9]*.[0-9]*.[0-9]*" --always`
DESCRIBE_LONG=`git describe --match "v[0-9]*.[0-9]*.[0-9]*" --always --long`
DESCRIBE_SHORT=`git describe --abbrev=7 --match "v[0-9]*.[0-9]*.[0-9]*" --always`
DESCRIBE_LONG=`git describe --abbrev=7 --match "v[0-9]*.[0-9]*.[0-9]*" --always --long`
if test "$DESCRIBE_SHORT" != "$DESCRIBE_LONG"; then
SOURCE_REVISION="$DESCRIBE_SHORT"
else
Expand Down
35 changes: 35 additions & 0 deletions configure.ac
Expand Up @@ -28,6 +28,41 @@ else
AC_MSG_RESULT([no])
fi

AC_SUBST(SOURCE_REVISION_NO_PKG)
m4_include([common/m4/semver.m4])
SOURCE_REVISION_NO_PKG=`echo $SOURCE_REVISION_NO_PKG | tr - '~' | sed s/^v//`

AC_SUBST(OMLIBRARY_TARGET)
AC_ARG_WITH(omlibrary, [ --with-omlibrary=[core,all,no] (which libraries to build; default is core; the libraries used by the testsuite)],[OMLIBRARY_TARGET="$withval"],[OMLIBRARY_TARGET="core"])

AC_MSG_CHECKING([for omlibrary target])
case "$OMLIBRARY_TARGET" in
"yes"|"core")
OMLIBRARY_TARGET="omlibrary-core"
AC_MSG_RESULT([core])
;;
"no")
OMLIBRARY_TARGET=""
AC_MSG_RESULT([none])
;;
"all")
OMLIBRARY_TARGET="omlibrary-all"
AC_MSG_RESULT([all])
;;
*)
AC_MSG_ERROR("unknown omlibrary target $OMLIBRARY_TARGET")
;;
esac

if test ! -z "$OMLIBRARY_TARGET"; then
AC_MSG_CHECKING([for libraries directory])
if test -f libraries/Makefile; then
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([no])
fi
fi

AC_SUBST(CMAKE_LDFLAGS)
if echo $host | grep -i darwin; then
CMAKE_LDFLAGS="-Wl,-U,libintl_gettext"
Expand Down
6 changes: 3 additions & 3 deletions doc/Makefile
@@ -1,5 +1,5 @@
.PHONY: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft.pdf usersguide cppruntime-doc clean
all: generated_pdfs/dyOptInitialGuess.pdf
all: docs

generated_pdfs/cruntimedraft.pdf:
latexmk -outdir=generated_pdfs -pdf SimulationRuntime/c/src/cruntimedraft.tex
Expand All @@ -14,7 +14,7 @@ usersguide:
BUILDDIR=openmodelica-doc_$(BUILDDIR_VER)

omsiruntime-doc:
mkdir -p SimulationRuntime/omsi/Images
mkdir -p SimulationRuntime/OMSI/Images
cp images/logo.svg SimulationRuntime/OMSI/Images/OMLogo.svg
cd SimulationRuntime/OMSI && cmake -G "Unix Makefiles" -DSOURCE_ROOT=../../../OMCompiler/SimulationRuntime/OMSI && make Docs

Expand Down Expand Up @@ -44,7 +44,7 @@ docs-internal: generated_pdfs/dyOptInitialGuess.pdf generated_pdfs/cruntimedraft

docs:
test -f ../common/semver.sh
$(MAKE) docs-internal BUILDDIR_VER="`cd ../ && ./common/semver.sh | sed -e 's/-dev[.]/~dev-/' -e 's/^v//'`"
$(MAKE) docs-internal BUILDDIR_VER="`cd ../ && ./common/semver.sh | tr - "~" | sed -e 's/^v//'`"

clean:

0 comments on commit 60777f0

Please sign in to comment.