Skip to content

Commit

Permalink
Added publishing settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszKubuszok committed Aug 19, 2018
1 parent 088daf8 commit e2bfc00
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 10 deletions.
9 changes: 4 additions & 5 deletions catnip.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ 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")
.setName("catnip")
.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
Expand All @@ -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",
Expand Down
62 changes: 57 additions & 5 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:[email protected]: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 := (
<developers>
<developer>
<id>krzemin</id>
<name>Piotr Krzemiński</name>
<url>http://github.com/krzemin</url>
</developer>
<developer>
<id>MateuszKubuszok</id>
<name>Mateusz Kubuszok</name>
<url>http://github.com/MateuszKubuszok</url>
</developer>
</developers>
)
)

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
Expand Down

0 comments on commit e2bfc00

Please sign in to comment.