-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.sbt
More file actions
115 lines (92 loc) · 4.35 KB
/
build.sbt
File metadata and controls
115 lines (92 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import scala.language.postfixOps
import scala.sys.process.*
import sbt.*
name := """ot-platform-api"""
organization := "io.opentargets"
version := "latest"
scalacOptions ++= Seq("-feature", "-explain", "-Wunused:imports")
lazy val root = (project in file(".")).enablePlugins(PlayScala, PlayLogback)
scalaVersion := "3.5.0"
maintainer := "ops@opentargets.org"
javacOptions ++= Seq("-encoding", "UTF-8")
libraryDependencies ++= Seq(
guice,
caffeine,
"com.typesafe.slick" %% "slick" % "3.6.1",
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.11.0" % Test
)
val playVersion = "3.0.8"
libraryDependencies += "org.playframework" %% "play" % playVersion
libraryDependencies += "org.playframework" %% "play-filters-helpers" % "3.0.8"
libraryDependencies += "org.playframework" %% "play-logback" % playVersion
libraryDependencies += "org.playframework" %% "play-json" % "3.0.5"
libraryDependencies += "org.playframework" %% "play-streams" % playVersion
libraryDependencies += "org.playframework" %% "play-slick" % "6.2.0"
libraryDependencies += "net.logstash.logback" % "logstash-logback-encoder" % "7.3"
val sangriaVersion = "4.2.10"
libraryDependencies += "com.clickhouse" % "clickhouse-jdbc" % "0.7.2"
libraryDependencies += "org.apache.httpcomponents.client5" % "httpclient5" % "5.5"
libraryDependencies += "org.sangria-graphql" %% "sangria" % sangriaVersion
libraryDependencies += "org.sangria-graphql" %% "sangria-play-json-play30" % "2.0.3"
lazy val catsVersion = "2.13.0"
lazy val cats = Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-laws" % catsVersion,
"org.typelevel" %% "cats-kernel" % catsVersion,
"org.typelevel" %% "cats-kernel-laws" % catsVersion
)
libraryDependencies ++= cats
val s4sVersion = "8.11.5"
libraryDependencies ++= Seq(
"com.sksamuel.elastic4s" %% "elastic4s-core" % s4sVersion exclude ("org.slf4j", "slf4j-api"),
"com.sksamuel.elastic4s" %% "elastic4s-client-esjava" % s4sVersion exclude ("org.slf4j", "slf4j-api"),
"com.sksamuel.elastic4s" %% "elastic4s-http-streams" % s4sVersion exclude ("org.slf4j", "slf4j-api"),
"com.sksamuel.elastic4s" %% "elastic4s-json-play" % s4sVersion exclude ("org.slf4j", "slf4j-api")
)
libraryDependencies ++= Seq(
"io.prometheus" % "prometheus-metrics-core" % "1.3.6",
"io.prometheus" % "prometheus-metrics-instrumentation-jvm" % "1.3.6",
"io.prometheus" % "prometheus-metrics-exporter-common" % "1.3.6"
)
lazy val frontendRepository = settingKey[String]("Git repository with open targets front end.")
lazy val gqlFileDir = settingKey[File]("Location to save test input queries")
lazy val getGqlFiles = taskKey[Unit]("Add *.gql files from frontendRepository to test resources")
lazy val updateGqlFiles = taskKey[Unit]("Report which files are new and which have been updated.")
frontendRepository := "https://github.com/opentargets/ot-ui-apps.git"
gqlFileDir := (Test / resourceDirectory).value / "gqlQueries"
getGqlFiles := {
sbt.IO.withTemporaryDirectory { td =>
// copy files
Process(s"git clone ${frontendRepository.value} ${td.getAbsolutePath}") !
// filter files of interest
val gqlFiles: Seq[File] = (td / "apps/platform/" ** "*.gql").get ++ (td / "packages/sections/" ** "*.gql").get
// delete files in current gql test resources so we can identify when the FE deletes a file
val filesToDelete: Seq[File] =
sbt.IO.listFiles(gqlFileDir.value, NameFilter.fnToNameFilter(!_.contains("full")))
sbt.IO.delete(filesToDelete)
// move files to test resources
sbt.IO.copy(gqlFiles.map(f => (f, gqlFileDir.value / s"${f.getParentFile.name}_${f.name}")))
}
}
updateGqlFiles := {
// trigger update
val a: Unit = getGqlFiles.value
def gitStatusOpt(option: String): Seq[String] =
Process(s"git status -$option ${gqlFileDir.value.getAbsolutePath}").lineStream
.filter(_.contains((Test / resourceDirectory).value.getName))
val newFiles = gitStatusOpt("u")
val updatedFiles = gitStatusOpt("uno")
if (newFiles.nonEmpty) {
println("New files found:")
newFiles.filterNot(f => updatedFiles.contains(f)).foreach(println)
} else {
println("No new files found since last update.")
}
if (updatedFiles.nonEmpty) {
println("Files updated since last refresh:")
updatedFiles.foreach(println)
} else {
println("No existing files have been updated since last check.")
}
}