Skip to content

Commit

Permalink
fixes for sonatype publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
winitzki committed May 16, 2017
1 parent e2c0aec commit 9fbcee8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
27 changes: 25 additions & 2 deletions build.sbt
@@ -1,13 +1,16 @@
val commonSettings = Defaults.coreDefaultSettings ++ Seq(
organization := "io.chymyst",
version := "0.0.1",
version := "0.0.2",
scalaVersion in ThisBuild := "2.12.2",
crossScalaVersions := Seq("2.11.11", "2.12.2"),
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
"Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
),
licenses := Seq("Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://chymyst.github.io/chymyst-core/")),
description := "Declarative concurrency framework for Scala - the standard library implementing the concurrency patterns",

scalacOptions ++= Seq(// https://tpolecat.github.io/2014/04/11/scalac-flags.html
"-deprecation",
Expand Down Expand Up @@ -63,7 +66,27 @@ lazy val chymyst = (project in file("."))
tutTargetDirectory := baseDirectory.value / "docs",
scalacOptions in Tut := scalacOptions.value.filterNot(disableWarningsForTut.contains),
libraryDependencies ++= Seq(
"io.chymyst" %% "core" % "latest.integration",
"io.chymyst" %% "chymyst-core" % "0.1.9",
"org.scalatest" %% "scalatest" % "3.0.1" % Test
)
)

/////////////////////////////////////////////////////////////////////////////////////////////////////
// Publishing to Sonatype Maven repository
publishMavenStyle := true
//
// pomIncludeRepository := { _ => false } // not sure we need this.
// http://www.scala-sbt.org/release/docs/Using-Sonatype.html says we might need it
// because "sometimes we have optional dependencies for special features".
//
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")
}
//
publishArtifact in Test := false
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
3 changes: 3 additions & 0 deletions project/plugins.sbt
Expand Up @@ -2,3 +2,6 @@ logLevel := Level.Warn
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.5.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.0.3")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

17 changes: 17 additions & 0 deletions sonatype.sbt
@@ -0,0 +1,17 @@
// Following instructions from https://github.com/xerial/sbt-sonatype
// see https://issues.sonatype.org/browse/OSSRH-27720
pomExtra in Global :=
<inceptionYear>2016</inceptionYear>
<scm>
<url>git@github.com:Chymyst/Chymyst.git</url>
<connection>scm:git:git@github.com:Chymyst/Chymyst.git</connection>
</scm>
<developers>
<developer>
<id>winitzki</id>
<name>Sergei Winitzki</name>
<url>https://sites.google.com/site/winitzki</url>
</developer>
</developers>

sonatypeProfileName := "winitzki"
25 changes: 24 additions & 1 deletion src/main/scala/io/chymyst/lab/package.scala
Expand Up @@ -52,7 +52,30 @@ package object lab {
}(ec)
}

def litmus[T](pool: Pool): (M[T], B[Unit, T]) = {
/** Implement a blocking wait until a reaction has run.
*
* This creates a pair of new emitters (one blocking, one non-blocking) and a reaction
* that allows users to fetch the value carried by the non-blocking molecule.
*
* Sample usage:
*
* {{{
* val (carrier, fetch) = litmus[Int]
* // emit carrier() from our reaction
* site(go { case a(x) + c(y) ⇒
* val z = x + y // some computation
* carrier(z)
* })
* a(123) // emit some molecules
* ...
* val result = fetch() // block and wait for the reaction
* }}}
*
* @param pool A thread pool on which the reaction should run. The default reaction pool is used if this argument is not supplied.
* @tparam T Type of value carried by the non-blocking molecule and fetched by the blocking molecule.
* @return A pair of new emitters.
*/
def litmus[T](pool: Pool = defaultReactionPool): (M[T], B[Unit, T]) = {
val carrier = m[T]
val fetch = b[Unit, T]
site(pool)(
Expand Down

0 comments on commit 9fbcee8

Please sign in to comment.