From e2bfc0084bf9d226ddcdcea5f1273373eee29f18 Mon Sep 17 00:00:00 2001 From: Mateusz Kubuszok Date: Sun, 19 Aug 2018 18:09:16 +0200 Subject: [PATCH] Added publishing settings --- catnip.sbt | 9 +++--- project/Settings.scala | 62 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/catnip.sbt b/catnip.sbt index 56e71d5..37feab5 100644 --- a/catnip.sbt +++ b/catnip.sbt @@ -6,6 +6,7 @@ lazy val root = project.root .setName("catnip") .setDescription("Catnip build") .configureRoot + .noPublish .aggregate(catnipJVM, catnipJS, catnipTestsJVM, catnipTestsJS) lazy val catnip = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Pure).build.from("catnip") @@ -13,11 +14,8 @@ lazy val catnip = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Pure .setDescription("Macro annotations for Kittens library") .setInitialImport("cats.implicits._") .configureModule - .settings( -// "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided, -// "org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided, - addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross sbt.CrossVersion.patch) - ) + .publish + .settings(addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross sbt.CrossVersion.patch)) lazy val catnipJVM = catnip.jvm lazy val catnipJS = catnip.js @@ -29,6 +27,7 @@ lazy val catnipTests = crossProject(JVMPlatform, JSPlatform).crossType(CrossType .dependsOn(catnip) .configureModule .configureTests() + .noPublish .settings(libraryDependencies ++= Seq( "org.specs2" %%% "specs2-core" % Dependencies.specs2Version % "test", "org.specs2" %%% "specs2-scalacheck" % Dependencies.specs2Version % "test", diff --git a/project/Settings.scala b/project/Settings.scala index 56154aa..652e04e 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -92,11 +92,6 @@ object Settings extends Dependencies { Global / cancelable := true, -// Compile / fork := true, -// Compile / trapExit := false, -// Compile / connectInput := true, -// Compile / outputStrategy := Some(StdoutOutput), - resolvers ++= commonResolvers, Compile / scalafmtOnCompile := true, @@ -118,12 +113,69 @@ object Settings extends Dependencies { ) ) ++ mainDeps + private val publishSettings = Seq( + organization := "io.scalaland", + homepage := Some(url("https://scalaland.io")), + licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), + scmInfo := Some( + ScmInfo(url("https://github.com/scalalandio/catnip"), "scm:git:git@github.com:scalalandio/catnip.git") + ), + publishTo := { + val nexus = "https://oss.sonatype.org/" + if (isSnapshot.value) + Some("snapshots" at nexus + "content/repositories/snapshots") + else + Some("releases" at nexus + "service/local/staging/deploy/maven2") + }, + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := { _ => + false + }, + pomExtra := ( + + + krzemin + Piotr KrzemiƄski + http://github.com/krzemin + + + MateuszKubuszok + Mateusz Kubuszok + http://github.com/MateuszKubuszok + + + ) + ) + + private val noPublishSettings = + Seq(skip in publish := true, publishArtifact := false) + implicit class RunConfigurator(project: CrossProject) { def configureRun(main: String): CrossProject = project .settings(Compile / run / mainClass := Some(main)) } + implicit class PublishRootConfigurator(project: Project) { + + def publish: Project = project + .settings(publishSettings) + + def noPublish: Project = project + .settings(noPublishSettings) + } + + + implicit class PublishConfigurator(project: CrossProject) { + + def publish: CrossProject = project + .settings(publishSettings) + + def noPublish: CrossProject = project + .settings(noPublishSettings) + } + abstract class TestConfigurator(project: CrossProject, config: Configuration) { protected def configure(requiresFork: Boolean): CrossProject = project