Skip to content

Commit

Permalink
Use sbt-apache-sonatype
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Mar 1, 2023
1 parent 5f6589f commit d1f8a8d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 57 deletions.
33 changes: 1 addition & 32 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import com.typesafe.sbt.packager.docker.{ Cmd, ExecCmd }
import sbt.Keys.parallelExecution

ThisBuild / apacheSonatypeProjectProfile := "pekko"
ThisBuild / resolvers += Resolver.jcenterRepo
ThisBuild / resolvers += "Apache Snapshots".at("https://repository.apache.org/content/repositories/snapshots/")

Expand Down Expand Up @@ -41,118 +42,94 @@ lazy val mimaPreviousArtifactsSet = mimaPreviousArtifacts := Set.empty // tempor

lazy val discoveryKubernetesApi = pekkoModule("discovery-kubernetes-api")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-discovery-kubernetes-api",
libraryDependencies := Dependencies.discoveryKubernetesApi,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(managementPki)

lazy val discoveryMarathonApi = pekkoModule("discovery-marathon-api")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-discovery-marathon-api",
libraryDependencies := Dependencies.discoveryMarathonApi,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val discoveryAwsApi = pekkoModule("discovery-aws-api")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-discovery-aws-api",
libraryDependencies := Dependencies.discoveryAwsApi,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val discoveryAwsApiAsync = pekkoModule("discovery-aws-api-async")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-discovery-aws-api-async",
libraryDependencies := Dependencies.discoveryAwsApiAsync,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val discoveryConsul = pekkoModule("discovery-consul")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-discovery-consul",
libraryDependencies := Dependencies.discoveryConsul,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

// gathers all enabled routes and serves them (HTTP or otherwise)
lazy val management = pekkoModule("management")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-management",
libraryDependencies := Dependencies.managementHttp,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val managementPki = pekkoModule("management-pki")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-management-pki",
libraryDependencies := Dependencies.managementPki,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val managementLoglevelsLogback = pekkoModule("management-loglevels-logback")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-management-loglevels-logback",
libraryDependencies := Dependencies.managementLoglevelsLogback,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(management)

lazy val managementLoglevelsLog4j2 = pekkoModule("management-loglevels-log4j2")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.disablePlugins(MimaPlugin)
.settings(
name := "pekko-management-loglevels-log4j2",
libraryDependencies := Dependencies.managementLoglevelsLog4j2)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(management)

lazy val managementClusterHttp = pekkoModule("management-cluster-http")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-management-cluster-http",
libraryDependencies := Dependencies.managementClusterHttp,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(management)

lazy val managementClusterBootstrap = pekkoModule("management-cluster-bootstrap")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-management-cluster-bootstrap",
libraryDependencies := Dependencies.managementClusterBootstrap,
mimaPreviousArtifactsSet)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(management)

lazy val leaseKubernetes = pekkoModule("lease-kubernetes")
.enablePlugins(AutomateHeaderPlugin)
.settings(MetaInfLicenseNoticeCopy.settings)
.settings(
name := "pekko-lease-kubernetes",
libraryDependencies := Dependencies.leaseKubernetes,
mimaPreviousArtifactsSet)
.settings(Defaults.itSettings)
.settings(MetaInfLicenseNoticeCopy.settings)
.configs(IntegrationTest)
.dependsOn(managementPki)

Expand All @@ -177,7 +154,6 @@ lazy val leaseKubernetesIntTest = pekkoModule("lease-kubernetes-int-test")
Cmd("RUN", "chgrp -R 0 . && chmod -R g=u ."),
Cmd("RUN", "/sbin/apk", "add", "--no-cache", "bash", "bind-tools", "busybox-extras", "curl", "strace"),
Cmd("RUN", "chmod +x /opt/docker/bin/pekko-lease-kubernetes-int-test")))
.settings(MetaInfLicenseNoticeCopy.settings)

lazy val integrationTestKubernetesApi = pekkoIntTestModule("kubernetes-api")
.disablePlugins(MimaPlugin)
Expand All @@ -186,7 +162,6 @@ lazy val integrationTestKubernetesApi = pekkoIntTestModule("kubernetes-api")
publish / skip := true,
doc / sources := Seq.empty,
libraryDependencies := Dependencies.bootstrapDemos)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(management, managementClusterHttp, managementClusterBootstrap, discoveryKubernetesApi)

lazy val integrationTestKubernetesApiJava = pekkoIntTestModule("kubernetes-api-java")
Expand All @@ -196,7 +171,6 @@ lazy val integrationTestKubernetesApiJava = pekkoIntTestModule("kubernetes-api-j
publish / skip := true,
doc / sources := Seq.empty,
libraryDependencies := Dependencies.bootstrapDemos)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand All @@ -210,7 +184,6 @@ lazy val integrationTestKubernetesDns = pekkoIntTestModule("kubernetes-dns")
publish / skip := true,
doc / sources := Seq.empty,
libraryDependencies := Dependencies.bootstrapDemos)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand All @@ -224,7 +197,6 @@ lazy val integrationTestAwsApiEc2TagBased = pekkoIntTestModule("aws-api-ec2")
publish / skip := true,
doc / sources := Seq.empty,
Defaults.itSettings)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand All @@ -238,7 +210,6 @@ lazy val integrationTestMarathonApiDocker = pekkoIntTestModule("marathon-api-doc
name := "integration-test-marathon-api-docker",
publish / skip := true,
doc / sources := Seq.empty)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand All @@ -251,7 +222,6 @@ lazy val integrationTestAwsApiEcs = pekkoIntTestModule("aws-api-ecs")
.settings(
publish / skip := true,
doc / sources := Seq.empty)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand All @@ -271,7 +241,6 @@ lazy val integrationTestLocal = pekkoIntTestModule("local")
publish / skip := true,
doc / sources := Seq.empty,
libraryDependencies := Dependencies.bootstrapDemos)
.settings(MetaInfLicenseNoticeCopy.settings)
.dependsOn(
management,
managementClusterHttp,
Expand Down
10 changes: 5 additions & 5 deletions integration-test/marathon-api-docker/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ enablePlugins(JavaServerAppPackaging)

dockerUsername := sys.env.get("DOCKER_USER")

val akkaManagementVersion = "1.1.4"
val pekkoManagementVersion = "1.1.4"

libraryDependencies ++= Vector(
"org.apache.pekko" %% "pekko-management-cluster-bootstrap" % akkaManagementVersion,
"org.apache.pekko" %% "pekko-management-cluster-http" % akkaManagementVersion,
"org.apache.pekko" %% "pekko-discovery-marathon-api" % akkaManagementVersion)
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-management-cluster-bootstrap" % pekkoManagementVersion,
"org.apache.pekko" %% "pekko-management-cluster-http" % pekkoManagementVersion,
"org.apache.pekko" %% "pekko-discovery-marathon-api" % pekkoManagementVersion)
11 changes: 3 additions & 8 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ import de.heikoseeberger.sbtheader.HeaderPlugin
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import sbt.Keys._
import sbt._
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName
import org.mdedetrich.apache.sonatype.SonatypeApachePlugin

object Common extends AutoPlugin {

override def trigger = allRequirements
override def requires = plugins.JvmPlugin && HeaderPlugin && CiReleasePlugin
override def requires = plugins.JvmPlugin && HeaderPlugin && CiReleasePlugin && SonatypeApachePlugin

val currentYear = "2023"

override lazy val projectSettings: Seq[sbt.Def.Setting[_]] =
Seq(
organization := "org.apache.pekko",
organizationName := "Apache Software Foundation",
organizationHomepage := Some(url("https://www.apache.org/")),
startYear := Some(2022),
homepage := Some(url("https://pekko.apache.org/")),
scmInfo := Some(
Expand All @@ -28,7 +25,6 @@ object Common extends AutoPlugin {
"Contributors",
"dev@pekko.apache.org",
url("https://github.com/apache/incubator-pekko-management/graphs/contributors")),
licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))),
description := "Apache Pekko Management is a suite of tools for operating Apache Pekko Clusters.",
headerLicense := Some(HeaderLicense.Custom(apacheHeader)),
crossScalaVersions := Dependencies.crossScalaVersions,
Expand Down Expand Up @@ -76,8 +72,7 @@ object Common extends AutoPlugin {
// -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug".
// -a Show stack traces and exception class name for AssertionErrors.
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),
scalaVersion := Dependencies.scala212Version,
sonatypeProfileName := "com.lightbend")
scalaVersion := Dependencies.scala212Version)

private def isJdk8 =
VersionNumber(sys.props("java.specification.version")).matchesSemVer(SemanticSelector(s"=1.8"))
Expand Down
20 changes: 8 additions & 12 deletions project/MetaInfLicenseNoticeCopy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,19 @@

import sbt.Keys._
import sbt._
import org.mdedetrich.apache.sonatype.SonatypeApachePlugin
import SonatypeApachePlugin.autoImport.apacheSonatypeDisclaimerFile

/**
* Copies LICENSE and NOTICE files into jar META-INF dir
*/
object MetaInfLicenseNoticeCopy {
object MetaInfLicenseNoticeCopy extends AutoPlugin {

val settings: Seq[Setting[_]] = inConfig(Compile)(
Seq(
resourceGenerators += copyFileToMetaInf(resourceManaged, "LICENSE"),
resourceGenerators += copyFileToMetaInf(resourceManaged, "NOTICE"),
resourceGenerators += copyFileToMetaInf(resourceManaged, "DISCLAIMER")))
override def trigger = allRequirements

def copyFileToMetaInf(dir: SettingKey[File], fileName: String) = Def.task[Seq[File]] {
val fromFile = (LocalRootProject / baseDirectory).value / fileName
val toFile = resourceManaged.value / "META-INF" / fileName
IO.copyFile(fromFile, toFile)
Seq(toFile)
}
override def requires = SonatypeApachePlugin

override lazy val projectSettings = Seq(
apacheSonatypeDisclaimerFile := Some((LocalRootProject / baseDirectory).value / "DISCLAIMER"))

}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.2")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.5")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

Expand Down

0 comments on commit d1f8a8d

Please sign in to comment.