You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by nv...@apache.org on 2023/01/12 11:37:42 UTC

[incubator-pekko-persistence-cassandra] branch main updated: Adds license and notice to jar (#12)

This is an automated email from the ASF dual-hosted git repository.

nvollmar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-cassandra.git


The following commit(s) were added to refs/heads/main by this push:
     new 05b18ba  Adds license and notice to jar (#12)
05b18ba is described below

commit 05b18ba9ac630d7e96011b3b061410c3a55d9cc9
Author: Nicolas Vollmar <nv...@gmail.com>
AuthorDate: Thu Jan 12 12:37:37 2023 +0100

    Adds license and notice to jar (#12)
---
 build.sbt                              |  3 +++
 project/MetaInfLicenseNoticeCopy.scala | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/build.sbt b/build.sbt
index 512dd39..e07df2a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -22,6 +22,7 @@ dumpSchema := (core / Test / runMain).toTask(" akka.persistence.cassandra.PrintC
 lazy val core = project
   .in(file("core"))
   .enablePlugins(Common, AutomateHeaderPlugin, MultiJvmPlugin)
+  .settings(MetaInfLicenseNoticeCopy.settings)
   .dependsOn(cassandraLauncher % Test)
   .settings(
     name := "akka-persistence-cassandra",
@@ -33,6 +34,7 @@ lazy val core = project
 lazy val cassandraLauncher = project
   .in(file("cassandra-launcher"))
   .enablePlugins(Common)
+  .settings(MetaInfLicenseNoticeCopy.settings)
   .settings(
     name := "akka-persistence-cassandra-launcher",
     Compile / managedResourceDirectories += (cassandraBundle / target).value / "bundle",
@@ -43,6 +45,7 @@ lazy val cassandraLauncher = project
 lazy val cassandraBundle = project
   .in(file("cassandra-bundle"))
   .enablePlugins(Common, AutomateHeaderPlugin)
+  .settings(MetaInfLicenseNoticeCopy.settings)
   .settings(
     name := "akka-persistence-cassandra-bundle",
     crossPaths := false,
diff --git a/project/MetaInfLicenseNoticeCopy.scala b/project/MetaInfLicenseNoticeCopy.scala
new file mode 100644
index 0000000..4734c4d
--- /dev/null
+++ b/project/MetaInfLicenseNoticeCopy.scala
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+import sbt.Keys._
+import sbt.{ Def, _ }
+
+/**
+ * Copies LICENSE and NOTICE files into jar META-INF dir
+ */
+object MetaInfLicenseNoticeCopy {
+
+  val settings: Seq[Setting[_]] = inConfig(Compile)(
+    Seq(
+      resourceGenerators += copyFileToMetaInf(resourceManaged, "LICENSE"),
+      resourceGenerators += copyFileToMetaInf(resourceManaged, "NOTICE")))
+
+  def copyFileToMetaInf(dir: SettingKey[File], fileName: String): Def.Initialize[Task[Seq[sbt.File]]] =
+    Def.task[Seq[File]] {
+      val fromFile = (LocalRootProject / baseDirectory).value / fileName
+      val toFile = resourceManaged.value / "META-INF" / fileName
+      IO.copyFile(fromFile, toFile)
+      Seq(toFile)
+    }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org