-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sbt): 🔨 refactor project structure
Signed-off-by: Felipe Bonezi <[email protected]>
- Loading branch information
1 parent
d5e925e
commit 4fc46d3
Showing
29 changed files
with
310 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,13 @@ | |
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
import Common.repoName | ||
import Common._ | ||
import Dependencies.scala212 | ||
import Dependencies.scala213 | ||
|
||
lazy val root = project | ||
.in(file(".")) | ||
.aggregate(actuator) | ||
.aggregate(core, actuator, jdbc, slick, redis) | ||
.settings( | ||
name := "play-actuator-root", | ||
crossScalaVersions := Nil, | ||
|
@@ -34,10 +34,20 @@ lazy val root = project | |
lazy val core = project | ||
.in(file("play-actuator-core")) | ||
.settings( | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
libraryDependencies ++= Dependencies.core, | ||
publish / skip := true | ||
name := s"$repoName-core", | ||
organization := "io.github.felipebonezi", | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
versionScheme := Some("early-semver"), | ||
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org", | ||
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local", | ||
scmInfo := Some( | ||
ScmInfo( | ||
url(s"https://github.com/felipebonezi/$repoName/play-actuator-core"), | ||
s"scm:git:[email protected]:felipebonezi/$repoName.git" | ||
) | ||
), | ||
libraryDependencies ++= Dependencies.core | ||
) | ||
|
||
lazy val actuator = project | ||
|
@@ -57,29 +67,72 @@ lazy val actuator = project | |
s"scm:git:[email protected]:felipebonezi/$repoName.git" | ||
) | ||
), | ||
Dependencies.actuator, | ||
Dependencies.actuator | ||
) | ||
.enablePlugins(Common) | ||
|
||
lazy val database = project | ||
.in(file("play-actuator-indicators/database")) | ||
lazy val jdbc = project | ||
.in(file("play-actuator-indicators/database/jdbc")) | ||
.dependsOn(core) | ||
.settings( | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
Dependencies.db, | ||
publish / skip := true | ||
name := s"$jdbcIndicatorName", | ||
organization := "io.github.felipebonezi", | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
versionScheme := Some("early-semver"), | ||
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org", | ||
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local", | ||
scmInfo := Some( | ||
ScmInfo( | ||
url(s"https://github.com/felipebonezi/$repoName/play-actuator-indicators/database/jdbc"), | ||
s"scm:git:[email protected]:felipebonezi/$repoName.git" | ||
) | ||
), | ||
Dependencies.jdbc | ||
) | ||
.enablePlugins(Common) | ||
|
||
lazy val slick = project | ||
.in(file("play-actuator-indicators/database/slick")) | ||
.dependsOn(core) | ||
.settings( | ||
name := s"$slickIndicatorName", | ||
organization := "io.github.felipebonezi", | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
versionScheme := Some("early-semver"), | ||
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org", | ||
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local", | ||
scmInfo := Some( | ||
ScmInfo( | ||
url(s"https://github.com/felipebonezi/$repoName/play-actuator-indicators/database/slick"), | ||
s"scm:git:[email protected]:felipebonezi/$repoName.git" | ||
) | ||
), | ||
Dependencies.slick | ||
) | ||
.enablePlugins(Common) | ||
|
||
lazy val redis = project | ||
.in(file("play-actuator-indicators/redis")) | ||
.in(file("play-actuator-indicators/database/redis")) | ||
.dependsOn(core) | ||
.settings( | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
Dependencies.redis, | ||
publish / skip := true | ||
name := s"$redisIndicatorName", | ||
organization := "io.github.felipebonezi", | ||
scalaVersion := scala213, | ||
crossScalaVersions := Seq(scala212, scala213), | ||
versionScheme := Some("early-semver"), | ||
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org", | ||
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local", | ||
scmInfo := Some( | ||
ScmInfo( | ||
url(s"https://github.com/felipebonezi/$repoName/play-actuator-indicators/database/redis"), | ||
s"scm:git:[email protected]:felipebonezi/$repoName.git" | ||
) | ||
), | ||
Dependencies.redis | ||
) | ||
.enablePlugins(Common) | ||
|
||
addCommandAlias( | ||
"validateCode", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
play-actuator-indicators/database/jdbc/src/main/resources/reference.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
play { | ||
actuator { | ||
indicator { | ||
health { | ||
database = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
play.modules.enabled += "play.actuator.ActuatorJdbcModule" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
play-actuator-indicators/database/redis/src/main/resources/reference.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
play { | ||
actuator { | ||
indicator { | ||
health { | ||
redis = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
play.modules.enabled += "play.actuator.ActuatorRedisModule" |
43 changes: 43 additions & 0 deletions
43
...actuator-indicators/database/redis/src/main/scala/play/actuator/ActuatorRedisModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2022 Felipe Bonezi <https://about.me/felipebonezi> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
package play.actuator | ||
|
||
import com.google.inject.AbstractModule | ||
import com.google.inject.name.Names | ||
import play.actuator.ActuatorEnum.Up | ||
import play.actuator.health.HealthBuilder | ||
import play.actuator.health.indicator.HealthIndicator | ||
import play.actuator.health.indicator.RedisHealthIndicator | ||
import play.api.Configuration | ||
import play.api.Environment | ||
|
||
class ActuatorRedisModule(environment: Environment, config: Configuration) extends AbstractModule { | ||
|
||
override def configure(): Unit = { | ||
val confKey = "play.actuator.health.indicators.redis" | ||
if (config.getOptional[Boolean](confKey).getOrElse(false)) { | ||
bind(classOf[HealthIndicator]) | ||
.annotatedWith(Names.named("redisIndicator")) | ||
.to(classOf[RedisHealthIndicator]) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
play-actuator-indicators/database/slick/src/main/resources/reference.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
play { | ||
actuator { | ||
indicator { | ||
health { | ||
database = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
play.modules.enabled += "play.actuator.ActuatorSlickModule" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.