Skip to content

Commit

Permalink
Chore/restructure (#43)
Browse files Browse the repository at this point in the history
* Restructure

* Restructure

---------

Co-authored-by: David Sloan <[email protected]>
  • Loading branch information
davidsloan and davidsloan authored Feb 24, 2023
1 parent e116429 commit d49106e
Show file tree
Hide file tree
Showing 44 changed files with 65 additions and 36 deletions.
32 changes: 31 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
import Settings.modulesSettings
import Settings.secretProviderDeps
import Settings.AssemblyConfigurator
import sbt.Project.projectToLocalProject

name := "secret-provider"
javacOptions ++= Seq("--release", "11")
javaOptions ++= Seq("-Xms512M", "-Xmx2048M")


lazy val subProjects: Seq[Project] = Seq(
`secret-provider`
)
lazy val subProjectsRefs: Seq[ProjectReference] = subProjects.map(projectToLocalProject)

lazy val root = (project in file("."))
.settings(modulesSettings)
.settings(
publish := {},
publishArtifact := false,
name := "secret-provider",
)
.aggregate(
subProjectsRefs: _*,
)
.disablePlugins(AssemblyPlugin)

lazy val `secret-provider` = (project in file("secret-provider"))
.settings(
modulesSettings ++
Seq(
name := "secret-provider",
description := "Kafka Connect compatible connectors to move data between Kafka and popular data stores",
publish / skip := true,
libraryDependencies ++= secretProviderDeps,
),
)
.configureAssembly()

addCommandAlias(
"validateAll",
Expand Down
69 changes: 34 additions & 35 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import sbt.Keys._
import sbt._
import sbt.{Def, _}
import sbtassembly.AssemblyKeys._
import sbtassembly.MergeStrategy

Expand All @@ -17,7 +17,7 @@ object Settings extends Dependencies {
val artifactVersion = {
sys.env.get("LENSES_TAG_NAME") match {
case Some(tag) => tag
case _ => s"$nextVersion-SNAPSHOT"
case _ => s"$nextVersion-SNAPSHOT"
}
}

Expand All @@ -36,8 +36,7 @@ object Settings extends Dependencies {
Resolver.mavenLocal,
Resolver.mavenCentral
),
libraryDependencies ++= secretProviderDeps,
crossScalaVersions := List( /*scala3, */ scala213 /*scala212*/ ),
crossScalaVersions := List(/*scala3, */ scala213 /*scala212*/),
Compile / scalacOptions ++= Seq(
"-release:11",
"-encoding",
Expand All @@ -48,44 +47,44 @@ object Settings extends Dependencies {
"11"
),
Compile / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n <= 12 =>
Seq(
"-Ypartial-unification",
ScalacFlags.WarnUnusedImports212
)
case _ =>
Seq(
ScalacFlags.WarnUnusedImports213
)
}
Seq(
ScalacFlags.WarnUnusedImports213
)
},
Compile / console / scalacOptions --= Seq(
ScalacFlags.FatalWarnings212,
ScalacFlags.FatalWarnings213,
ScalacFlags.WarnUnusedImports212,
ScalacFlags.WarnUnusedImports213
),
assembly / assemblyJarName := s"secret-provider_${SemanticVersioning(scalaVersion.value).majorMinor}-${artifactVersion}-all.jar",
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
val excludes = Set(
"org.apache.avro",
"org.apache.kafka",
"io.confluent",
"org.apache.zookeeper"
)
cp filter { f => excludes.exists(f.data.getName.contains(_)) }
},
assembly / assemblyMergeStrategy := {
case "module-info.class" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") =>
MergeStrategy.concat
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
},

Test / fork := true
)

}
implicit final class AssemblyConfigurator(project: Project) {
def configureAssembly(): Project =
project.settings(
assembly / assemblyJarName := s"secret-provider_${SemanticVersioning(scalaVersion.value).majorMinor}-${artifactVersion}-all.jar",
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
val excludes = Set(
"org.apache.avro",
"org.apache.kafka",
"io.confluent",
"org.apache.zookeeper"
)
cp filter { f => excludes.exists(f.data.getName.contains(_)) }
},
assembly / assemblyMergeStrategy := {
case "module-info.class" => MergeStrategy.discard
case x if x.contains("io.netty.versions.properties") =>
MergeStrategy.concat
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)

}

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d49106e

Please sign in to comment.