Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor: start on a functional domain design implementation for onto…
…logies (DEV-227) (#2009)
  • Loading branch information
subotic committed Mar 2, 2022
1 parent 5154adc commit 54cee7a
Show file tree
Hide file tree
Showing 14 changed files with 524 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -21,7 +21,7 @@ sipi/test
bazel-*

**/project/target/
/target/
**/target/
*.aux
*.bbl
*.bcf
Expand Down
69 changes: 61 additions & 8 deletions build.sbt
Expand Up @@ -11,19 +11,16 @@ import scala.sys.process.Process
// GLOBAL SETTINGS
//////////////////////////////////////

lazy val aggregatedProjects: Seq[ProjectReference] = Seq(webapi)

lazy val buildSettings = Dependencies.Versions ++ Seq(
lazy val buildSettings = Seq(
organization := "org.knora",
version := (ThisBuild / version).value
)

lazy val rootBaseDir = ThisBuild / baseDirectory

lazy val root: Project = Project(id = "root", file("."))
.aggregate(aggregatedProjects: _*)
.aggregate(webapi, apiMain)
.enablePlugins(GitVersioning, GitBranchPrompt)
.settings(Dependencies.Versions)
.settings(
// values set for all sub-projects
// These are normal sbt settings to configure for release, skip if already defined
Expand All @@ -33,6 +30,7 @@ lazy val root: Project = Project(id = "root", file("."))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/dasch-swiss/dsp-api"), "scm:git:git@github.com:dasch-swiss/dsp-api.git")
),
Global / scalaVersion := Dependencies.scalaVersion,
// use 'git describe' for deriving the version
git.useGitDescribe := true,
// override generated version string because docker hub rejects '+' in tags
Expand Down Expand Up @@ -160,9 +158,9 @@ lazy val webapi: Project = Project(id = "webapi", base = file("webapi"))
buildInfoKeys ++= Seq[BuildInfoKey](
name,
version,
"akkaHttp" -> Dependencies.akkaHttpVersion.value,
"sipi" -> Dependencies.sipiImage.value,
"fuseki" -> Dependencies.fusekiImage.value
"akkaHttp" -> Dependencies.akkaHttpVersion,
"sipi" -> Dependencies.sipiImage,
"fuseki" -> Dependencies.fusekiImage
),
buildInfoPackage := "org.knora.webapi.http.version"
)
Expand Down Expand Up @@ -190,3 +188,58 @@ lazy val webapiJavaTestOptions = Seq(
//"-XX:MaxGCPauseMillis=500",
//"-XX:MaxMetaspaceSize=4096m"
)


lazy val apiMain = project
.in(file("dsp-api-main"))
.settings(
name := "dsp-api-main",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
.dependsOn(schemaCore, schemaRepo, schemaApi)


lazy val schemaApi = project
.in(file("dsp-schema-api"))
.settings(
name := "schemaApi",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
.dependsOn(schemaCore)

lazy val schemaCore = project
.in(file("dsp-schema-core"))
.settings(
name := "schemaCore",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)

lazy val schemaRepo = project
.in(file("dsp-schema-repo"))
.settings(
name := "schemaRepo",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
.dependsOn(schemaCore)

lazy val schemaRepoEventStoreService = project
.in(file("dsp-schema-repo-eventstore-service"))
.settings(
name := "schemaRepoEventstoreService",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
.dependsOn(schemaRepo)

lazy val schemaRepoSearchService = project
.in(file("dsp-schema-repo-search-service"))
.settings(
name := "dsp-schema-repo-search-service",
Dependencies.webapiLibraryDependencies,
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
)
.dependsOn(schemaRepo)
17 changes: 17 additions & 0 deletions dsp-api-main/src/main/scala/dsp/api/main/MainApp.scala
@@ -0,0 +1,17 @@
package dsp.api.main

import dsp.schema.repo.{SchemaRepo, SchemaRepoLive}
import zio.Console.printLine
import zio._

object MainApp extends ZIOAppDefault {
val effect: ZIO[Console with SchemaRepo, Nothing, Unit] =
for {
profile <- SchemaRepo.lookup("user1").orDie
_ <- printLine(profile).orDie
_ <- printLine(42).orDie
} yield ()

val mainApp: ZIO[Any, Nothing, Unit] = effect.provide(Console.live ++ SchemaRepoLive.layer)
def run: ZIO[Any, Nothing, Unit] = mainApp
}
13 changes: 13 additions & 0 deletions dsp-schema-api/src/main/scala/dsp/schema/api/app/App.scala
@@ -0,0 +1,13 @@
package dsp.schema.api

import zio._
import zhttp.http._
import zhttp.service.Server

object App extends ZIOAppDefault {
val app = Http.collect[Request] { case Method.GET -> !! / "text" =>
Response.text("Hello World!")
}

def run = Server.start(8090, app)
}

0 comments on commit 54cee7a

Please sign in to comment.