Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
refactoring to use rig
Browse files Browse the repository at this point in the history
  • Loading branch information
timperrett committed Oct 3, 2016
1 parent 82c8f03 commit 758e08f
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 255 deletions.
33 changes: 28 additions & 5 deletions .travis.yml
@@ -1,28 +1,51 @@
language: scala

language: scala
scala:
- 2.10.6
- 2.11.8
- 2.11.7

jdk:
- oraclejdk8

# don't pointlessly build tags and dev branches
branches:
only:
- master
- master

# push onto the new gce infra on travis
sudo: required

before_script:
- "if [ $TRAVIS_PULL_REQUEST = 'false' ]; then git checkout -qf $TRAVIS_BRANCH; fi"

script:
- sbt -J-Xss6M -J-Xmx4G ++$TRAVIS_SCALA_VERSION validate
- |
if [ $TRAVIS_PULL_REQUEST = 'false' ]; then
if [ $RELEASE_ON_PUSH = 'false' ]; then
sbt ++$TRAVIS_SCALA_VERSION test coverageReport
else
sbt ++$TRAVIS_SCALA_VERSION 'release with-defaults'
fi
else
sbt ++$TRAVIS_SCALA_VERSION test coverageReport
fi
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/scala-$TRAVIS_SCALA_VERSION

after_success:
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
# - "bash <(curl -s https://codecov.io/bash) -r $TRAVIS_REPO_SLUG -t $CODECOV_TOKEN"

env:
global:
- secure: "mxN1J+HCnrVp2O4xOHNebxNSNhpcmFhs+I3TUMvOzCvMZey4n27YJ2KUTrJGrpJHlljtOgAmZEsZzKlrdIbRHK4MLSBiDpHedmWZS1VtR31g05jFgfarQRiLdTgsd4dFkdQIycpXagGPtVjoCGZAE1JKTKWF9W6RKNBJhuTXebg="
- secure: "m43l8ieQq84587jR1KpBjsvVnMzbzDoFDTU7HS+V1WAeYcopUH84gxTOTiqXaPgWkixIhX+MfQqzYzToocee2dSOlUfn6kH+VNXwx29RNoivAFXpm6tIaBRqC5fSLxLZpdA4BxNuKiZcc3nEMgYhpsuynGVo1OAZ/qx3u/80tZ4="

notifications:
irc:
channels:
Expand Down
9 changes: 2 additions & 7 deletions benchmark/client/build.sbt
@@ -1,13 +1,8 @@
import common._

promptSettings

assemblySettings

mergeSettings

macrosSettings
common.mergeSettings

scalacOptions ++= Seq("-language:postfixOps", "-language:reflectiveCalls")

publish := {}
enablePlugins(DisablePublishingPlugin)
7 changes: 2 additions & 5 deletions benchmark/protocol/build.sbt
@@ -1,7 +1,4 @@
import common._

promptSettings
scalacOptions in Compile := (scalacOptions in Compile).value.filterNot(f => f == "-Xlint" || f == "-Xfatal-warnings")

macrosSettings

publish := {}
enablePlugins(DisablePublishingPlugin)
8 changes: 4 additions & 4 deletions benchmark/protocol/src/main/scala/Protocol.scala
Expand Up @@ -40,16 +40,16 @@ case class SmallW(alpha: Map[String,String],
case class BigW(one: Int)

object protocol {

implicit val smallWCodec: Codec[SmallW] =
(map(utf8,utf8) ~~ list(utf8)).widenAs[SmallW](SmallW.apply, SmallW.unapply)

implicit val mediumWCodec: Codec[MediumW] =
(int32 ~~ utf8 ~~ list[SmallW] ~~ optional(int32)).widenAs(MediumW.apply, MediumW.unapply)

implicit val largeWCodec: Codec[LargeW] =
(int32 ~~ list(utf8) ~~ utf8 ~~ map(utf8,utf8) ~~ list[MediumW] ~~ indexedSeq[SmallW]).widenAs(LargeW.apply, LargeW.unapply)

implicit val bigWCodec: Codec[BigW] =
int32.widenOpt(BigW.apply, BigW.unapply)

Expand Down
11 changes: 2 additions & 9 deletions benchmark/server/build.sbt
@@ -1,15 +1,8 @@
import common._

scalacOptions += "-language:reflectiveCalls"

macrosSettings

testSettings

promptSettings

assemblySettings

mergeSettings
common.mergeSettings

publish := {}
enablePlugins(DisablePublishingPlugin)
6 changes: 0 additions & 6 deletions core/build.sbt
@@ -1,6 +1,4 @@

import common._

resolvers += Resolver.sonatypeRepo("public")

resolvers += Resolver.bintrayRepo("scalaz", "releases")
Expand All @@ -25,7 +23,3 @@ libraryDependencies ++= Seq(
"io.netty" % "netty-handler" % "4.1.1.Final",
"io.netty" % "netty-codec" % "4.1.1.Final"
)

common.macrosSettings

common.settings
Expand Up @@ -277,7 +277,7 @@ class NettyConnectionPool(hosts: Process[Task,InetSocketAddress],
sh.handshakeFuture().addListener(new GenericFutureListener[Future[Channel]] {
def operationComplete(future: Future[Channel]): Unit = {
// avoid negotiation when ssl fails
if(!future.isSuccess) { pipe.remove(negotiateCapable) }
if(!future.isSuccess) { pipe.remove(negotiateCapable); () }
}
})

Expand Down
6 changes: 1 addition & 5 deletions docs/build.sbt
Expand Up @@ -5,10 +5,6 @@ site.settings

tutSettings

common.promptSettings

common.ignoreSettings

site.addMappingsToSiteDir(tut, "")

ghpages.settings
Expand All @@ -17,4 +13,4 @@ ghpagesNoJekyll := false

includeFilter in makeSite := "*.yml" | "*.md" | "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf"

git.remoteRepo := "git@github.com:oncue/remotely.git"
git.remoteRepo := "git@github.com:Verizon/remotely.git"
7 changes: 1 addition & 6 deletions examples/build.sbt
@@ -1,12 +1,7 @@
import common._

scalacOptions ++= Seq(
"-language:existentials",
"-language:postfixOps"
)

macrosSettings

promptSettings

ignoreSettings
enablePlugins(DisablePublishingPlugin)
23 changes: 9 additions & 14 deletions project.sbt
@@ -1,13 +1,19 @@

organization in Global := "oncue.remotely"
organization in Global := "io.verizon.remotely"

scalaVersion in Global := "2.10.6"

crossScalaVersions in Global := Seq("2.10.6", "2.11.8")

resolvers += Resolver.sonatypeRepo("releases")

lazy val remotely = project.in(file(".")).aggregate(core, examples, `benchmark-server`, `benchmark-client`, test, `test-server`).settings(publish := {})
lazy val remotely = project.in(file("."))
.aggregate(core,
examples,
`benchmark-server`,
`benchmark-client`,
test,
`test-server`)

lazy val core = project

Expand All @@ -27,15 +33,4 @@ lazy val `benchmark-client` = project.in(file("benchmark/client")).dependsOn(`be

parallelExecution in Global := false

common.promptSettings

releaseCrossBuild := true

publishArtifact in (Compile, packageBin) := false

publish := ()

publishLocal := ()

// avoid having to reboot the JVM during the travis build.
addCommandAlias("validate",";compile;test:compile;test")
enablePlugins(DisablePublishingPlugin)
69 changes: 69 additions & 0 deletions project/CentralRequirementsPlugin.scala
@@ -0,0 +1,69 @@
//: ----------------------------------------------------------------------------
//: Copyright (C) 2016 Verizon. All Rights Reserved.
//:
//: Licensed under the Apache License, Version 2.0 (the "License");
//: you may not use this file except in compliance with the License.
//: You may obtain a copy of the License at
//:
//: http://www.apache.org/licenses/LICENSE-2.0
//:
//: Unless required by applicable law or agreed to in writing, software
//: distributed under the License is distributed on an "AS IS" BASIS,
//: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//: See the License for the specific language governing permissions and
//: limitations under the License.
//:
//: ----------------------------------------------------------------------------
package verizon.build

import sbt._, Keys._
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName

object CentralRequirementsPlugin extends AutoPlugin {

override def trigger = allRequirements

override def requires = RigPlugin

override lazy val projectSettings = Seq(
sonatypeProfileName := "io.verizon",
pomExtra in Global := {
<developers>
<developer>
<id>timperrett</id>
<name>Timothy Perrett</name>
<url>http://github.com/timperrett</url>
</developer>
<developer>
<id>runarorama</id>
<name>Runar Bjarnason</name>
<url>http://github.com/runarorama</url>
</developer>
<developer>
<id>stew</id>
<name>Stew O'Connor</name>
<url>http://github.com/stew</url>
</developer>
<developer>
<id>ahjohannessen</id>
<name>Alex Henning Johannessen</name>
<url>https://github.com/ahjohannessen</url>
</developer>
<developer>
<id>pchiusano</id>
<name>Paul Chiusano</name>
<url>https://github.com/pchiusano</url>
</developer>
<developer>
<id>jedesah</id>
<name>Jean-Rémi Desjardins</name>
<url>https://github.com/jedesah</url>
</developer>
</developers>
},
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("http://verizon.github.io/remotely/")),
scmInfo := Some(ScmInfo(url("https://github.com/verizon/remotely"),
"git@github.com:verizon/remotely.git"))
)
}
41 changes: 41 additions & 0 deletions project/MacroPlugin.scala
@@ -0,0 +1,41 @@
//: ----------------------------------------------------------------------------
//: Copyright (C) 2016 Verizon. All Rights Reserved.
//:
//: Licensed under the Apache License, Version 2.0 (the "License");
//: you may not use this file except in compliance with the License.
//: You may obtain a copy of the License at
//:
//: http://www.apache.org/licenses/LICENSE-2.0
//:
//: Unless required by applicable law or agreed to in writing, software
//: distributed under the License is distributed on an "AS IS" BASIS,
//: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//: See the License for the specific language governing permissions and
//: limitations under the License.
//:
//: ----------------------------------------------------------------------------
package verizon.build

import sbt._, Keys._
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName

object MacroPlugin extends AutoPlugin {

override def trigger = allRequirements

override def requires = RigPlugin

override lazy val projectSettings = Seq(
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
) ++ (
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMajor)) if scalaMajor == 10 => Seq("org.scalamacros" %% "quasiquotes" % "2.1.0")
case _ => Nil
}
),
unmanagedSourceDirectories in Compile +=
(sourceDirectory in Compile).value / "macros" / s"scala-${scalaBinaryVersion.value}"
)
}
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=0.13.9
sbt.version=0.13.12

0 comments on commit 758e08f

Please sign in to comment.