mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
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:
parent
22f8b35700
commit
ab95053af8
12
README.md
12
README.md
@ -39,15 +39,15 @@ Now you should be able to add Bitcoin-S artifacts like this:
|
||||
|
||||
```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()
|
||||
```
|
||||
|
@ -6,9 +6,9 @@ import scala.io.Source
|
||||
object BlockBench extends App {
|
||||
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 result = block // call-by-name
|
||||
val _ = block() // call-by-name
|
||||
val t1 = System.currentTimeMillis()
|
||||
val time = t1 - t0
|
||||
logger.info("Elapsed time: " + (time) + "ms")
|
||||
@ -19,7 +19,7 @@ object BlockBench extends App {
|
||||
val fileName =
|
||||
"/00000000000000000008513c860373da0484f065983aeb063ebf81c172e81d48.txt"
|
||||
val lines = Source.fromURL(getClass.getResource(fileName)).mkString
|
||||
val time = timeBlockParsing(Block.fromHex(lines))
|
||||
val time = timeBlockParsing(() => Block.fromHex(lines))
|
||||
require(time <= 15000)
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ object BlockBench extends App {
|
||||
val fileName =
|
||||
"/000000000000000000050f70113ab1932c195442cb49bcc4ee4d7f426c8a3295.txt"
|
||||
val lines = Source.fromURL(getClass.getResource(fileName)).mkString
|
||||
val time = timeBlockParsing(Block.fromHex(lines))
|
||||
val time = timeBlockParsing(() => Block.fromHex(lines))
|
||||
require(time <= 15000)
|
||||
}
|
||||
|
||||
|
15
build.sbt
15
build.sbt
@ -35,6 +35,7 @@ lazy val commonSettings = List(
|
||||
scalacOptions in Compile := compilerOpts,
|
||||
|
||||
scalacOptions in Test := testCompilerOpts,
|
||||
|
||||
assemblyOption in assembly := (assemblyOption in assembly).value
|
||||
.copy(includeScala = false),
|
||||
|
||||
@ -94,6 +95,7 @@ lazy val root = project
|
||||
doc
|
||||
)
|
||||
.settings(commonSettings: _*)
|
||||
.settings(crossScalaVersions := Nil)
|
||||
|
||||
|
||||
lazy val secp256k1jni = project
|
||||
@ -101,7 +103,11 @@ lazy val secp256k1jni = project
|
||||
.settings(commonSettings: _*)
|
||||
.settings(
|
||||
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()
|
||||
|
||||
@ -117,6 +123,7 @@ lazy val coreTest = project
|
||||
.in(file("core-test"))
|
||||
.enablePlugins()
|
||||
.settings(commonSettings: _*)
|
||||
.settings(skip in publish := true)
|
||||
.dependsOn(
|
||||
core,
|
||||
)
|
||||
@ -145,7 +152,8 @@ lazy val bench = project
|
||||
.settings(commonSettings: _*)
|
||||
.settings(
|
||||
libraryDependencies ++= Deps.bench,
|
||||
name := "bitcoin-s-bench"
|
||||
name := "bitcoin-s-bench",
|
||||
skip in publish := true
|
||||
)
|
||||
.dependsOn(core)
|
||||
|
||||
@ -173,7 +181,8 @@ lazy val doc = project
|
||||
.in(file("doc"))
|
||||
.settings(
|
||||
name := "bitcoin-s-doc",
|
||||
libraryDependencies ++= Deps.doc
|
||||
libraryDependencies ++= Deps.doc,
|
||||
skip in publish := true
|
||||
)
|
||||
.dependsOn(
|
||||
secp256k1jni,
|
||||
|
@ -1,5 +1,5 @@
|
||||
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"
|
||||
|
@ -17,7 +17,7 @@ object Deps {
|
||||
val nativeLoaderV = "2.3.2"
|
||||
val typesafeConfigV = "1.3.3"
|
||||
|
||||
val bitcoinsV = "0.0.2"
|
||||
val bitcoinsV = "0.0.2-SNAPSHOT"
|
||||
}
|
||||
|
||||
object Compile {
|
||||
@ -46,13 +46,13 @@ object Deps {
|
||||
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 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(
|
||||
Compile.bouncycastle,
|
||||
Compile.scodec,
|
||||
Compile.slf4j
|
||||
val core = List(
|
||||
Compile.bouncycastle,
|
||||
Compile.scodec,
|
||||
Compile.slf4j
|
||||
)
|
||||
|
||||
val secp256k1jni = List(
|
||||
|
@ -2,7 +2,7 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")
|
||||
|
||||
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")
|
||||
|
||||
|
@ -18,8 +18,13 @@ class BitcoindInstanceTest extends AsyncFlatSpec with BeforeAndAfterAll {
|
||||
private implicit val actorSystem: ActorSystem = ActorSystem(
|
||||
"BitcoindInstanceTest")
|
||||
|
||||
private val sampleConf: Seq[String] =
|
||||
Source.fromResource("sample-bitcoin.conf").mkString.split("\n")
|
||||
private val source =
|
||||
Source.fromURL(getClass.getResource("/sample-bitcoin.conf"))
|
||||
|
||||
private val sampleConf: Seq[String] = {
|
||||
source.getLines.toSeq
|
||||
}
|
||||
|
||||
private val datadir: Path = Files.createTempDirectory(null)
|
||||
|
||||
override protected def beforeAll(): Unit = {
|
||||
|
@ -6,3 +6,10 @@ name := "bitcoin-s-secp256k1jni"
|
||||
autoScalaLibrary := false // exclude scala-library from dependencies
|
||||
|
||||
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")
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ trait EclairTestUtil extends BitcoinSLogger {
|
||||
uri = new URI("http://localhost:18333"),
|
||||
rpcUri = new URI(s"http://localhost:${bitcoindRpcPort}"),
|
||||
authCredentials =
|
||||
eclairRpcClient.instance.authCredentials.bitcoinAuthOpt.get,
|
||||
eclairRpcClient.instance.authCredentials.bitcoinAuthOpt.get
|
||||
)
|
||||
new BitcoindRpcClient(bitcoindInstance)
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ import org.bitcoins.rpc.config.{
|
||||
import org.bitcoins.rpc.util.RpcUtil
|
||||
|
||||
import scala.collection.immutable.Map
|
||||
import scala.collection.JavaConverters.{asScalaSet, mapAsJavaMap}
|
||||
|
||||
import scala.concurrent.duration.{DurationInt, FiniteDuration}
|
||||
import scala.concurrent.{ExecutionContext, Future, Promise}
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
trait BitcoindRpcTestUtil extends BitcoinSLogger {
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
def randomDirName: String =
|
||||
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",
|
||||
"prune" -> (if (pruneMode) "1" else "0")
|
||||
)
|
||||
val javaMap = mapAsJavaMap(values)
|
||||
val javaMap = values.asJava
|
||||
|
||||
ConfigFactory.parseMap(javaMap)
|
||||
}
|
||||
@ -66,7 +66,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
|
||||
zmqPort: Int,
|
||||
pruneMode: Boolean): BitcoindAuthCredentials = {
|
||||
val conf = config(uri, rpcUri, zmqPort, pruneMode)
|
||||
val confSet = asScalaSet(conf.entrySet).toSet
|
||||
val confSet = conf.entrySet.asScala
|
||||
val confStr =
|
||||
confSet
|
||||
.map(entry => {
|
||||
|
Loading…
Reference in New Issue
Block a user