diff --git a/build.sbt b/build.sbt index b98261030f9..d585aee47f2 100644 --- a/build.sbt +++ b/build.sbt @@ -78,7 +78,6 @@ lazy val userProjects: Seq[ProjectReference] = List[ProjectReference]( distributedData, jackson, multiNodeTestkit, - osgi, persistence, persistenceQuery, persistenceTyped, @@ -126,7 +125,6 @@ lazy val root = Project(id = "pekko", base = file(".")) lazy val actor = pekkoModule("actor") .settings(Dependencies.actor) - .settings(OSGi.actor) .settings(AutomaticModuleName.settings("pekko.actor")) .settings(AddMetaInfLicenseFiles.actorSettings) .settings(Compile / unmanagedSourceDirectories += { @@ -167,7 +165,6 @@ lazy val cluster = pekkoModule("cluster") .settings(Dependencies.cluster) .settings(AutomaticModuleName.settings("pekko.cluster")) .settings(AddMetaInfLicenseFiles.clusterSettings) - .settings(OSGi.cluster) .settings(Protobuf.settings) .settings(Test / parallelExecution := false) .configs(MultiJvm) @@ -178,7 +175,6 @@ lazy val clusterMetrics = pekkoModule("cluster-metrics") cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile", jackson % "test->test") - .settings(OSGi.clusterMetrics) .settings(Dependencies.clusterMetrics) .settings(AutomaticModuleName.settings("pekko.cluster.metrics")) .settings(Protobuf.settings) @@ -200,7 +196,6 @@ lazy val clusterSharding = pekkoModule("cluster-sharding") jackson % "test->test") .settings(Dependencies.clusterSharding) .settings(AutomaticModuleName.settings("pekko.cluster.sharding")) - .settings(OSGi.clusterSharding) .settings(Protobuf.settings) .configs(MultiJvm) .enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams) @@ -213,7 +208,6 @@ lazy val clusterTools = pekkoModule("cluster-tools") jackson % "test->test") .settings(Dependencies.clusterTools) .settings(AutomaticModuleName.settings("pekko.cluster.tools")) - .settings(OSGi.clusterTools) .settings(Protobuf.settings) .configs(MultiJvm) .enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams) @@ -223,7 +217,6 @@ lazy val distributedData = pekkoModule("distributed-data") .settings(Dependencies.distributedData) .settings(AutomaticModuleName.settings("pekko.cluster.ddata")) .settings(AddMetaInfLicenseFiles.distributedDataSettings) - .settings(OSGi.distributedData) .settings(Protobuf.settings) .configs(MultiJvm) .enablePlugins(MultiNodeScalaTest) @@ -235,7 +228,6 @@ lazy val docs = pekkoModule("docs") cluster, clusterMetrics, slf4j, - osgi, persistenceTck, persistenceQuery, distributedData, @@ -279,7 +271,6 @@ lazy val jackson = pekkoModule("serialization-jackson") testkit % "test->test") .settings(Dependencies.jackson) .settings(AutomaticModuleName.settings("pekko.serialization.jackson")) - .settings(OSGi.jackson) .settings(javacOptions += "-parameters") .enablePlugins(ScaladocNoVerificationOfDiagrams) @@ -290,18 +281,10 @@ lazy val multiNodeTestkit = pekkoModule("multi-node-testkit") .settings(AutomaticModuleName.settings("pekko.remote.testkit")) .settings(PekkoBuild.mayChangeSettings) -lazy val osgi = pekkoModule("osgi") - .dependsOn(actor) - .settings(Dependencies.osgi) - .settings(AutomaticModuleName.settings("pekko.osgi")) - .settings(OSGi.osgi) - .settings(Test / parallelExecution := false) - lazy val persistence = pekkoModule("persistence") .dependsOn(actor, stream, testkit % "test->test") .settings(Dependencies.persistence) .settings(AutomaticModuleName.settings("pekko.persistence")) - .settings(OSGi.persistence) .settings(Protobuf.settings) .settings(Test / fork := true) @@ -314,7 +297,6 @@ lazy val persistenceQuery = pekkoModule("persistence-query") streamTestkit % "test") .settings(Dependencies.persistenceQuery) .settings(AutomaticModuleName.settings("pekko.persistence.query")) - .settings(OSGi.persistenceQuery) .settings(Protobuf.settings) // To be able to import ContainerFormats.proto .settings(Protobuf.importPath := Some(baseDirectory.value / ".." / "remote" / "src" / "main" / "protobuf")) @@ -333,7 +315,6 @@ lazy val persistenceTck = pekkoModule("persistence-tck") .dependsOn(persistence % "compile->compile;test->test", testkit % "compile->compile;test->test") .settings(Dependencies.persistenceTck) .settings(AutomaticModuleName.settings("pekko.persistence.tck")) - // .settings(OSGi.persistenceTck) TODO: we do need to export this as OSGi bundle too? .settings(Test / fork := true) .disablePlugins(MimaPlugin) @@ -361,7 +342,6 @@ lazy val persistenceTypedTests = pekkoModule("persistence-typed-tests") .enablePlugins(NoPublish) lazy val protobufV3 = pekkoModule("protobuf-v3") - .settings(OSGi.protobufV3) .settings(AutomaticModuleName.settings("pekko.protobuf.v3")) .settings(AddMetaInfLicenseFiles.protobufV3Settings) .enablePlugins(ScaladocNoVerificationOfDiagrams) @@ -381,7 +361,7 @@ lazy val protobufV3 = pekkoModule("protobuf-v3") .withConfigurations(Vector(Compile)), // prevent original dependency to be added to pom as runtime dep Compile / packageBin / packagedArtifact := Scoped.mkTuple2( (Compile / packageBin / artifact).value, - ReproducibleBuildsPlugin.postProcessJar(OsgiKeys.bundle.value)), + ReproducibleBuildsPlugin.postProcessJar((Compile / assembly).value)), Compile / packageBin := ReproducibleBuildsPlugin .postProcessJar((Compile / assembly).value), // package by running assembly // Prevent cyclic task dependencies, see https://github.com/sbt/sbt-assembly/issues/365 by @@ -410,7 +390,6 @@ lazy val remote = .settings(Dependencies.remote) .settings(AutomaticModuleName.settings("pekko.remote")) .settings(AddMetaInfLicenseFiles.remoteSettings) - .settings(OSGi.remote) .settings(Protobuf.settings) .settings(Test / parallelExecution := false) .settings(serialversionRemoverPluginSettings) @@ -434,13 +413,11 @@ lazy val slf4j = pekkoModule("slf4j") .dependsOn(actor, testkit % "test->test") .settings(Dependencies.slf4j) .settings(AutomaticModuleName.settings("pekko.slf4j")) - .settings(OSGi.slf4j) lazy val stream = pekkoModule("stream") .dependsOn(actor, protobufV3) .settings(Dependencies.stream) .settings(AutomaticModuleName.settings("pekko.stream")) - .settings(OSGi.stream) .settings(Protobuf.settings) .enablePlugins(BoilerplatePlugin, Jdk9) @@ -448,7 +425,6 @@ lazy val streamTestkit = pekkoModule("stream-testkit") .dependsOn(stream, testkit % "compile->compile;test->test") .settings(Dependencies.streamTestkit) .settings(AutomaticModuleName.settings("pekko.stream.testkit")) - .settings(OSGi.streamTestkit) lazy val streamTests = pekkoModule("stream-tests") .configs(Jdk9.TestJdk9) @@ -473,14 +449,12 @@ lazy val testkit = pekkoModule("testkit") .dependsOn(actor) .settings(Dependencies.testkit) .settings(AutomaticModuleName.settings("pekko.actor.testkit")) - .settings(OSGi.testkit) .settings(initialCommands += "import org.apache.pekko.testkit._") lazy val actorTyped = pekkoModule("actor-typed") .dependsOn(actor, slf4j) .settings(AutomaticModuleName.settings("pekko.actor.typed")) .settings(Dependencies.actorTyped) - .settings(OSGi.actorTyped) .settings(initialCommands := """ import org.apache.pekko @@ -515,7 +489,6 @@ lazy val persistenceTyped = pekkoModule("persistence-typed") .settings(Protobuf.settings) // To be able to import ContainerFormats.proto .settings(Protobuf.importPath := Some(baseDirectory.value / ".." / "remote" / "src" / "main" / "protobuf")) - .settings(OSGi.persistenceTyped) lazy val clusterTyped = pekkoModule("cluster-typed") .dependsOn( @@ -589,13 +562,11 @@ lazy val discovery = pekkoModule("discovery") .dependsOn(actor, testkit % "test->test", actorTests % "test->test") .settings(Dependencies.discovery) .settings(AutomaticModuleName.settings("pekko.discovery")) - .settings(OSGi.discovery) lazy val coordination = pekkoModule("coordination") .dependsOn(actor, testkit % "test->test", actorTests % "test->test") .settings(Dependencies.coordination) .settings(AutomaticModuleName.settings("pekko.coordination")) - .settings(OSGi.coordination) lazy val billOfMaterials = Project("bill-of-materials", file("bill-of-materials")) .enablePlugins(BillOfMaterialsPlugin) diff --git a/project/OSGi.scala b/project/OSGi.scala deleted file mode 100644 index bafd5ede1ca..00000000000 --- a/project/OSGi.scala +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2016-2022 Lightbend Inc. - */ - -import com.typesafe.sbt.osgi.OsgiKeys -import com.typesafe.sbt.osgi.SbtOsgi._ -import sbt._ -import sbt.Keys._ -import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin - -object OSGi { - - // The included osgiSettings that creates bundles also publish the jar files - // in the .../bundles directory which makes testing locally published artifacts - // a pain. Create bundles but publish them to the normal .../jars directory. - def osgiSettings = - defaultOsgiSettings ++ Seq( - Compile / packageBin := { - val bundle = OsgiKeys.bundle.value - // This normally happens automatically when loading the - // sbt-reproducible-builds plugin, but because we replace - // `packageBin` wholesale here we need to invoke the post-processing - // manually. See also - // https://github.com/raboof/sbt-reproducible-builds#sbt-osgi - ReproducibleBuildsPlugin.postProcessJar(bundle) - }, - // This will fail the build instead of accidentally removing classes from the resulting artifact. - // Each package contained in a project MUST be known to be private or exported, if it's undecided we MUST resolve this - OsgiKeys.failOnUndecidedPackage := true, - // By default an entry is generated from module group-id, but our modules do not adhere to such package naming - OsgiKeys.privatePackage := Seq(), - // Explicitly specify the version of JavaSE required #23795 (rather depend on - // figuring that out from the JDK it was built with) - OsgiKeys.requireCapability := "osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version>=1.8))\"") - - val actor = osgiSettings ++ Seq( - OsgiKeys.exportPackage := Seq("org.apache.pekko*"), - OsgiKeys.privatePackage := Seq("org.apache.pekko.osgi.impl"), - // pekko-actor packages are not imported, as contained in the CP - OsgiKeys.importPackage := (osgiOptionalImports.map(optionalResolution)) ++ Seq( - "!sun.misc", - scalaJava8CompatImport(), - scalaVersion(scalaImport).value, - configImport(), - "*"), - // dynamicImportPackage needed for loading classes defined in configuration - OsgiKeys.dynamicImportPackage := Seq("*")) - - val actorTyped = exports(Seq("org.apache.pekko.actor.typed.*")) - - val cluster = exports(Seq("org.apache.pekko.cluster.*")) - - val clusterTools = exports(Seq("org.apache.pekko.cluster.singleton.*", "org.apache.pekko.cluster.client.*", - "org.apache.pekko.cluster.pubsub.*")) - - val clusterSharding = exports(Seq("org.apache.pekko.cluster.sharding.*")) - - val clusterMetrics = exports(Seq("org.apache.pekko.cluster.metrics.*"), imports = Seq(kamonImport(), sigarImport())) - - val distributedData = exports(Seq("org.apache.pekko.cluster.ddata.*")) - - val osgi = exports(Seq("org.apache.pekko.osgi.*")) - - val protobufV3 = osgiSettings ++ Seq( - OsgiKeys.importPackage := Seq( - "!sun.misc", - scalaJava8CompatImport(), - scalaVersion(scalaImport).value, - configImport(), - "*"), - OsgiKeys.exportPackage := Seq("org.apache.pekko.protobufv3.internal.*"), - OsgiKeys.privatePackage := Seq("google.protobuf.*")) - - val jackson = exports(Seq("org.apache.pekko.serialization.jackson.*")) - - val remote = exports(Seq("org.apache.pekko.remote.*")) - - val stream = - exports( - packages = Seq("org.apache.pekko.stream.*", "com.typesafe.sslconfig.pekko.*"), - imports = Seq( - scalaJava8CompatImport(), - scalaParsingCombinatorImport(), - sslConfigCoreImport("com.typesafe.sslconfig.ssl.*"), - sslConfigCoreImport("com.typesafe.sslconfig.util.*"), - "!com.typesafe.sslconfig.pekko.*")) - - val streamTestkit = exports(Seq("org.apache.pekko.stream.testkit.*")) - - val slf4j = exports(Seq("org.apache.pekko.event.slf4j.*")) - - val persistence = exports( - Seq("org.apache.pekko.persistence.*"), - imports = Seq(optionalResolution("org.fusesource.leveldbjni.*"), optionalResolution("org.iq80.leveldb.*"))) - - val persistenceTyped = exports(Seq("org.apache.pekko.persistence.typed.*")) - - val persistenceQuery = exports(Seq("org.apache.pekko.persistence.query.*")) - - val testkit = exports(Seq("org.apache.pekko.testkit.*")) - - val discovery = exports(Seq("org.apache.pekko.discovery.*")) - - val coordination = exports(Seq("org.apache.pekko.coordination.*")) - - val osgiOptionalImports = Seq( - // needed because testkit is normally not used in the application bundle, - // but it should still be included as transitive dependency and used by BundleDelegatingClassLoader - // to be able to find reference.conf - "org.apache.pekko.testkit") - - def exports(packages: Seq[String] = Seq(), imports: Seq[String] = Nil) = - osgiSettings ++ Seq( - OsgiKeys.importPackage := imports ++ scalaVersion(defaultImports).value, - OsgiKeys.exportPackage := packages) - def defaultImports(scalaVersion: String) = - Seq( - "!sun.misc", - pekkoImport(), - configImport(), - "!scala.compat.java8.*", - "!scala.util.parsing.*", - scalaImport(scalaVersion), - "*") - def pekkoImport(packageName: String = "org.apache.pekko.*") = versionedImport(packageName, "1.0", "1.1") - def configImport(packageName: String = "com.typesafe.config.*") = versionedImport(packageName, "1.4.0", "1.5.0") - def scalaImport(version: String) = { - val packageName = "scala.*" - val ScalaVersion = """(\d+)\.(\d+)\..*""".r - val ScalaVersion(epoch, major) = version - versionedImport(packageName, s"$epoch.$major", s"$epoch.${major.toInt + 1}") - } - def scalaJava8CompatImport(packageName: String = "scala.compat.java8.*") = - versionedImport(packageName, "1.0.2", "1.0.2") - def scalaParsingCombinatorImport(packageName: String = "scala.util.parsing.combinator.*") = - versionedImport(packageName, "1.1.0", "1.2.0") - def sslConfigCoreImport(packageName: String = "com.typesafe.sslconfig") = - versionedImport(packageName, "0.4.0", "1.0.0") - def sslConfigCoreSslImport(packageName: String = "com.typesafe.sslconfig.ssl.*") = - versionedImport(packageName, "0.4.0", "1.0.0") - def sslConfigCoreUtilImport(packageName: String = "com.typesafe.sslconfig.util.*") = - versionedImport(packageName, "0.4.0", "1.0.0") - def kamonImport(packageName: String = "kamon.sigar.*") = - optionalResolution(versionedImport(packageName, "1.6.5", "1.6.6")) - def sigarImport(packageName: String = "org.hyperic.*") = - optionalResolution(versionedImport(packageName, "1.6.5", "1.6.6")) - def optionalResolution(packageName: String) = "%s;resolution:=optional".format(packageName) - def versionedImport(packageName: String, lower: String, upper: String) = s"""$packageName;version="[$lower,$upper)"""" -}