version 0.0.3 (#290)

* version 0.0.3

* Fix cross compile issues so we can now compile and publish a dependency for the scala 2.11 series

scalafmt

* bump versions on readme, try to fix scoverage crossversion issue

* Downgrade scoverage to try and get it to work with ci

* Tinker with scoverage versions

* Add suggestion from scoverage people to exclude secp256k1jni from build coverage
This commit is contained in:
Chris Stewart 2019-01-10 09:07:18 -06:00 committed by GitHub
parent 2dc798d856
commit 9dfbc9ed24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 29 deletions

View file

@ -39,15 +39,15 @@ Now you should be able to add Bitcoin-S artifacts like this:
```scala ```scala
"org.bitcoins" % "bitcoin-s-secp256k1jni" % "0.0.1" "org.bitcoins" % "bitcoin-s-secp256k1jni" % "0.0.3"
"org.bitcoins" %% "bitcoin-s-core" % "0.0.1" withSources() withJavadoc() "org.bitcoins" %% "bitcoin-s-core" % "0.0.3" withSources() withJavadoc()
"org.bitcoins" %% "bitcoin-s-bitcoind-rpc" % "0.0.1" withSources() withJavadoc() "org.bitcoins" %% "bitcoin-s-bitcoind-rpc" % "0.0.3" withSources() withJavadoc()
"org.bitcoins" %% "bitcoin-s-eclair-rpc" % "0.0.1" withSources() withJavadoc() "org.bitcoins" %% "bitcoin-s-eclair-rpc" % "0.0.3" withSources() withJavadoc()
"org.bitcoins" %% "bitcoin-s-testkit" % "0.0.1" withSources() withJavadoc() "org.bitcoins" %% "bitcoin-s-testkit" % "0.0.3" withSources() withJavadoc()
"org.bitcoins" %% "bitcoin-s-zmq" % "0.0.1" withSources() withJavadoc() "org.bitcoins" %% "bitcoin-s-zmq" % "0.0.3" withSources() withJavadoc()
``` ```

View file

@ -6,9 +6,9 @@ import scala.io.Source
object BlockBench extends App { object BlockBench extends App {
private def logger = LoggerFactory.getLogger(this.getClass.getSimpleName) private def logger = LoggerFactory.getLogger(this.getClass.getSimpleName)
private def timeBlockParsing[R](block: => R): Long = { private def timeBlockParsing[R](block: () => R): Long = {
val t0 = System.currentTimeMillis() val t0 = System.currentTimeMillis()
val result = block // call-by-name val _ = block() // call-by-name
val t1 = System.currentTimeMillis() val t1 = System.currentTimeMillis()
val time = t1 - t0 val time = t1 - t0
logger.info("Elapsed time: " + (time) + "ms") logger.info("Elapsed time: " + (time) + "ms")
@ -19,7 +19,7 @@ object BlockBench extends App {
val fileName = val fileName =
"/00000000000000000008513c860373da0484f065983aeb063ebf81c172e81d48.txt" "/00000000000000000008513c860373da0484f065983aeb063ebf81c172e81d48.txt"
val lines = Source.fromURL(getClass.getResource(fileName)).mkString val lines = Source.fromURL(getClass.getResource(fileName)).mkString
val time = timeBlockParsing(Block.fromHex(lines)) val time = timeBlockParsing(() => Block.fromHex(lines))
require(time <= 15000) require(time <= 15000)
} }
@ -27,7 +27,7 @@ object BlockBench extends App {
val fileName = val fileName =
"/000000000000000000050f70113ab1932c195442cb49bcc4ee4d7f426c8a3295.txt" "/000000000000000000050f70113ab1932c195442cb49bcc4ee4d7f426c8a3295.txt"
val lines = Source.fromURL(getClass.getResource(fileName)).mkString val lines = Source.fromURL(getClass.getResource(fileName)).mkString
val time = timeBlockParsing(Block.fromHex(lines)) val time = timeBlockParsing(() => Block.fromHex(lines))
require(time <= 15000) require(time <= 15000)
} }

View file

@ -35,6 +35,7 @@ lazy val commonSettings = List(
scalacOptions in Compile := compilerOpts, scalacOptions in Compile := compilerOpts,
scalacOptions in Test := testCompilerOpts, scalacOptions in Test := testCompilerOpts,
assemblyOption in assembly := (assemblyOption in assembly).value assemblyOption in assembly := (assemblyOption in assembly).value
.copy(includeScala = false), .copy(includeScala = false),
@ -94,6 +95,7 @@ lazy val root = project
doc doc
) )
.settings(commonSettings: _*) .settings(commonSettings: _*)
.settings(crossScalaVersions := Nil)
lazy val secp256k1jni = project lazy val secp256k1jni = project
@ -101,7 +103,11 @@ lazy val secp256k1jni = project
.settings(commonSettings: _*) .settings(commonSettings: _*)
.settings( .settings(
libraryDependencies ++= Deps.secp256k1jni, libraryDependencies ++= Deps.secp256k1jni,
unmanagedResourceDirectories in Compile += baseDirectory.value / "natives" unmanagedResourceDirectories in Compile += baseDirectory.value / "natives",
//since this is not a scala module, we have no code coverage
//this also doesn't place nice with scoverage, see
//https://github.com/scoverage/sbt-scoverage/issues/275
coverageEnabled := false
) )
.enablePlugins() .enablePlugins()
@ -117,6 +123,7 @@ lazy val coreTest = project
.in(file("core-test")) .in(file("core-test"))
.enablePlugins() .enablePlugins()
.settings(commonSettings: _*) .settings(commonSettings: _*)
.settings(skip in publish := true)
.dependsOn( .dependsOn(
core, core,
) )
@ -145,7 +152,8 @@ lazy val bench = project
.settings(commonSettings: _*) .settings(commonSettings: _*)
.settings( .settings(
libraryDependencies ++= Deps.bench, libraryDependencies ++= Deps.bench,
name := "bitcoin-s-bench" name := "bitcoin-s-bench",
skip in publish := true
) )
.dependsOn(core) .dependsOn(core)
@ -173,7 +181,8 @@ lazy val doc = project
.in(file("doc")) .in(file("doc"))
.settings( .settings(
name := "bitcoin-s-doc", name := "bitcoin-s-doc",
libraryDependencies ++= Deps.doc libraryDependencies ++= Deps.doc,
skip in publish := true
) )
.dependsOn( .dependsOn(
secp256k1jni, secp256k1jni,

View file

@ -1,5 +1,5 @@
scalaVersion in ThisBuild := "2.12.7" scalaVersion in ThisBuild := "2.12.7"
crossScalaVersions := Seq("2.11.12", "2.12.7") crossScalaVersions in ThisBuild := List("2.11.12", "2.12.7")
organization in ThisBuild := "org.bitcoins" organization in ThisBuild := "org.bitcoins"

View file

@ -17,7 +17,7 @@ object Deps {
val nativeLoaderV = "2.3.2" val nativeLoaderV = "2.3.2"
val typesafeConfigV = "1.3.3" val typesafeConfigV = "1.3.3"
val bitcoinsV = "0.0.2" val bitcoinsV = "0.0.2-SNAPSHOT"
} }
object Compile { object Compile {
@ -46,13 +46,13 @@ object Deps {
val akkaHttp = "com.typesafe.akka" %% "akka-http-testkit" % V.akkav % "test" withSources() withJavadoc() val akkaHttp = "com.typesafe.akka" %% "akka-http-testkit" % V.akkav % "test" withSources() withJavadoc()
val akkaStream = "com.typesafe.akka" %% "akka-stream-testkit" % V.akkaStreamv % "test" withSources() withJavadoc() val akkaStream = "com.typesafe.akka" %% "akka-stream-testkit" % V.akkaStreamv % "test" withSources() withJavadoc()
val testkit = "org.bitcoins" %% "bitcoin-s-testkit" % V.bitcoinsV withSources() withJavadoc() val testkit = "org.bitcoins" %% "bitcoin-s-testkit" % V.bitcoinsV % "test" withSources() withJavadoc()
} }
val core = List( val core = List(
Compile.bouncycastle, Compile.bouncycastle,
Compile.scodec, Compile.scodec,
Compile.slf4j Compile.slf4j
) )
val secp256k1jni = List( val secp256k1jni = List(

View file

@ -2,7 +2,7 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.14") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.14")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0-M5")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

View file

@ -18,8 +18,13 @@ class BitcoindInstanceTest extends AsyncFlatSpec with BeforeAndAfterAll {
private implicit val actorSystem: ActorSystem = ActorSystem( private implicit val actorSystem: ActorSystem = ActorSystem(
"BitcoindInstanceTest") "BitcoindInstanceTest")
private val sampleConf: Seq[String] = private val source =
Source.fromResource("sample-bitcoin.conf").mkString.split("\n") Source.fromURL(getClass.getResource("/sample-bitcoin.conf"))
private val sampleConf: Seq[String] = {
source.getLines.toSeq
}
private val datadir: Path = Files.createTempDirectory(null) private val datadir: Path = Files.createTempDirectory(null)
override protected def beforeAll(): Unit = { override protected def beforeAll(): Unit = {

View file

@ -6,3 +6,10 @@ name := "bitcoin-s-secp256k1jni"
autoScalaLibrary := false // exclude scala-library from dependencies autoScalaLibrary := false // exclude scala-library from dependencies
crossPaths := false // drop off Scala suffix from artifact names. crossPaths := false // drop off Scala suffix from artifact names.
//sbt documents recommend setting scalaversion to a fixed value
//to avoid double publishing
//https://www.scala-sbt.org/1.x/docs/Cross-Build.html
crossScalaVersions := {
List("2.12.7")
}

View file

@ -337,7 +337,7 @@ trait EclairTestUtil extends BitcoinSLogger {
uri = new URI("http://localhost:18333"), uri = new URI("http://localhost:18333"),
rpcUri = new URI(s"http://localhost:${bitcoindRpcPort}"), rpcUri = new URI(s"http://localhost:${bitcoindRpcPort}"),
authCredentials = authCredentials =
eclairRpcClient.instance.authCredentials.bitcoinAuthOpt.get, eclairRpcClient.instance.authCredentials.bitcoinAuthOpt.get
) )
new BitcoindRpcClient(bitcoindInstance) new BitcoindRpcClient(bitcoindInstance)
} }

View file

@ -18,13 +18,13 @@ import org.bitcoins.rpc.config.{
import org.bitcoins.rpc.util.RpcUtil import org.bitcoins.rpc.util.RpcUtil
import scala.collection.immutable.Map import scala.collection.immutable.Map
import scala.collection.JavaConverters.{asScalaSet, mapAsJavaMap}
import scala.concurrent.duration.{DurationInt, FiniteDuration} import scala.concurrent.duration.{DurationInt, FiniteDuration}
import scala.concurrent.{ExecutionContext, Future, Promise} import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.{Failure, Success, Try} import scala.util.{Failure, Success, Try}
trait BitcoindRpcTestUtil extends BitcoinSLogger { trait BitcoindRpcTestUtil extends BitcoinSLogger {
import scala.collection.JavaConverters._
def randomDirName: String = def randomDirName: String =
0.until(5).map(_ => scala.util.Random.alphanumeric.head).mkString 0.until(5).map(_ => scala.util.Random.alphanumeric.head).mkString
@ -51,7 +51,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
"zmqpubrawblock" -> s"tcp://127.0.0.1:$zmqPort", "zmqpubrawblock" -> s"tcp://127.0.0.1:$zmqPort",
"prune" -> (if (pruneMode) "1" else "0") "prune" -> (if (pruneMode) "1" else "0")
) )
val javaMap = mapAsJavaMap(values) val javaMap = values.asJava
ConfigFactory.parseMap(javaMap) ConfigFactory.parseMap(javaMap)
} }
@ -66,7 +66,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
zmqPort: Int, zmqPort: Int,
pruneMode: Boolean): BitcoindAuthCredentials = { pruneMode: Boolean): BitcoindAuthCredentials = {
val conf = config(uri, rpcUri, zmqPort, pruneMode) val conf = config(uri, rpcUri, zmqPort, pruneMode)
val confSet = asScalaSet(conf.entrySet).toSet val confSet = conf.entrySet.asScala
val confStr = val confStr =
confSet confSet
.map(entry => { .map(entry => {

View file

@ -1 +1 @@
version in ThisBuild := "0.0.3-SNAPSHOT" version in ThisBuild := "0.0.3"