Commit 32c2d404 authored by Gradl, Tobias's avatar Gradl, Tobias

Migrating search to Gradle

parent 7915f6c6
Pipeline #13442 failed with stages
in 1 minute and 25 seconds
# ---> Java
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# ---> Eclipse
*.pydevproject
### Eclipse ###
.metadata
.gradle
bin/
tmp/
*.tmp
......@@ -25,9 +9,7 @@ tmp/
local.properties
.settings/
.loadpath
# Eclipse Core
.project
.recommenders
# External tool builders
.externalToolBuilders/
......@@ -35,29 +17,100 @@ local.properties
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
/target/
# STS (Spring Tool Suite)
.springBeans
# Sphinx build
/docs/_build/
/docs/venv/
# Code Recommenders
.recommenders/
.springBeans
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
.sts4-cache/
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Java-Web ###
## ignoring target file
target/
### Gradle ###
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
image: maven:latest
image: java:8-jdk
variables:
MAVEN_CLI_OPTS: "--batch-mode"
GIT_SUBMODULE_STRATEGY: recursive
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
NEXUS_CREDENTIALS: "-Pnexususer=$NEXUS_REPO_USER -Pnexuspass=$NEXUS_REPO_PASS"
before_script:
- VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- ARTIFACT=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
- export GRADLE_USER_HOME=`pwd`/.gradle
- ./gradlew wrapper --gradle-version=5.6.4 --distribution-type=bin
cache:
paths:
- .gradle/wrapper
- .gradle/caches
stages:
- build
- deploy
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS clean compile
script: ./gradlew assemble
test:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test
deploy:
stage: deploy
script:
- |
if [[ $VERSION = *"SNAPSHOT" || $VERSION = *"RELEASE" ]]; then
echo "Building Debian package for $VERSION"
mvn $MAVEN_CLI_OPTS -U -Pdariah.deb -Dmaven.test.failure.ignore package
echo "Building documentation for $ARTIFACT $VERSION"
cd docs
echo "-- Setting up Virtualenv"
virtualenv venv
pwd
. venv/bin/activate
- ./gradlew publish -x test :search-docs:publish $NEXUS_CREDENTIALS
echo "-- Installing requirements"
pip install -r requirements.txt
echo "-- Building HTML version within $(pwd)"
make clean html
echo "-- Creating package"
fpm -t deb -a noarch -s dir --name search-doc \
--description='DARIAH-DE Generic Search Documentation' \
--maintainer='DARIAH-DE <info@de.dariah.eu>' \
--vendor='DARIAH-DE' \
--url='https://search.de.dariah.eu' \
--version $VERSION \
-x ".git**" \
-x "**/.git**" \
-x "**/.hg**" \
-x "**/.svn**" \
-x ".buildinfo" \
-x "**/*.deb" \
--prefix /var/www/doc/search \
-C _build/html .
mv *.deb ../target
~/scripts/push_deb_packages.sh ../target
fi
only:
- master
- mww
\ No newline at end of file
docs:
stage: deploy
script:
- ./gradlew :search-docs:publish $NEXUS_CREDENTIALS
\ No newline at end of file
buildscript {
repositories {
//maven { url 'https://repo.spring.io/plugins-snapshot' }
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
//classpath 'io.spring.gradle:dependency-management-plugin'
classpath 'com.netflix.nebula:gradle-ospackage-plugin'
}
}
plugins {
id 'war'
//id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'maven-publish'
id 'nebula.ospackage' version '8.0.3'
}
allprojects {
group = 'eu.dariah.de.minfba'
version = '3.7.13-SNAPSHOT'
description = 'DARIAH-DE Generic Search'
ext {
mavenRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-central/'
releasesRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-releases/"
snapshotsRepo = "https://minfba.de.dariah.eu/nexus/repository/minfba-snapshots/"
aptRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-apt/'
yumRepo = 'https://minfba.de.dariah.eu/nexus/repository/minfba-yum/'
repoUser = project.hasProperty('nexususer') ? project.getProperty('nexususer') : '?';
repoPass = project.hasProperty('nexuspass') ? project.getProperty('nexuspass') : ''
}
}
repositories {
mavenLocal()
maven {
url = mavenRepo
}
}
sourceCompatibility = '1.8'
ext {
searchCommonsVersion = "1.17.0-SNAPSHOT"
springVersion = "4.3.6.RELEASE"
hibernateValidatorVersion = "5.2.2.Final"
tilesVersion = "3.0.5"
slf4jVersion = "1.7.25"
httpComponentsVersion = "4.5.5"
logbackVersion = "1.2.3"
// Filled dynamically by packaging tasks
debFile = ""
rpmFile = ""
}
dependencies {
implementation "eu.dariah.de.minfba:search-commons:$searchCommonsVersion"
implementation "org.springframework:spring-context:$springVersion"
implementation "org.springframework:spring-beans:$springVersion"
implementation "org.springframework:spring-core:$springVersion"
implementation "org.springframework:spring-webmvc:$springVersion"
implementation "org.springframework:spring-web:$springVersion"
//implementation "org.springframework.security:spring-security-core:4.2.1.RELEASE"
//implementation "org.springframework.security:spring-security-web:4.2.1.RELEASE"
//implementation "org.springframework.security:spring-security-config:4.2.1.RELEASE"
implementation "org.apache.httpcomponents:httpclient:$httpComponentsVersion"
implementation "org.apache.tiles:tiles-core:$tilesVersion"
implementation "org.apache.tiles:tiles-jsp:$tilesVersion"
implementation "org.apache.tiles:tiles-api:$tilesVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"
implementation "javax.servlet:jstl:1.2"
implementation "org.yaml:snakeyaml:1.18"
runtimeOnly "org.slf4j:jcl-over-slf4j:$slf4jVersion"
runtimeOnly "org.slf4j:log4j-over-slf4j:$slf4jVersion"
runtimeOnly "org.apache.logging.log4j:log4j-to-slf4j:2.7"
testImplementation "org.springframework:spring-test:$springVersion"
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-all:1.10.19"
providedCompile "javax.servlet:servlet-api:2.5"
providedCompile "javax.servlet.jsp:jsp-api:2.1"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
tasks.withType(Deb) {
dependsOn(classes)
doLast {
project.debFile = archiveName;
}
}
tasks.withType(Rpm) {
dependsOn(classes)
doLast {
project.rpmFile = archiveName;
}
}
ospackage {
os = LINUX
arch = 'noarch'
packageName "dariah-$project.name"
replaces "$project.name"
maintainer 'info@de.dariah.eu'
requires('openjdk-8-jdk').or('openjdk-11-jdk')
signingKeyId('CB012F105B632B46C2A7B4918FC46DAC1BC3E238')
into "var/dfa/webapps/$project.name/"
from(configurations.runtime) {
into "WEB-INF/lib"
}
from("$buildDir/classes/java/main") {
into "WEB-INF/classes"
}
from ("src/main/resources") {
into "WEB-INF/classes"
}
from ("src/main/webapp/WEB-INF") {
into "WEB-INF"
}
from ("src/main/webapp/resources") {
into "resources"
}
from ("src/main/webapp/themes") {
into "themes"
}
from ("src/main/webapp/META-INF") {
into "META-INF"
}
}
publishing {
publications {
maven(MavenPublication) {
from(components.web)
artifact(sourcesJar) {}
artifact(javadocJar) {}
pom {
name = 'DARIAH-DE Generic Search'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'tgradl'
name = 'Tobias Gradl'
email = 'tobias.gradl@uni-bamberg.de'
}
}
scm {
connection = 'scm:git:git://gitlab.rz.uni-bamberg.de/dariah/search.git'
developerConnection = 'scm:git:ssh://gitlab.rz.uni-bamberg.de/dariah/search.git'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search'
}
issueManagement {
system = 'GitLab'
url = 'https://gitlab.rz.uni-bamberg.de/dariah/search/issues'
}
}
}
}
repositories {
maven {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
credentials {
username repoUser
password repoPass
}
url = version.endsWith('SNAPSHOT') ? snapshotsRepo : releasesRepo
} else {
// Have a local test repo under buildDir to be able to test publish but only actually do publish when the version ending matches
url = "$buildDir/repo/"
}
}
}
}
task publishDebPackage {
dependsOn buildDeb
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Debian package $debFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "-H", "Content-Type: multipart/form-data", "--data-binary", "@$distroPath$debFile", "$aptRepo";
}
}
}
}
task publishRpmPackage {
dependsOn buildRpm
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Rpm package $rpmFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "--upload-file", "$distroPath$rpmFile", "$yumRepo/dariah/${project.name}/${project.version}/$rpmFile";
}
}
}
}
publish.finalizedBy publishDebPackage
publish.finalizedBy publishRpmPackage
\ No newline at end of file
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
/_build/
\ No newline at end of file
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/tgimport.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/tgimport.qhc"
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/tgimport"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/tgimport"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
plugins {
id "kr.motd.sphinx" version "2.6.1"
id "nebula.ospackage"
}
// Apply the 'base' plugin, which adds the 'site' task.
// Note: You do not need to apply the 'base' plugin if you applied
// other plugin that extends 'base', such as 'java'.
apply plugin: 'base'
ext {
// Filled dynamically by packaging tasks
debFile = ""
rpmFile = ""
}
sphinx {
sourceDirectory = "${projectDir}"
outputDirectory = "${project.buildDir}/html"
}
build.dependsOn site
tasks.withType(Deb) {
dependsOn(site)
doLast {
project.debFile = archiveName;
}
}
tasks.withType(Rpm) {
dependsOn(site)
doLast {
project.rpmFile = archiveName;
}
}
ospackage {
os = LINUX
arch = 'noarch'
packageName "dariah-$project.name"
replaces "$project.name"
maintainer 'info@de.dariah.eu'
signingKeyId('CB012F105B632B46C2A7B4918FC46DAC1BC3E238')
from("$buildDir/html") {
into "var/www/doc/dariah-$project.name/"
}
}
task publishDebPackage {
dependsOn buildDeb
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Debian package $debFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "-H", "Content-Type: multipart/form-data", "--data-binary", "@$distroPath$debFile", "$aptRepo";
}
}
}
}
task publishRpmPackage {
dependsOn buildRpm
def distroPath = "$buildDir/distributions/"
doLast {
if (version.endsWith('SNAPSHOT') || version.endsWith('RELEASE')) {
println "Publishing Rpm package $rpmFile as user $repoUser";
exec {
executable "curl"
args "-f", "-u", "$repoUser:$repoPass", "--upload-file", "$distroPath$rpmFile", "$yumRepo/dariah/${project.name}/${project.version}/$rpmFile";
}
}
}
}
task publish {
dependsOn publishDebPackage