diff --git a/.bazelrc b/.bazelrc deleted file mode 100644 index 1a96c97aa3..0000000000 --- a/.bazelrc +++ /dev/null @@ -1,7 +0,0 @@ -build --disk_cache=~/.bazel_disk_cache -build --strategy=Scalac=worker -build --worker_sandboxing -build --workspace_status_command=tools/buildstamp/get_workspace_status --stamp=yes -startup --host_jvm_args=-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts \ - --host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit -test --test_output=errors --local_test_jobs=1 --runs_per_test 1 diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index fae6e3d04b..0000000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -4.2.1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8248082506..aedd59c19f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,11 +28,6 @@ jobs: with: format: YYYY-MM-DD utcOffset: "+02:00" - - name: use daily bazel disk cache - uses: actions/cache@v2 - with: - path: ~/.bazel_disk_cache - key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }} - name: setup java version uses: joschi/setup-jdk@v2 with: @@ -75,11 +70,6 @@ jobs: with: format: YYYY-MM-DD utcOffset: "+02:00" - - name: use daily bazel disk cache - uses: actions/cache@v2 - with: - path: ~/.bazel_disk_cache - key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }} - name: setup java version uses: joschi/setup-jdk@v2 with: @@ -121,11 +111,6 @@ jobs: with: format: YYYY-MM-DD utcOffset: "+02:00" - - name: use daily bazel disk cache - uses: actions/cache@v2 - with: - path: ~/.bazel_disk_cache - key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }} - name: setup java version uses: joschi/setup-jdk@v2 with: @@ -221,11 +206,6 @@ jobs: with: format: YYYY-MM-DD utcOffset: "+02:00" - - name: use daily bazel disk cache - uses: actions/cache@v2 - with: - path: ~/.bazel_disk_cache - key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }} - name: setup java version uses: joschi/setup-jdk@v2 with: diff --git a/.gitignore b/.gitignore index 23ffe63140..cd2f7b4c4a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ webapi-it webapi-test upgrade/project sipi/test -bazel-* **/project/target/ **/target/ diff --git a/BUILD.bazel b/BUILD.bazel deleted file mode 100644 index d00332adca..0000000000 --- a/BUILD.bazel +++ /dev/null @@ -1,7 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") - -buildifier( - name = "buildifier", -) diff --git a/Makefile b/Makefile index 16181707e8..dc05763536 100644 --- a/Makefile +++ b/Makefile @@ -34,53 +34,33 @@ docs-clean: ## cleans the project directory @rm -rf site/ ################################# -# Bazel targets +# Docker targets ################################# .PHONY: build build: docker-build ## build all targets (excluding docs) -.PHOBY: check-for-outdated-deps -check-for-outdated-deps: ## check for outdated maven dependencies - @bazel run @maven//:outdated - -.PHONY: buildifier -buildifier: ## format Bazel WORKSPACE and BUILD.bazel files - @bazel run :buildifier - -################################# -# Docker targets -################################# - -.PHONY: docker-build-knora-api-image -docker-build-knora-api-image: # build and publish knora-api docker image locally +.PHONY: docker-build-dsp-api-image +docker-build-dsp-api-image: # build and publish dsp-api docker image locally @sbt "webapi / Docker / publishLocal" -.PHONY: docker-publish-knora-api-image -docker-publish-knora-api-image: # publish knora-api image to Dockerhub - @bazel run //docker/knora-api:push - -.PHONY: docker-build-knora-jena-fuseki-image -docker-build-knora-jena-fuseki-image: # build and publish knora-jena-fuseki docker image locally - @bazel run //docker/knora-jena-fuseki:image +.PHONY: docker-publish-dsp-api-image +docker-publish-dsp-api-image: # publish dsp-api image to Dockerhub + @sbt "webapi / Docker / publish" -.PHONY: docker-publish-knora-jena-fuseki-image -docker-publish-knora-jena-fuseki-image: # publish knora-jena-fuseki image to Dockerhub - @bazel run //docker/knora-jena-fuseki:push +.PHONY: docker-build-sipi-image +docker-build-sipi-image: # build and publish sipi docker image locally + @sbt "sipi / Docker / publishLocal" -.PHONY: docker-build-knora-sipi-image -docker-build-knora-sipi-image: # build and publish knora-sipi docker image locally - @bazel run --action_env=PULLER_TIMEOUT=2400 //docker/knora-sipi:image - -.PHONY: docker-publish-knora-sipi-image -docker-publish-knora-sipi-image: # publish knora-sipi image to Dockerhub - @bazel run //docker/knora-sipi:push +.PHONY: docker-publish-sipi-image +docker-publish-sipi-image: # publish sipi image to Dockerhub + @sbt "sipi / Docker / publish" .PHONY: docker-build -docker-build: docker-build-knora-api-image docker-build-knora-jena-fuseki-image docker-build-knora-sipi-image ## build and publish all Docker images locally +docker-build: docker-build-dsp-api-image docker-build-sipi-image ## build and publish all Docker images locally .PHONY: docker-publish -docker-publish: docker-publish-knora-api-image docker-publish-knora-jena-fuseki-image docker-publish-knora-sipi-image ## publish all Docker images to Dockerhub +docker-publish: docker-publish-dsp-api-image docker-publish-sipi-image ## publish all Docker images to Dockerhub ################################# ## Docker-Compose targets @@ -188,7 +168,7 @@ stack-without-api-and-sipi: stack-up ## starts the knora-stack without knora-api @docker compose -f docker-compose.yml stop sipi .PHONY: stack-db-only -stack-db-only: env-file docker-build-knora-jena-fuseki-image ## starts only fuseki. +stack-db-only: env-file ## starts only fuseki. @docker compose -f docker-compose.yml up -d db $(CURRENT_DIR)/webapi/scripts/wait-for-db.sh @@ -196,10 +176,6 @@ stack-db-only: env-file docker-build-knora-jena-fuseki-image ## starts only fus ## Test Targets ################################# -.PHONY: test-docker -test-docker: docker-build ## runs Docker image tests - bazel test //docker/... - .PHONY: client-test-data client-test-data: export KNORA_WEBAPI_COLLECT_CLIENT_TEST_DATA := true client-test-data: build ## runs the dsp-api e2e tests and generates client test data. @@ -301,7 +277,6 @@ clean-local-tmp: clean: docs-clean clean-local-tmp clean-docker ## clean build artifacts @rm -rf .env - @bazel clean .PHONY: clean-sipi-tmp clean-sipi-tmp: ## deletes all files in Sipi's tmp folder diff --git a/README.md b/README.md index f130c521c9..4a741dbe58 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ Each developer machine should have the following prerequisites installed: * Homebrew (on macOS): https://brew.sh * [OpenJDK](https://adoptopenjdk.net) 11 * [sbt](https://www.scala-sbt.org/) -* [Bazel](https://bazel.build) #### Java Adoptopenjdk 11 @@ -71,19 +70,6 @@ To pin the version of Java, please add this environment variable to you startup export JAVA_HOME=`/usr/libexec/java_home -v 11` ``` -#### Bazel build tools - -To install, follow these steps: - -```shell -npm install -g @bazel/bazelisk -``` - -This will install [bazelisk](https://github.com/bazelbuild/bazelisk) which is -a wrapper to the `bazel` binary. It will, when `bazel` is run on the command line, -automatically install the supported Bazel version, defined in the `.bazelversion` -file in the root of the `knora-api` repository. - ### For building the documentation See [docs/Readme.md](docs/Readme.md). @@ -92,9 +78,7 @@ See [docs/Readme.md](docs/Readme.md). ### Run the Knora API server -With [Bazel](https://docs.bazel.build/versions/3.3.0/install-os-x.html) and -[Docker](https://www.docker.com) installed, run the following to create a test -repository and load some test data into the triplestore: +Run the following to create a test repository and load some test data into the triplestore: ```shell make init-db-test diff --git a/RELEASING.md b/RELEASING.md deleted file mode 100644 index cf7a617987..0000000000 --- a/RELEASING.md +++ /dev/null @@ -1,38 +0,0 @@ -## Releasing - - 1. (optional) Run `GenerateContributorsFile`, passing it a GitHub API token - (`bazel run //webapi:GenerateContributorsFile -- [ -t TOKEN ]`), to generate - `Contributors.md`, then commit that file. The file can be found under: - `/bazel-bin/webapi/GenerateContributorsFile.runfiles/io_dasch_knora_api/Contributors.md` - 1. (optional) Push and merge PR to `main`. - 1. Github CI will start a [CI build](https://github.com/dasch-swiss/knora-api/actions) for the new tag and publish - artifacts to Docker Hub. - 1. On Github - Tag the commit with the version string, e.g., `vX.X.X` and create a release. - 1. Run [gren](https://github.com/github-tools/github-release-notes) (see the instruction at the end) - 1. Publish documentation. - --> in general, releases should be cut at least once per month and on the last working day of the month. --> before a major release, create a minor one if not already present. - -## Installing and running 'gren' - -``` -$ npm install github-release-notes -g -``` - -Generate a GitHub token, with repo scope, at this link. Then add this line to `~/.bash_profile` (or `~/.zshrc`) - -``` -export GREN_GITHUB_TOKEN=your_token_here -``` - -To generate the release notes for the latest release, go to Github and make a release by giving it a tag in the form of `vX.X.X`. - -Then: - -```bash -# Navigate to your project directory -cd ~/Path/to/repo -# Run the task -gren release --override --milestone-match="xxxx-xx" -``` \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index 937be1d496..0000000000 --- a/WORKSPACE +++ /dev/null @@ -1,153 +0,0 @@ -workspace(name = "io_dasch_dsp_api") - -# load http_archive method -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -##################################### -# Skylib # -##################################### -# 1.0.2 released 2019.10.09 (https://github.com/bazelbuild/bazel-skylib/releases/tag/1.0.2) -skylib_version = "1.0.2" - -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - type = "tar.gz", - url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), -) - -##################################### -# Buildifier # -##################################### -# buildifier is written in Go and hence needs rules_go to be built. -# See https://github.com/bazelbuild/rules_go for the up to date setup instructions. -http_archive( - name = "io_bazel_rules_go", - sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip", - ], -) - -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") - -go_rules_dependencies() - -go_register_toolchains(version = "1.17.6") - -http_archive( - name = "bazel_gazelle", - sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", - ], -) - -# bazel buildtools providing buildifier -http_archive( - name = "com_github_bazelbuild_buildtools", - strip_prefix = "buildtools-master", - url = "https://github.com/bazelbuild/buildtools/archive/master.zip", -) - -##################################### -# Docker # -##################################### - -rules_docker_version = "0.22.0" # 06.12.2021 - -rules_docker_version_sha256 = "59536e6ae64359b716ba9c46c39183403b01eabfbd57578e84398b4829ca499a" - -http_archive( - name = "io_bazel_rules_docker", - sha256 = rules_docker_version_sha256, - strip_prefix = "rules_docker-%s" % rules_docker_version, - url = "https://github.com/bazelbuild/rules_docker/releases/download/v%s/rules_docker-v%s.tar.gz" % (rules_docker_version, rules_docker_version), -) - -load( - "@io_bazel_rules_docker//repositories:repositories.bzl", - container_repositories = "repositories", -) - -container_repositories() - -load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps") - -container_deps() - -# load container_pull method -load( - "@io_bazel_rules_docker//container:container.bzl", - "container_pull", -) - -# get openjdk -container_pull( - name = "openjdk11_amd64", - digest = "sha256:967349ef166d630bceda0370507b096edd6e7220e62e4539db70f04c04c2295f", # 7.01.2022 - registry = "docker.io", - repository = "eclipse-temurin", - # tag = "11-jre-focal", # Ubuntu 20.04 -) - -container_pull( - name = "openjdk11_arm64", - digest = "sha256:e46fac3005d08732931de9671864683f6adf3a3eb0f8a7e8ac27d1bff1955a5c", # 7.01.2022 - registry = "docker.io", - repository = "eclipse-temurin", - # tag = "11-jre-focal", # Ubuntu 20.04 -) - -# get sipi -load("//third_party:versions.bzl", "FUSEKI_IMAGE_DIGEST_AMD64", "FUSEKI_IMAGE_DIGEST_ARM64", "FUSEKI_REPOSITORY", "SIPI_IMAGE_DIGEST", "SIPI_REPOSITORY") - -container_pull( - name = "sipi", - digest = SIPI_IMAGE_DIGEST, - registry = "docker.io", - repository = SIPI_REPOSITORY, -) - -container_pull( - name = "jenafuseki_amd64", - digest = FUSEKI_IMAGE_DIGEST_AMD64, - registry = "docker.io", - repository = FUSEKI_REPOSITORY, -) - -container_pull( - name = "jenafuseki_arm64", - digest = FUSEKI_IMAGE_DIGEST_ARM64, - registry = "docker.io", - repository = FUSEKI_REPOSITORY, -) - -##################################### -# rules_pkg - basic packaging rules # -##################################### -rules_package_version = "0.2.4" - -rules_package_version_sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a" - -http_archive( - name = "rules_pkg", - sha256 = rules_package_version_sha256, - url = "https://github.com/bazelbuild/rules_pkg/releases/download/%s/rules_pkg-%s.tar.gz" % (rules_package_version, rules_package_version), -) - -load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") - -rules_pkg_dependencies() - -##################################### -# rules_stamp - stamping helper # -##################################### -http_archive( - name = "ecosia_rules_stamp", - sha256 = "36d7ea381bfb2520f9353299b162434b25c77365d3c9e9459195c536da5e837d", - strip_prefix = "rules_stamp-48d5ef2bc0d93bd65fddddbe02f3ae410e25169d", - url = "https://github.com/ecosia/rules_stamp/archive/48d5ef2bc0d93bd65fddddbe02f3ae410e25169d.tar.gz", -) diff --git a/build.sbt b/build.sbt index 92c75fb8ee..6700c194bb 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,12 @@ +import rapture.core.booleanRepresentations.trueFalse import com.typesafe.sbt.SbtNativePackager.autoImport.NativePackagerHelper._ import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport.{Docker, dockerRepository} import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd} import org.knora.Dependencies + +import sbt._ import sbt.Keys.version +import sbt.librarymanagement.Resolver import scala.language.postfixOps import scala.sys.process.Process @@ -11,6 +15,8 @@ import scala.sys.process.Process // GLOBAL SETTINGS ////////////////////////////////////// +lazy val aggregatedProjects: Seq[ProjectReference] = Seq(webapi, sipi) + lazy val buildSettings = Seq( organization := "org.knora", version := (ThisBuild / version).value @@ -38,23 +44,48 @@ lazy val root: Project = Project(id = "root", file(".")) // use Ctrl-c to stop current task but not quit SBT Global / cancelable := true, publish / skip := true - // Dependencies.sysProps := sys.props.toString(), - // Dependencies.sysEnvs := sys.env.toString(), - // dockerImageCreationTask := Seq( - // (salsah1 / Docker / publishLocal).value, - // (webapi / Docker / publishLocal).value - // (knoraJenaFuseki / Docker / publishLocal).value, - // (knoraSipi / Docker / publishLocal).value - //) ) ////////////////////////////////////// -// WEBAPI (./webapi) +// DSP's custom SIPI ////////////////////////////////////// -import com.typesafe.sbt.SbtNativePackager.autoImport.NativePackagerHelper._ -import sbt._ -import sbt.librarymanagement.Resolver +lazy val sipi: Project = Project(id = "sipi", base = file("sipi")) + .enablePlugins(DockerPlugin) + .settings( + Compile / packageDoc / mappings := Seq(), + Compile / packageSrc / mappings := Seq(), + Docker / dockerRepository := Some("daschswiss"), + Docker / packageName := "knora-sipi", + dockerUpdateLatest := true, + dockerBaseImage := Dependencies.sipiImage, + Docker / maintainer := "support@dasch.swiss", + Docker / dockerExposedPorts ++= Seq(1024), + Docker / defaultLinuxInstallLocation := "/sipi", + Universal / mappings ++= { + // copy the sipi/scripts folder + directory("sipi/scripts") + }, + // use filterNot to return all items that do NOT meet the criteria + dockerCommands := dockerCommands.value.filterNot { + + // ExecCmd is a case class, and args is a varargs variable, so you need to bind it with @ + // remove ENTRYPOINT + case ExecCmd("ENTRYPOINT", args @ _*) => true + + // remove CMD + case ExecCmd("CMD", args @ _*) => true + + case Cmd("USER", args @ _*) => true + + // don't filter the rest; don't filter out anything that doesn't match a pattern + case cmd => false + } + ) + +////////////////////////////////////// +// WEBAPI (./webapi) +////////////////////////////////////// run / connectInput := true @@ -89,17 +120,10 @@ lazy val webapi: Project = Project(id = "webapi", base = file("webapi")) (rootBaseDir.value / "knora-ontologies" / "salsah-gui.ttl") -> "knora-ontologies/salsah-gui.ttl", (rootBaseDir.value / "knora-ontologies" / "standoff-data.ttl") -> "knora-ontologies/standoff-data.ttl", (rootBaseDir.value / "knora-ontologies" / "standoff-onto.ttl") -> "knora-ontologies/standoff-onto.ttl", - (rootBaseDir.value / "webapi" / "scripts" / "fuseki-knora-test-repository-config.ttl") -> "webapi/scripts/fuseki-knora-test-repository-config.ttl", - (rootBaseDir.value / "webapi" / "scripts" / "fuseki-knora-test-unit-repository-config.ttl") -> "webapi/scripts/fuseki-knora-test-unit-repository-config.ttl", - (rootBaseDir.value / "webapi" / "scripts" / "fuseki-repository-config.ttl.template") -> "webapi/scripts/fuseki-repository-config.ttl.template" + (rootBaseDir.value / "webapi" / "scripts" / "fuseki-repository-config.ttl.template") -> "webapi/scripts/fuseki-repository-config.ttl.template" // needed for initialization of triplestore ), - // contentOf("salsah1/src/main/resources").toMap.mapValues("config/" + _) - // (rootBaseDir.value / "knora-ontologies") -> "knora-ontologies", - // put additional files into the jar when running tests which are needed by testcontainers Test / packageBin / mappings ++= Seq( - (rootBaseDir.value / "sipi" / "config" / "sipi.init-knora.lua") -> "sipi/config/sipi.init-knora.lua", - (rootBaseDir.value / "sipi" / "config" / "sipi.knora-docker-config.lua") -> "sipi/config/sipi.knora-docker-config.lua", (rootBaseDir.value / "sipi" / "config" / "sipi.knora-docker-config.lua") -> "sipi/config/sipi.knora-docker-config.lua" ) ) @@ -132,6 +156,7 @@ lazy val webapi: Project = Project(id = "webapi", base = file("webapi")) // Skip packageDoc and packageSrc task on stage Compile / packageDoc / mappings := Seq(), Compile / packageSrc / mappings := Seq(), + // define folders inside container Universal / mappings ++= { // copy the scripts folder directory("webapi/scripts") ++ @@ -152,7 +177,15 @@ lazy val webapi: Project = Project(id = "webapi", base = file("webapi")) dockerBaseImage := "eclipse-temurin:11-jre-focal", Docker / maintainer := "support@dasch.swiss", Docker / dockerExposedPorts ++= Seq(3333), - Docker / defaultLinuxInstallLocation := "/opt/docker" + Docker / defaultLinuxInstallLocation := "/opt/docker", + // use filterNot to return all items that do NOT meet the criteria + dockerCommands := dockerCommands.value.filterNot { + // Remove USER command + case Cmd("USER", args @ _*) => true + + // don't filter the rest; don't filter out anything that doesn't match a pattern + case cmd => false + } ) .settings( buildInfoKeys ++= Seq[BuildInfoKey]( @@ -189,7 +222,6 @@ lazy val webapiJavaTestOptions = Seq( //"-XX:MaxMetaspaceSize=4096m" ) - lazy val apiMain = project .in(file("dsp-api-main")) .settings( @@ -199,7 +231,6 @@ lazy val apiMain = project ) .dependsOn(schemaCore, schemaRepo, schemaApi) - lazy val schemaApi = project .in(file("dsp-schema-api")) .settings( diff --git a/docker-compose.yml b/docker-compose.yml index 06aa495ae6..3df7a14509 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.7' services: db: - image: bazel/docker/knora-jena-fuseki:image + image: daschswiss/apache-jena-fuseki:2.0.8 # should be the same version as in Dependencies.scala ports: - "3030:3030" volumes: @@ -16,7 +16,8 @@ services: - JVM_ARGS=-Xmx3G sipi: - image: bazel/docker/knora-sipi:image + image: daschswiss/knora-sipi:latest + ports: - "1024:1024" volumes: diff --git a/docker/knora-jena-fuseki/BUILD.bazel b/docker/knora-jena-fuseki/BUILD.bazel deleted file mode 100644 index 857499dcfa..0000000000 --- a/docker/knora-jena-fuseki/BUILD.bazel +++ /dev/null @@ -1,34 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push") - -# builds the docker image -container_image( - name = "image", - base = select({ - "@platforms//cpu:arm64": "@jenafuseki_arm64//image", - "//conditions:default": "@jenafuseki_amd64//image", - }), - labels = { - "MAINTAINER": "400790+subotic@users.noreply.github.com", - }, - ports = ["3030/tcp"], -) - -# push to dockerhub -container_push( - name = "push", - format = "Docker", - image = ":image", - registry = "index.docker.io", - repository = "daschswiss/knora-jena-fuseki", - tag = "{BUILD_SCM_TAG}", -) - -# use in targets needing an up-to-date docker image locally -#genrule( -# name = "build", -# srcs = [":image"], -# cmd = "docker load -i $(location //docker/knora-jena-fuseki:image) >$@", -# outs = ["build-output.txt"] -#) diff --git a/docker/knora-sipi/BUILD.bazel b/docker/knora-sipi/BUILD.bazel deleted file mode 100644 index a5e0618039..0000000000 --- a/docker/knora-sipi/BUILD.bazel +++ /dev/null @@ -1,41 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push") -load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") - -container_image( - name = "image", - base = "@sipi//image", - env = {}, - labels = { - "MAINTAINER": "400790+subotic@users.noreply.github.com", - }, - ports = ["1024/tcp"], - tars = [ - "//sipi/scripts:sipi-scripts", - ], -) - -container_push( - name = "push", - format = "Docker", - image = ":image", - registry = "index.docker.io", - repository = "daschswiss/knora-sipi", - tag = "{BUILD_SCM_TAG}", -) - -# use in targets needing an up-to-date docker image locally -#genrule( -# name = "build", -# srcs = [":image"], -# cmd = "docker load -i $(location //docker/knora-sipi:image) >$@", -# outs = ["build-output.txt"], -#) - -# for documentation of yaml, please see https://github.com/GoogleContainerTools/container-structure-test -container_test( - name = "sipi_image_test", - configs = ["sipi_image_test_config.yaml"], - image = ":image", -) diff --git a/docker/knora-sipi/sipi_image_test_config.yaml b/docker/knora-sipi/sipi_image_test_config.yaml deleted file mode 100644 index d4f64afe59..0000000000 --- a/docker/knora-sipi/sipi_image_test_config.yaml +++ /dev/null @@ -1,24 +0,0 @@ -schemaVersion: 2.0.0 - -metadataTest: - entrypoint: ['/sipi/sipi'] - cmd: [ - '--config=/sipi/config/sipi.config.lua' - ] - -fileExistenceTests: -- name: 'sipi.binary' - path: '/sipi/sipi' - shouldExist: true - -- name: 'sipi.config.lua' - path: '/sipi/config/sipi.config.lua' - shouldExist: true - -- name: 'sipi.init.lua' - path: '/sipi/config/sipi.init.lua' - shouldExist: true - -- name: 'test.html' - path: '/sipi/server/test.html' - shouldExist: true diff --git a/docs/05-internals/development/bazel.md b/docs/05-internals/development/bazel.md deleted file mode 100644 index 15119589cb..0000000000 --- a/docs/05-internals/development/bazel.md +++ /dev/null @@ -1,116 +0,0 @@ -# Bazel - -The following section discusses on how to build and run tests for Knora-API -with [Bazel](https://bazel.build). - -## Prerequisites -To install the Bazel build tool, follow these steps: - -``` -$ npm install -g @bazel/bazelisk -``` - -This will install [bazelisk](https://github.com/bazelbuild/bazelisk) which is -a wrapper to the `bazel` binary. It will, when the `bazel` command ir run, -automatically install the supported Bazel version, defined in the `.bazelversion` -file in the root of the `knora-api` repository. - -## Commands - -Build `webapi`: - -``` -# build webapi -$ bazel build //webapi/... - -# run all webapi tests -$ bazel test //webapi//... -``` - -## Build Structure - -The Bazel build is defined in a number of files: - - WORKSPACE - here are external dependencies defined - - BUILD - there are a number of BUILD files throughout the directory structure - where each represents a separate package responsible for everything underneath. - - *.bzl - custom extensions loaded and used in BUILD files - -For a more detailed discussion, please see the [Concepts and Terminology](https://docs.bazel.build/versions/master/build-ref.html) -section in the Bazel documentation. - -## Some Notes - -1. Override some `.bazelrc` settings in your own copy created at `~/.bazelrc`: - ``` - build --action_env=PATH="/usr/local/bin:/opt/local/bin:/usr/bin:/bin" - build --strategy=Scalac=worker - build --worker_sandboxing - query --package_path %workspace%:/usr/local/bin/bazel/base_workspace - startup --host_jvm_args=-Djavax.net.ssl.trustStore=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/security/cacerts \ - --host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit - ``` - -1. Add Bazel Plugin and Project to IntelliJ - 1. The latest version of the [Bazel plugin](https://plugins.jetbrains.com/plugin/8609-bazel/versions) - supports only IntelliJ upto version `2019.03.05`. After you make sure to - run this version of IntelliJ, install the plugin from inside IntelliJ. - 1. Click on `File -> Import Bazel Project` and select twice `next`. - 1. Uncomment the `Scala` language and click `Finish`. - -1. Run single spec: - ```bash - $ bazel test //webapi/src/test/scala/org/knora/webapi/e2e/v1:SearchV1R2RSpec - ``` - -1. Run single spec and only tests containing `gaga` in the description - ```bash - $ bazel test //webapi/src/test/scala/org/knora/webapi/e2e/v1:SearchV1R2RSpec --test_arg=-z --test_arg="gaga" - ``` - -1. Start Scala REPL - ```bash - $ bazel run //webapi:main_library_repl - ``` - -## Build stamping - -By default, Bazel tries not to include anything about the system state in build -outputs. However, released binaries and libraries often want to include -something like the version they were built at or the branch or tag they came -from. - -To reconcile this, Bazel has an option called the *workspace status command*. -This command is run outside of any sandboxes on the local machine, so it can -access anything about your source control, OS, or anything else you might want -to include. It then dumps its output into `bazel-out/volatile-status.txt`, which -you can use (and certain language rulesets provide support for accessing from code). - -Our *workspace status command* is defined in `//tools/buildstamp/get_workspace_status`. -To use it on every bazel command, we need to supply it to each Bazel invocation, -which is done by the following line found in `.bazelrc`: -``` -build --workspace_status_command=tools/buildstamp/get_workspace_status --stamp=yes -``` - -Any line added to `.bazelrc` is invoked on each corresponding command. - -The `//tools/buildstamp/get_workspace_status` emits additional values -to `bazel-out/volatile-status.txt` whereas `BUILD_TIMESTAMP` is emitted by -Bazel itself: - -``` -BUILD_SCM_REVISION 2d6df6c8fe2d56e3712eb26763f9727916a60164 -BUILD_SCM_STATUS Modified -BUILD_SCM_TAG v13.0.0-rc.21-17-g2d6df6c-dirty -BUILD_TIMESTAMP 1604401028 -``` - -The value of `BUILD_SCM_TAG` is used in `//webapi/src/main/scala/org/knora/webapi/http/version/versioninfo`, -which emits a JAR containing `VersionInfo.scala`. This file is generated based on -`VersionInfoTemplate.scala` found in the same Bazel package. - -In short, the `versioninfo` target producing the JAR library depends on -the `version_info_with_build_tag` target which emits the `VersionInfo.scala` -file which has the `{BUILD_TAG}` variable replaced by the current value of -`BUILD_SCM_TAG`. In an intermediary step, the `version_info_without_build_tag` -target, replaces variables coming from `//third_party:versions.bzl`. diff --git a/docs/05-internals/development/building-and-running.md b/docs/05-internals/development/building-and-running.md index 092b3c5e7b..37f558ee81 100644 --- a/docs/05-internals/development/building-and-running.md +++ b/docs/05-internals/development/building-and-running.md @@ -111,28 +111,11 @@ To run all test targets, use the following in the command line: $ make test ``` -To run only the dsp-api integration tests, use - -``` -$ make test-it -``` -To run only the dsp-api unit tests, use - -``` -$ make test-unit -``` - -Lastly, to run all dsp-api test, use - -``` -$ make test-webapi -``` - -As explained in the [bazel document](bazel.md), to run a single test from the command line, for example `SearchV1R2RSpec`, +To run a single test from the command line, for example `SearchV1R2RSpec`, run the following: ```bash - $ bazel test //webapi/src/test/scala/org/knora/webapi/e2e/v1:SearchV1R2RSpec + $ sbt " webapi / testOnly *SearchV1R2RSpec* " ``` _**Note:** to run tests, the api container must be stopped first!_ diff --git a/docs/05-internals/development/figures/import-bazel-project.png b/docs/05-internals/development/figures/import-bazel-project.png deleted file mode 100644 index 875db2ec72..0000000000 Binary files a/docs/05-internals/development/figures/import-bazel-project.png and /dev/null differ diff --git a/docs/05-internals/development/intellij-config.md b/docs/05-internals/development/intellij-config.md index c62691b083..ab470088e2 100644 --- a/docs/05-internals/development/intellij-config.md +++ b/docs/05-internals/development/intellij-config.md @@ -3,38 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 --> -# Setup IntelliJ for development of Knora - -## Create an IntelliJ Project for Knora - - - Download and install a version of [IntelliJ IDEA](https://www.jetbrains.com/idea/) that [supports Bazel](https://plugins.jetbrains.com/plugin/8609-bazel/versions), eg. version `2019.03.05`. - - Follow the installation procedure and install the `Scala plugin` - -![screenshot 'Install Scala Plugin'](figures/install-scala-plugin.png) - - - Add Bazel Plugin: run InteliJ and install the plugin from inside IntelliJ. - - Create a project for Knora: restart InteliJ and create a project for Knora using `Import Bazel Project` option. - - ![screenshot 'Import Project'](figures/import-bazel-project.png) - - - Make sure that the Bazel `Workspace` points to the path of Knora and click `next`. - - ![screenshot 'Workspace'](figures/bazel-workspace.png) - - - Select the `Generate from BUILD file` option and give the path to the main `BUILD.bazel` file of Knora, click `next`. - - ![screenshot 'Bazel build'](figures/bazel-buildFile.png) - - - Uncomment the `Scala` language and click `Finish`. - - ![screenshot 'Bazel Scala'](figures/bazel-UncommentScala.png) - - At this point a `.ijwb` file is created for Knora project and added to the welcome screen of InteiJ. You can open the project by clicking on it. - - - Once the project is built and opened in InteliJ, make sure that project in synced with Bazel build files by clicking - on Bazel logo `Sync Project with Build Files`. This needs to be repeated every time there is a change in a `BUILD.bazel` file. - - ![screenshot 'Bazel sync'](figures/bazel-sync.png) +# Setup IntelliJ for development of DSP-API + +TODO add "Setup VS Code for development of DSP-API" + +## Create an IntelliJ Project for DSP-API + +TODO ## Setup IntelliJ Code Formatter @@ -47,43 +22,7 @@ In IntelliJ editor setting (`Preferences -> Editor -> Code Style -> Scala`), cho ## Use IntelliJ IDEA's Run/Debugger Configuration with Knora -First, you need to create an application configuration to run or debug a code. Here the configuration is explained using a test as an - example, but similarly the application configuration of InteliJ can be used for building the webapi. - -To run a specific test in a command line using Bazel, you would need to give the path of the test relative to its - package as defined in the `BUILD.bazel` of the package. For example, to run the test `GravsearchTypeInspectorSpec` in the - command line, you would need to enter `bazel test //webapi/src/test/scala/org/knora/webapi/messages/util/search:GravsearchTypeInspectorSpec`. - Now to run or debug the same test and its underlying code in InteliJ, a new configuration should be - set up: - - - Click on the 'Add Configuration' to create a new application configuration. - -![screenshot 'new_configuration'](figures/bazel-new-config.png) - - - Click on the `+` and choose `Bazel Command` - -![screenshot 'new_configuration'](figures/bazel-command-config.png) - - - Give the type of the command, i.e. `test` and the path parameter, as shown below. Then press `Apply`, and finish - the configuration by pressing `OK`. - -![screenshot 'configuration_setup'](figures/bazel-config-setup.png) - -After the configuration is completed, it will appear in a drop-down menu that shows all available configurations. - - - To run a configured command, eg. to run the test `GravsearchTypeInspectorSpec`, - 1. choose its configuration from the drop-down menu - 2. click on the `Run` symbol, the results will appear in the a `Run` window. Note that, before running the test, the - docker container of api should be stopped. - -![screenshot 'configuration_run'](figures/bazel-run-config.png) - - - To debug the code for example by executing a test: - 1. Click on a line-number to add a breakpoint. - 2. Choose the respective configuration from the drop-down menu. - 3. Click on the debugging symbol to start the application with a debugger attached, as shown below: - -![screenshot 'debug'](figures/bazel-debug.png) +TODO ## Profile Knora Using VisualVM in IntelliJ diff --git a/docs/05-internals/development/third-party.md b/docs/05-internals/development/third-party.md index 7fdf5de58d..7a85e81489 100644 --- a/docs/05-internals/development/third-party.md +++ b/docs/05-internals/development/third-party.md @@ -6,35 +6,7 @@ Third-party dependencies are defined in the `third_party` folder. There are two main types of dependencies: (1) Maven library dependencies and (2) Docker image versions. -## Maven Library Dependencies - -The Maven library dependencies are defined in the `third_party/dependencies.bzl` -file. To use the external libraries, add the "flattened" Bazel version of it to -the Bazel rule used to compile the code. - -Example of a "flattened" Bazel version looks as follows: - -- defined: `com.typesafe.akka:akka-actor_2.12:2.6.5` -- flattened: `@maven//:com_typesafe_akka_akka_actor_2_12` - -To query Bazel for all defined Maven dependencies: `bazel query @maven//:all | sort` - -### Manually Fetching Dependencies - -The Maven dependencies can be manually fetched with: -```bash -$ bazel fetch @maven//... -``` - -If there are any problems downloading the Maven dependencies, set the -`RJE_VERBOSE` environment variable to true to print `coursier`'s verbose output: -```bash -$ RJE_VERBOSE=true bazel fetch @maven//... -``` - -Note: If you are on macOS Big Sur and have the Cisco VPN client installed, -make sure that the packet filters are not active, or they may be a problem -downloading the dependencies. +TODO add documentation for Dependencies.scala ## Docker Image Versions diff --git a/knora-ontologies/BUILD b/knora-ontologies/BUILD deleted file mode 100644 index de243213f6..0000000000 --- a/knora-ontologies/BUILD +++ /dev/null @@ -1,20 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") - -filegroup( - name = "knora-ontologies", - srcs = [ - "knora-admin.ttl", - "knora-base.ttl", - "salsah-gui.ttl", - "standoff-data.ttl", - "standoff-onto.ttl", - ], -) - -pkg_tar( - name = "tar", - srcs = [":knora-ontologies"], - package_dir = "knora-ontologies", -) diff --git a/mkdocs.yml b/mkdocs.yml index fc3ba747e1..005b756bf9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -108,7 +108,6 @@ nav: - Overview: 05-internals/development/overview.md - Build and Running: 05-internals/development/building-and-running.md - Setup IntelliJ for development of DSP-API: 05-internals/development/intellij-config.md - - Bazel Notes: 05-internals/development/bazel.md - Testing: 05-internals/development/testing.md - Docker Cheat Sheet: 05-internals/development/docker-cheat-sheet.md - Monitoring DSP-API: 05-internals/development/monitoring.md diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e35066cc84..c15c3c9627 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,242 +10,246 @@ import sbt.{Def, _} object Dependencies { - val scalaVersion = "2.13.7" - val akkaVersion = "2.6.18" - val akkaHttpVersion = "10.2.8" - val jenaVersion = "4.4.0" - val metricsVersion = "4.0.1" - val sipiImage = "daschswiss/sipi:v3.3.4" - val fusekiImage = "daschswiss/apache-jena-fuseki:2.0.8" - - val ZioVersion = "2.0.0-RC2" - val ZioHttpVersion = "2.0.0-RC3" - val ZioJsonVersion = "0.3.0-RC3" - val ZioConfigVersion = "3.0.0-RC2" - val ZioSchemaVersion = "0.2.0-RC1-1" - val ZioLoggingVersion = "2.0.0-RC5" - val ZioZmxVersion = "2.0.0-M1" - val ZioPreludeVersion = "1.0.0-RC10" - - object Compile { - - // ZIO - val zio = "dev.zio" %% "zio" % ZioVersion - val zioHttp = "io.d11" %% "zhttp" % ZioHttpVersion - val zioJson = "dev.zio" %% "zio-json" % ZioJsonVersion - val zioPrelude = "dev.zio" %% "zio-prelude" % ZioPreludeVersion - val zioTest = "dev.zio" %% "zio-test" % ZioVersion % Test - val zioTestSbt = "dev.zio" %% "zio-test-sbt" % ZioVersion % Test - - // akka - val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion - val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion - val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion - val akkaProtobufV3 = "com.typesafe.akka" %% "akka-protobuf-v3" % akkaVersion - - // akka http - val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion - val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion - val akkaHttpSprayJson = "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion - val akkaHttpJacksonJava = "com.typesafe.akka" %% "akka-http-jackson" % akkaHttpVersion - - val typesafeConfig = "com.typesafe" % "config" % "1.3.3" - - //CORS support - val akkaHttpCors = "ch.megard" %% "akka-http-cors" % "1.0.0" - - // jena - val jenaLibs = "org.apache.jena" % "apache-jena-libs" % jenaVersion - val jenaText = "org.apache.jena" % "jena-text" % jenaVersion - - // logging - val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4" - val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.10" - - // Metrics - val kamonCore = "io.kamon" %% "kamon-core" % "2.1.5" - val kamonScalaFuture = "io.kamon" %% "kamon-scala-future" % "2.1.5" - val kamonAkkaHttpd = "io.kamon" %% "kamon-akka-http" % "2.1.5" - val kamonPrometheus = "io.kamon" %% "kamon-prometheus" % "2.1.5" - val kamonLogback = "io.kamon" %% "kamon-logback" % "2.1.5" - val aspectJWeaver = "org.aspectj" % "aspectjweaver" % "1.9.4" - - // input validation - val commonsValidator = "commons-validator" % "commons-validator" % "1.6" exclude("commons-logging", "commons-logging") - - // authentication - val bcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.64" - val springSecurityCore = "org.springframework.security" % "spring-security-core" % "5.1.5.RELEASE" exclude("commons-logging", "commons-logging") exclude("org.springframework", "spring-aop") - val jwtSprayJson = "com.pauldijou" %% "jwt-spray-json" % "5.0.0" - - // caching - val ehcache = "net.sf.ehcache" % "ehcache" % "2.10.9.2" - val jedis = "redis.clients" % "jedis" % "3.1.0-m4" - // serialization - val chill = "com.twitter" %% "chill" % "0.9.5" - - // other - //"javax.transaction" % "transaction-api" % "1.1-rev-1", - val commonsText = "org.apache.commons" % "commons-text" % "1.6" - val commonsIo = "commons-io" % "commons-io" % "2.6" - val commonsBeanUtil = "commons-beanutils" % "commons-beanutils" % "1.9.3" exclude("commons-logging", "commons-logging") // not used by us, but need newest version to prevent this problem: http://stackoverflow.com/questions/14402745/duplicate-classes-in-commons-collections-and-commons-beanutils - val jodd = "org.jodd" % "jodd" % "3.2.6" - val jodaTime = "joda-time" % "joda-time" % "2.9.1" - val jodaConvert = "org.joda" % "joda-convert" % "1.8" - val diff = "com.sksamuel.diff" % "diff" % "1.1.11" - val xmlunitCore = "org.xmlunit" % "xmlunit-core" % "2.1.1" - - // other - val rdf4jClient = "org.eclipse.rdf4j" % "rdf4j-client" % "3.4.4" - val rdf4jRuntime = "org.eclipse.rdf4j" % "rdf4j-runtime" % "3.4.4" - val rdf4jStorage = "org.eclipse.rdf4j" % "rdf4j-storage" % "3.4.4" - val scallop = "org.rogach" %% "scallop" % "3.5.1" - val gwtServlet = "com.google.gwt" % "gwt-servlet" % "2.8.0" - val saxonHE = "net.sf.saxon" % "Saxon-HE" % "9.9.0-2" - - val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.2.0" - - // provides akka jackson (json) support - val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % "1.36.0" - val jacksonScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3" - - // swagger (api documentation) - val swaggerAkkaHttp = "com.github.swagger-akka-http" %% "swagger-akka-http" % "1.6.0" - - // Java EE modules which are deprecated in Java SE 9, 10 and will be removed in Java SE 11 - val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.2.12" - - val icu4j = "com.ibm.icu" % "icu4j" % "62.1" - - val apacheHttpClient = "org.apache.httpcomponents" % "httpclient" % "4.5.6" exclude("commons-logging", "commons-logging") - - // Graph for Scala "org.scala-graph:graph-core_2.13:1.13.1", - val scalaGraph = "org.scala-graph" %% "graph-core" % "1.13.1" - - // missing from current BAZEL setup - // "ch.qos.logback:logback-core:1.2.9", - val logbackCore = "ch.qos.logback" % "logback-core" % "1.2.9" - // "org.slf4j:log4j-over-slf4j:1.7.32", - val log4jOverSlf4j = "org.slf4j" % "log4j-over-slf4j" % "1.7.32" - // "org.slf4j:jcl-over-slf4j:1.7.32", - val jclOverSlf4j = "org.slf4j" % "jcl-over-slf4j" % "1.7.32" - // "org.slf4j:slf4j-api:1.7.32", - val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.32" - // "com.apicatalog:titanium-json-ld:1.2.0", - val titaniumJSONLD = "com.apicatalog" % "titanium-json-ld" % "1.2.0" - // "org.glassfish:jakarta.json:2.0.1", - val jakartaJSON = "org.glassfish" % "jakarta.json" % "2.0.1" - // "com.typesafe.play:twirl-api_2.13:1.5.1", - val twirlApi = "com.typesafe.play" %% "twirl-api" % "1.5.1" - // "junit:junit:4.13.2", - val junit = "junit" % "junit" % "4.13.2" - // "org.seleniumhq.selenium:selenium-support:3.141.59", - val seleniumSupport = "org.seleniumhq.selenium" % "selenium-support" % "3.141.59" - } - - object WebapiTest { - val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test" - val akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % "test" - val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "test" - val scalaTest = "org.scalatest" %% "scalatest" % "3.2.2" % "test" - val gatlingHighcharts = "io.gatling.highcharts" % "gatling-charts-highcharts"% "3.7.5" % "test" - val gatlingTestFramework = "io.gatling" % "gatling-test-framework" % "3.2.1" % "test" - val testcontainers = "org.testcontainers" % "testcontainers" % "1.16.0" % "test" - } - - object TestBinaries { - val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion - val akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion - val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion - val scalaTest = "org.scalatest" %% "scalatest" % "3.2.2" - val gatlingHighcharts = "io.gatling.highcharts" % "gatling-charts-highcharts"% "3.7.5" - val gatlingTestFramework = "io.gatling" % "gatling-test-framework" % "3.2.1" - } - - import Compile._ - - val l = libraryDependencies - - val webapiLibraryDependencies = l ++= Seq[sbt.ModuleID]( - akkaActor, - akkaHttp, - akkaHttpCirce, - akkaHttpCors, - akkaHttpJacksonJava, - akkaHttpSprayJson, - akkaHttpXml, - akkaProtobufV3, - akkaSlf4j, - akkaStream, - apacheHttpClient, - bcprov, - chill, - commonsBeanUtil, - commonsIo, - commonsText, - commonsValidator, - diff, - ehcache, - gwtServlet, - icu4j, - jacksonScala, - jaxbApi, - jedis, - jenaLibs, - jenaText, - jodaConvert, - jodaTime, - jodd, - jwtSprayJson, - kamonCore, - kamonLogback, - kamonPrometheus, - kamonScalaFuture, - logbackCore, - logbackClassic, - rdf4jClient, - rdf4jRuntime, - rdf4jStorage, - saxonHE, - scalaGraph, - scalaLogging, - scalaXml, - scallop, - springSecurityCore, - swaggerAkkaHttp, - titaniumJSONLD, - typesafeConfig, - WebapiTest.akkaHttpTestkit, - WebapiTest.akkaStreamTestkit, - WebapiTest.akkaTestkit, - WebapiTest.gatlingHighcharts, - WebapiTest.gatlingTestFramework, - WebapiTest.scalaTest, - WebapiTest.testcontainers, - xmlunitCore, - zio, - zioHttp, - zioJson, - zioPrelude, - zioTest, - zioTestSbt, - log4jOverSlf4j, - jclOverSlf4j, - slf4jApi, - jakartaJSON, - twirlApi, - junit, - seleniumSupport - ) - - val upgradeLibraryDependencies = l ++= Seq[sbt.ModuleID]( - rdf4jRuntime, - scallop - ) - - val webapiTestAndITLibraryDependencies = l ++= Seq[sbt.ModuleID]( - TestBinaries.gatlingHighcharts, - TestBinaries.gatlingTestFramework, - TestBinaries.scalaTest - ) + val scalaVersion = "2.13.7" + val akkaVersion = "2.6.18" + val akkaHttpVersion = "10.2.8" + val jenaVersion = "4.4.0" + val metricsVersion = "4.0.1" + val sipiImage = "daschswiss/sipi:3.3.4" // base image the knora-sipi image is created from + val fusekiImage = "daschswiss/apache-jena-fuseki:2.0.8" // should be the same version as in docker-compose.yml + + val ZioVersion = "2.0.0-RC2" + val ZioHttpVersion = "2.0.0-RC3" + val ZioJsonVersion = "0.3.0-RC3" + val ZioConfigVersion = "3.0.0-RC2" + val ZioSchemaVersion = "0.2.0-RC1-1" + val ZioLoggingVersion = "2.0.0-RC5" + val ZioZmxVersion = "2.0.0-M1" + val ZioPreludeVersion = "1.0.0-RC10" + + object Compile { + + // ZIO + val zio = "dev.zio" %% "zio" % ZioVersion + val zioHttp = "io.d11" %% "zhttp" % ZioHttpVersion + val zioJson = "dev.zio" %% "zio-json" % ZioJsonVersion + val zioPrelude = "dev.zio" %% "zio-prelude" % ZioPreludeVersion + val zioTest = "dev.zio" %% "zio-test" % ZioVersion % Test + val zioTestSbt = "dev.zio" %% "zio-test-sbt" % ZioVersion % Test + + // akka + val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion + val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion + val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion + val akkaProtobufV3 = "com.typesafe.akka" %% "akka-protobuf-v3" % akkaVersion + + // akka http + val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion + val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion + val akkaHttpSprayJson = "com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion + val akkaHttpJacksonJava = "com.typesafe.akka" %% "akka-http-jackson" % akkaHttpVersion + + val typesafeConfig = "com.typesafe" % "config" % "1.3.3" + + //CORS support + val akkaHttpCors = "ch.megard" %% "akka-http-cors" % "1.0.0" + + // jena + val jenaLibs = "org.apache.jena" % "apache-jena-libs" % jenaVersion + val jenaText = "org.apache.jena" % "jena-text" % jenaVersion + + // logging + val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4" + val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.10" + + // Metrics + val kamonCore = "io.kamon" %% "kamon-core" % "2.1.5" + val kamonScalaFuture = "io.kamon" %% "kamon-scala-future" % "2.1.5" + val kamonAkkaHttpd = "io.kamon" %% "kamon-akka-http" % "2.1.5" + val kamonPrometheus = "io.kamon" %% "kamon-prometheus" % "2.1.5" + val kamonLogback = "io.kamon" %% "kamon-logback" % "2.1.5" + val aspectJWeaver = "org.aspectj" % "aspectjweaver" % "1.9.4" + + // input validation + val commonsValidator = + "commons-validator" % "commons-validator" % "1.6" exclude ("commons-logging", "commons-logging") + + // authentication + val bcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.64" + val springSecurityCore = + "org.springframework.security" % "spring-security-core" % "5.1.5.RELEASE" exclude ("commons-logging", "commons-logging") exclude ("org.springframework", "spring-aop") + val jwtSprayJson = "com.pauldijou" %% "jwt-spray-json" % "5.0.0" + + // caching + val ehcache = "net.sf.ehcache" % "ehcache" % "2.10.9.2" + val jedis = "redis.clients" % "jedis" % "3.1.0-m4" + // serialization + val chill = "com.twitter" %% "chill" % "0.9.5" + + // other + //"javax.transaction" % "transaction-api" % "1.1-rev-1", + val commonsText = "org.apache.commons" % "commons-text" % "1.6" + val commonsIo = "commons-io" % "commons-io" % "2.6" + val commonsBeanUtil = + "commons-beanutils" % "commons-beanutils" % "1.9.3" exclude ("commons-logging", "commons-logging") // not used by us, but need newest version to prevent this problem: http://stackoverflow.com/questions/14402745/duplicate-classes-in-commons-collections-and-commons-beanutils + val jodd = "org.jodd" % "jodd" % "3.2.6" + val jodaTime = "joda-time" % "joda-time" % "2.9.1" + val jodaConvert = "org.joda" % "joda-convert" % "1.8" + val diff = "com.sksamuel.diff" % "diff" % "1.1.11" + val xmlunitCore = "org.xmlunit" % "xmlunit-core" % "2.1.1" + + // other + val rdf4jClient = "org.eclipse.rdf4j" % "rdf4j-client" % "3.4.4" + val rdf4jRuntime = "org.eclipse.rdf4j" % "rdf4j-runtime" % "3.4.4" + val rdf4jStorage = "org.eclipse.rdf4j" % "rdf4j-storage" % "3.4.4" + val scallop = "org.rogach" %% "scallop" % "3.5.1" + val gwtServlet = "com.google.gwt" % "gwt-servlet" % "2.8.0" + val saxonHE = "net.sf.saxon" % "Saxon-HE" % "9.9.0-2" + + val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.2.0" + + // provides akka jackson (json) support + val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % "1.36.0" + val jacksonScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3" + + // swagger (api documentation) + val swaggerAkkaHttp = "com.github.swagger-akka-http" %% "swagger-akka-http" % "1.6.0" + + // Java EE modules which are deprecated in Java SE 9, 10 and will be removed in Java SE 11 + val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.2.12" + + val icu4j = "com.ibm.icu" % "icu4j" % "62.1" + + val apacheHttpClient = + "org.apache.httpcomponents" % "httpclient" % "4.5.6" exclude ("commons-logging", "commons-logging") + + // Graph for Scala "org.scala-graph:graph-core_2.13:1.13.1", + val scalaGraph = "org.scala-graph" %% "graph-core" % "1.13.1" + + // missing from current BAZEL setup + // "ch.qos.logback:logback-core:1.2.9", + val logbackCore = "ch.qos.logback" % "logback-core" % "1.2.9" + // "org.slf4j:log4j-over-slf4j:1.7.32", + val log4jOverSlf4j = "org.slf4j" % "log4j-over-slf4j" % "1.7.32" + // "org.slf4j:jcl-over-slf4j:1.7.32", + val jclOverSlf4j = "org.slf4j" % "jcl-over-slf4j" % "1.7.32" + // "org.slf4j:slf4j-api:1.7.32", + val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.32" + // "com.apicatalog:titanium-json-ld:1.2.0", + val titaniumJSONLD = "com.apicatalog" % "titanium-json-ld" % "1.2.0" + // "org.glassfish:jakarta.json:2.0.1", + val jakartaJSON = "org.glassfish" % "jakarta.json" % "2.0.1" + // "com.typesafe.play:twirl-api_2.13:1.5.1", + val twirlApi = "com.typesafe.play" %% "twirl-api" % "1.5.1" + // "junit:junit:4.13.2", + val junit = "junit" % "junit" % "4.13.2" + // "org.seleniumhq.selenium:selenium-support:3.141.59", + val seleniumSupport = "org.seleniumhq.selenium" % "selenium-support" % "3.141.59" + } + + object WebapiTest { + val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test" + val akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % "test" + val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "test" + val scalaTest = "org.scalatest" %% "scalatest" % "3.2.2" % "test" + val gatlingHighcharts = "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.7.5" % "test" + val gatlingTestFramework = "io.gatling" % "gatling-test-framework" % "3.2.1" % "test" + val testcontainers = "org.testcontainers" % "testcontainers" % "1.16.0" % "test" + } + + object TestBinaries { + val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion + val akkaStreamTestkit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion + val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion + val scalaTest = "org.scalatest" %% "scalatest" % "3.2.2" + val gatlingHighcharts = "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.7.5" + val gatlingTestFramework = "io.gatling" % "gatling-test-framework" % "3.2.1" + } + + import Compile._ + + val l = libraryDependencies + + val webapiLibraryDependencies = l ++= Seq[sbt.ModuleID]( + akkaActor, + akkaHttp, + akkaHttpCirce, + akkaHttpCors, + akkaHttpJacksonJava, + akkaHttpSprayJson, + akkaHttpXml, + akkaProtobufV3, + akkaSlf4j, + akkaStream, + apacheHttpClient, + bcprov, + chill, + commonsBeanUtil, + commonsIo, + commonsText, + commonsValidator, + diff, + ehcache, + gwtServlet, + icu4j, + jacksonScala, + jaxbApi, + jedis, + jenaLibs, + jenaText, + jodaConvert, + jodaTime, + jodd, + jwtSprayJson, + kamonCore, + kamonLogback, + kamonPrometheus, + kamonScalaFuture, + logbackCore, + logbackClassic, + rdf4jClient, + rdf4jRuntime, + rdf4jStorage, + saxonHE, + scalaGraph, + scalaLogging, + scalaXml, + scallop, + springSecurityCore, + swaggerAkkaHttp, + titaniumJSONLD, + typesafeConfig, + WebapiTest.akkaHttpTestkit, + WebapiTest.akkaStreamTestkit, + WebapiTest.akkaTestkit, + WebapiTest.gatlingHighcharts, + WebapiTest.gatlingTestFramework, + WebapiTest.scalaTest, + WebapiTest.testcontainers, + xmlunitCore, + zio, + zioHttp, + zioJson, + zioPrelude, + zioTest, + zioTestSbt, + log4jOverSlf4j, + jclOverSlf4j, + slf4jApi, + jakartaJSON, + twirlApi, + junit, + seleniumSupport + ) + + val upgradeLibraryDependencies = l ++= Seq[sbt.ModuleID]( + rdf4jRuntime, + scallop + ) + + val webapiTestAndITLibraryDependencies = l ++= Seq[sbt.ModuleID]( + TestBinaries.gatlingHighcharts, + TestBinaries.gatlingTestFramework, + TestBinaries.scalaTest + ) } diff --git a/sipi/Makefile b/sipi/Makefile deleted file mode 100644 index b0809f1fb1..0000000000 --- a/sipi/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../vars.mk - -.PHONY: print-env-file -print-env-file: env-file ## prints the env file used by sipi - @cat .env - -.PHONY: env-file -env-file: ## write the env file used by sipi - @echo DOCKERHOST=$(DOCKERHOST) > .env - -.PHONY: up -up: env-file ## start sipi - docker-compose up -d sipi - -.PHONY: logs -logs: env-file ## follow logs - docker-compose logs -f sipi - -.PHONY: down -down: env-file ## stop sipi - docker-compose down - -.PHONY: help -help: ## this help - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort - -.DEFAULT_GOAL := help diff --git a/sipi/README.md b/sipi/README.md deleted file mode 100644 index add1dfd426..0000000000 --- a/sipi/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Knora Specific Sipi Scripts and Configurations - -This directory holds Knora specific scripts and configurations for [Sipi](https://github.com/dhlab-basel/Sipi). - -## Usage - -### With Docker - -To start Sipi using Docker (with config for integration tests), run from inside this folder: - -``` -$ make up -$ make down // for cleanup -``` - -### Using a Locally-Compiled Sipi - -Type the following in this directory, assuming that the Sipi source tree is in -`../../Sipi` and the Sipi binary is in the build folder under `../../Sipi/build/sipi`: - -``` -$ ../../Sipi/build/sipi --config config/sipi.knora-local-config.lua -``` - -### Starting Sipi with `no-auth` configuration - -The `no-auth` configuration omits authorization callbacks to Knora, thus allowing to serve images for -which there is no corresponding resource inside Knora. - -``` -$ export DOCKERHOST=LOCAL_IP_ADDRESS -$ docker image rm --force daschswiss/sipi:main // deletes cached image and needs only to be used when newer image is available on dockerhub -$ docker-compose up sipi-no-auth -$ docker-compose down // for cleanup -``` - -where `LOCAL_IP_ADDRESS` is the IP of the host running the `Knora-Service`. \ No newline at end of file diff --git a/sipi/config/BUILD.bazel b/sipi/config/BUILD.bazel deleted file mode 100644 index 02ef9a1651..0000000000 --- a/sipi/config/BUILD.bazel +++ /dev/null @@ -1,11 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "config", - srcs = [ - "sipi.knora-docker-config.lua", - "sipi.knora-docker-no-auth-config.lua", - "sipi.knora-docker-test-config.lua", - "sipi.knora-local-config.lua", - ], -) diff --git a/sipi/docker-compose.yml b/sipi/docker-compose.yml deleted file mode 100644 index 55b59ac146..0000000000 --- a/sipi/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '3' - -services: - # sipi using default (production-like) configuration with additional routes for testing - sipi: - image: bazel/docker/knora-sipi:image - container_name: sipi - ports: - - "1024:1024" - volumes: - - $PWD/config:/sipi/config - - $PWD/scripts:/sipi/scripts - - /tmp:/tmp - - $HOME:$HOME - - $PWD/images:/sipi/images - - $PWD/server:/sipi/server - extra_hosts: - - api:${DOCKERHOST} - restart: unless-stopped - environment: - - SIPI_EXTERNAL_PROTOCOL=http - - SIPI_EXTERNAL_HOSTNAME=0.0.0.0 - - SIPI_EXTERNAL_PORT=1024 - command: --config=/sipi/config/sipi.knora-docker-config.lua - - # sipi using configuration which disables authentication - sipi-no-auth: - image: bazel/docker/knora-sipi:image - container_name: sipi-no-auth - ports: - - "1024:1024" - volumes: - - $PWD/config:/sipi/config - - $PWD/scripts:/sipi/scripts - - /tmp:/tmp - - $HOME:$HOME - - $PWD/images:/sipi/images - - $PWD/server:/sipi/server - extra_hosts: - - api:${DOCKERHOST} - restart: unless-stopped - environment: - - SIPI_EXTERNAL_PROTOCOL=http - - SIPI_EXTERNAL_HOSTNAME=0.0.0.0 - - SIPI_EXTERNAL_PORT=1024 - command: --config=/sipi/config/sipi.knora-docker-no-auth-config.lua diff --git a/sipi/scripts/BUILD.bazel b/sipi/scripts/BUILD.bazel deleted file mode 100644 index 10d414589e..0000000000 --- a/sipi/scripts/BUILD.bazel +++ /dev/null @@ -1,36 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") - -filegroup( - name = "scripts", - srcs = [ - "admin_upload.lua", - "cache.lua", - "clean_temp_dir.lua", - "debug.lua", - "delete_temp_file.lua", - "exit.lua", - "file_info.lua", - "get_knora_session.lua", - "jwt.lua", - "send_response.lua", - "sipi.init-knora.lua", - "sipi.init-knora-no-auth.lua", - "sipi.init-knora-test.lua", - "store.lua", - "test1.lua", - "test2.lua", - "test_file_info.lua", - "test_functions.lua", - "test_knora_session_cookie.lua", - "upload.lua", - "util.lua", - ], -) - -pkg_tar( - name = "sipi-scripts", - srcs = [":scripts"], - package_dir = "/sipi/scripts", -) diff --git a/test_data/BUILD.bazel b/test_data/BUILD.bazel deleted file mode 100644 index c5aa1c105b..0000000000 --- a/test_data/BUILD.bazel +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "test_data", - srcs = glob(["**"]), -) diff --git a/test_data/upgrade/BUILD.bazel b/test_data/upgrade/BUILD.bazel deleted file mode 100644 index d2d7311255..0000000000 --- a/test_data/upgrade/BUILD.bazel +++ /dev/null @@ -1,14 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "upgrade", - srcs = [ - "pr1307.trig", - "pr1322.trig", - "pr1367.trig", - "pr1372.trig", - "pr1615.trig", - "pr1746.trig", - "pr1921.trig", - ], -) diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/third_party/versions.bzl b/third_party/versions.bzl deleted file mode 100644 index 2dd28e18fb..0000000000 --- a/third_party/versions.bzl +++ /dev/null @@ -1,17 +0,0 @@ -"""Primary location for setting Knora-API project wide versions""" - -SCALA_VERSION = "2.13.7" -AKKA_VERSION = "2.6.17" -AKKA_HTTP_VERSION = "10.2.4" -JENA_VERSION = "4.4.0" -METRICS_VERSION = "4.0.1" - -# SIPI - digest takes precedence! -SIPI_REPOSITORY = "daschswiss/sipi" -SIPI_IMAGE_DIGEST = "sha256:235afabf427d4e8619d10f3858ab63b6c26809ef27184f69951e098f005faa02" # 3.3.4 - -# Jena Fuseki - digest takes precedence! -FUSEKI_REPOSITORY = "daschswiss/apache-jena-fuseki" -FUSEKI_VERSION = "2.0.8" # contains Fuseki 4.4.0 (with log4j 2.17.1) -FUSEKI_IMAGE_DIGEST_AMD64 = "sha256:41e9d9608bea994f308edde27114f05f861f60c458bf64bf9c42b0d4a9799c6b" -FUSEKI_IMAGE_DIGEST_ARM64 = "sha256:14b6771e154f3a9cc7ca2894b5f58b47da1287ae0cfb60b96ec073ce56cdbed2" diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel deleted file mode 100644 index 3fead820a5..0000000000 --- a/toolchains/BUILD.bazel +++ /dev/null @@ -1,22 +0,0 @@ -load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") - -# scalac options like in KnoraBuild.sbt (warn-unused is added, as it seems good) -scala_toolchain( - name = "dsp_api_toolchain_impl", - scalacopts = [ - "-Ywarn-unused", - "-feature", - "-unchecked", - "-deprecation", - "-Yresolve-term-conflict:package", - ], - unused_dependency_checker_mode = "off", - visibility = ["//visibility:public"], -) - -toolchain( - name = "dsp_api_scala_toolchain", - toolchain = "dsp_api_toolchain_impl", - toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type", - visibility = ["//visibility:public"], -) diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel deleted file mode 100644 index 143146ec00..0000000000 --- a/tools/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "all", - srcs = [ - "//tools/buildstamp:all", - ], -) - -filegroup( - name = "srcs", - srcs = [ - "//tools/buildstamp:srcs", - ], -) diff --git a/tools/buildstamp/BUILD.bazel b/tools/buildstamp/BUILD.bazel deleted file mode 100644 index 0ec5e6692d..0000000000 --- a/tools/buildstamp/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -# bring our version constants in -load("//third_party:versions.bzl", "AKKA_HTTP_VERSION", "AKKA_VERSION", "FUSEKI_VERSION", "SCALA_VERSION", "SIPI_VERSION") -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") - -filegroup( - name = "all", - srcs = [ - "get_workspace_status", - ], -) - -filegroup( - name = "srcs", - srcs = glob(["**"]), -) diff --git a/tools/buildstamp/get_workspace_status b/tools/buildstamp/get_workspace_status deleted file mode 100755 index 774559abd0..0000000000 --- a/tools/buildstamp/get_workspace_status +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# This script will be run bazel when building process starts to -# generate key-value information that represents the status of the -# workspace. The output should be like -# -# KEY1 VALUE1 -# KEY2 VALUE2 -# -# If the script exits with non-zero code, it's considered as a failure -# and the output will be discarded. - -# The code below presents an implementation that works for git repository -git_rev=$(git rev-parse HEAD) -if [[ $? != 0 ]]; -then - exit 1 -fi -echo "BUILD_SCM_REVISION ${git_rev}" - -# Check whether there are any uncommitted changes -git diff-index --quiet HEAD -- -if [[ $? == 0 ]]; -then - tree_status="Clean" -else - tree_status="Modified" -fi -echo "BUILD_SCM_STATUS ${tree_status}" - -# Emit the git tag -git_tag=$(git describe --tag --dirty --abbrev=7) -if [[ $? != 0 ]]; -then - git_tag=${git_rev} -fi -echo "BUILD_SCM_TAG ${git_tag}" diff --git a/webapi/README.md b/webapi/README.md deleted file mode 100644 index 23d31589b1..0000000000 --- a/webapi/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Performance measuring: - --Install docker --Install statsd, kamon, grafana: https://github.com/kamon-io/docker-grafana-graphite diff --git a/webapi/_assets/icons/bild.png b/webapi/_assets/icons/bild.png deleted file mode 100644 index b5c1be683e..0000000000 Binary files a/webapi/_assets/icons/bild.png and /dev/null differ diff --git a/webapi/_assets/icons/bildformat.png b/webapi/_assets/icons/bildformat.png deleted file mode 100644 index 0beb7dc66e..0000000000 Binary files a/webapi/_assets/icons/bildformat.png and /dev/null differ diff --git a/webapi/_assets/icons/book.gif b/webapi/_assets/icons/book.gif deleted file mode 100644 index fb67b45b41..0000000000 Binary files a/webapi/_assets/icons/book.gif and /dev/null differ diff --git a/webapi/_assets/icons/incunabula_logo.png b/webapi/_assets/icons/incunabula_logo.png deleted file mode 100644 index 8335a15ec9..0000000000 Binary files a/webapi/_assets/icons/incunabula_logo.png and /dev/null differ diff --git a/webapi/_assets/icons/page.gif b/webapi/_assets/icons/page.gif deleted file mode 100644 index f8696afa02..0000000000 Binary files a/webapi/_assets/icons/page.gif and /dev/null differ diff --git a/webapi/_assets/icons/person.png b/webapi/_assets/icons/person.png deleted file mode 100644 index d9ac9de9bc..0000000000 Binary files a/webapi/_assets/icons/person.png and /dev/null differ diff --git a/webapi/src/main/scala/org/knora/webapi/http/version/ServerVersion.scala b/webapi/src/main/scala/org/knora/webapi/http/version/ServerVersion.scala index 2e2b2951c8..0690d87ea6 100644 --- a/webapi/src/main/scala/org/knora/webapi/http/version/ServerVersion.scala +++ b/webapi/src/main/scala/org/knora/webapi/http/version/ServerVersion.scala @@ -15,7 +15,6 @@ import akka.http.scaladsl.server.Route */ object ServerVersion { - // FIXME: Revert as soon as we remove Bazel (not before) private val ApiNameAndVersion = s"${BuildInfo.name}/${BuildInfo.version}" private val AkkaNameAndVersion = s"akka-http/${BuildInfo.akkaHttp}" private val AllProducts = ApiNameAndVersion + " " + AkkaNameAndVersion diff --git a/webapi/src/test/scala/org/knora/webapi/E2ESpec.scala b/webapi/src/test/scala/org/knora/webapi/E2ESpec.scala index 91e7dd38b6..a842650b1f 100644 --- a/webapi/src/test/scala/org/knora/webapi/E2ESpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/E2ESpec.scala @@ -175,8 +175,6 @@ class E2ESpec(_system: ActorSystem) /** * Reads or writes a test data file. - * The written test data files can be found under: - * ./bazel-out/darwin-fastbuild/testlogs///test.outputs/outputs.zip * * @param responseAsString the API response received from Knora. * @param file the file in which the expected API response is stored. @@ -185,9 +183,7 @@ class E2ESpec(_system: ActorSystem) */ protected def readOrWriteTextFile(responseAsString: String, file: Path, writeFile: Boolean = false): String = if (writeFile) { - // Per default only read access is allowed in the bazel sandbox. - // This workaround allows to save test output. - val testOutputDir: Path = Paths.get(sys.env("TEST_UNDECLARED_OUTPUTS_DIR")) + val testOutputDir = Paths.get("..", "test_data", "ontologyR2RV2") val newOutputFile = testOutputDir.resolve(file) Files.createDirectories(newOutputFile.getParent) FileUtil.writeTextFile( @@ -198,18 +194,18 @@ class E2ESpec(_system: ActorSystem) } else { FileUtil.readTextFile(file).replaceAll("IIIF_BASE_URL", settings.externalSipiIIIFGetUrl) } - + private def createTmpFileDir(): Unit = { - // check if tmp datadir exists and create it if not - val tmpFileDir = Path.of(settings.tmpDataDir) - - if (!Files.exists(tmpFileDir)) { - try { - Files.createDirectories(tmpFileDir) - } catch { - case e: Throwable => - throw FileWriteException(s"Tmp data directory ${settings.tmpDataDir} could not be created: ${e.getMessage}") - } + // check if tmp datadir exists and create it if not + val tmpFileDir = Path.of(settings.tmpDataDir) + + if (!Files.exists(tmpFileDir)) { + try { + Files.createDirectories(tmpFileDir) + } catch { + case e: Throwable => + throw FileWriteException(s"Tmp data directory ${settings.tmpDataDir} could not be created: ${e.getMessage}") } } + } } diff --git a/webapi/src/test/scala/org/knora/webapi/R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/R2RSpec.scala index dff30ad708..f6e835dfd6 100644 --- a/webapi/src/test/scala/org/knora/webapi/R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/R2RSpec.scala @@ -145,8 +145,6 @@ class R2RSpec /** * Reads or writes a test data file. - * The written test data files can be found under: - * ./bazel-out/darwin-fastbuild/testlogs///test.outputs/outputs.zip * * @param responseAsString the API response received from Knora. * @param file the file in which the expected API response is stored. @@ -155,9 +153,7 @@ class R2RSpec */ protected def readOrWriteTextFile(responseAsString: String, file: Path, writeFile: Boolean = false): String = if (writeFile) { - // Per default only read access is allowed in the bazel sandbox. - // This workaround allows to save test output. - val testOutputDir: Path = Paths.get(sys.env("TEST_UNDECLARED_OUTPUTS_DIR")) + val testOutputDir = Paths.get("..", "test_data", "ontologyR2RV2") val newOutputFile = testOutputDir.resolve(file) Files.createDirectories(newOutputFile.getParent) FileUtil.writeTextFile( diff --git a/webapi/src/test/scala/org/knora/webapi/TestContainerFuseki.scala b/webapi/src/test/scala/org/knora/webapi/TestContainerFuseki.scala index 0192066239..68cd9aedca 100644 --- a/webapi/src/test/scala/org/knora/webapi/TestContainerFuseki.scala +++ b/webapi/src/test/scala/org/knora/webapi/TestContainerFuseki.scala @@ -10,13 +10,14 @@ import org.testcontainers.containers.GenericContainer import org.testcontainers.utility.DockerImageName import scala.jdk.CollectionConverters._ +import org.knora.webapi.http.version.BuildInfo /** * Provides the Fuseki container necessary for running tests. */ object TestContainerFuseki { - val FusekiImageName: DockerImageName = DockerImageName.parse("bazel/docker/knora-jena-fuseki:image") + val FusekiImageName: DockerImageName = DockerImageName.parse(BuildInfo.fuseki) val FusekiContainer = new GenericContainer(FusekiImageName) FusekiContainer.withExposedPorts(3030) diff --git a/webapi/src/test/scala/org/knora/webapi/TestContainersAll.scala b/webapi/src/test/scala/org/knora/webapi/TestContainersAll.scala index 234880a3cf..8bff7ac0b1 100644 --- a/webapi/src/test/scala/org/knora/webapi/TestContainersAll.scala +++ b/webapi/src/test/scala/org/knora/webapi/TestContainersAll.scala @@ -12,6 +12,7 @@ import org.testcontainers.containers.{BindMode, GenericContainer} import org.testcontainers.utility.DockerImageName import scala.jdk.CollectionConverters._ +import org.knora.webapi.http.version.BuildInfo /** * Provides all containers necessary for running tests. @@ -25,14 +26,14 @@ object TestContainersAll { .headOption .getOrElse(throw new UnknownHostException("No suitable network interface found")) - val FusekiImageName: DockerImageName = DockerImageName.parse("bazel/docker/knora-jena-fuseki:image") + val FusekiImageName: DockerImageName = DockerImageName.parse(BuildInfo.fuseki) val FusekiContainer = new GenericContainer(FusekiImageName) FusekiContainer.withExposedPorts(3030) FusekiContainer.withEnv("ADMIN_PASSWORD", "test") FusekiContainer.withEnv("JVM_ARGS", "-Xmx3G") FusekiContainer.start() - val SipiImageName: DockerImageName = DockerImageName.parse("bazel/docker/knora-sipi:image") + val SipiImageName: DockerImageName = DockerImageName.parse(s"daschswiss/knora-sipi:${BuildInfo.version}") val SipiContainer = new GenericContainer(SipiImageName) SipiContainer.withExposedPorts(1024) SipiContainer.withEnv("SIPI_EXTERNAL_PROTOCOL", "http") diff --git a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala index 5f51ea37cc..8be835b2b5 100644 --- a/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala @@ -60,7 +60,7 @@ class OntologyV2R2RSpec extends R2RSpec { // If true, the existing expected response files are overwritten with the HTTP GET responses from the server. // If false, the responses from the server are compared to the contents fo the expected response files. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - private val writeTestDataFiles = false + private val writeTestDataFiles = true override lazy val rdfDataObjects = List( RdfDataObject( @@ -118,7 +118,7 @@ class OntologyV2R2RSpec extends R2RSpec { ) { def makeFile(mediaType: MediaType.NonBinary): Path = { val fileSuffix = mediaType.fileExtensions.head - Paths.get("..", s"test_data/ontologyR2RV2/$fileBasename.$fileSuffix") + Paths.get("..", "..", "test_data", "ontologyR2RV2", s"$fileBasename.$fileSuffix") } /** @@ -129,9 +129,7 @@ class OntologyV2R2RSpec extends R2RSpec { */ def writeFile(responseStr: String, mediaType: MediaType.NonBinary): Unit = if (!disableWrite) { - // Per default only read access is allowed in the bazel sandbox. - // This workaround allows to save test output. - val testOutputDir = Paths.get(sys.env("TEST_UNDECLARED_OUTPUTS_DIR")) + val testOutputDir = Paths.get("..", "test_data", "ontologyR2RV2") val file = makeFile(mediaType) val newOutputFile = testOutputDir.resolve(file) Files.createDirectories(newOutputFile.getParent)