Skip to content

Commit 5626967

Browse files
authored
Revert "Scala 2.12 support (closes #153)" (#166)
This reverts commit 631683d.
1 parent 631683d commit 5626967

File tree

9 files changed

+172
-34
lines changed

9 files changed

+172
-34
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: scala
22
before_script: "cd java-scala"
33
scala:
4-
- 2.12.4
4+
- 2.9.1
55
jdk:
6-
- oraclejdk8
7-
- openjdk8
6+
- oraclejdk7
7+
- openjdk6
8+
- openjdk7

java-scala/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,3 @@ lib_managed/
1010
src_managed/
1111
project/boot/
1212
project/plugins/project/
13-
project/project
14-
project/target

java-scala/build.sbt

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2012-2013 Snowplow Analytics Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import sbt._
18+
import Keys._
19+
20+
object BuildSettings {
21+
22+
// Basic settings for our app
23+
lazy val basicSettings = Seq[Setting[_]](
24+
organization := "com.snowplowanalytics",
25+
version := "0.3.0",
26+
description := "Library for extracting marketing attribution data from referer URLs",
27+
scalaVersion := "2.9.1",
28+
crossScalaVersions := Seq("2.9.1", "2.10.4", "2.11.1"),
29+
scalacOptions := Seq("-deprecation", "-encoding", "utf8"),
30+
resolvers ++= Dependencies.resolutionRepos
31+
)
32+
33+
// Publish settings
34+
// TODO: update with ivy credentials etc when we start using Nexus
35+
lazy val publishSettings = Seq[Setting[_]](
36+
// Enables publishing to maven repo
37+
publishMavenStyle := true,
38+
39+
publishTo <<= version { version =>
40+
val basePath = "target/repo/%s".format {
41+
if (version.trim.endsWith("SNAPSHOT")) "snapshots/" else "releases/"
42+
}
43+
Some(Resolver.file("Local Maven repository", file(basePath)) transactional())
44+
}
45+
)
46+
47+
lazy val buildSettings = basicSettings ++ publishSettings
48+
}

java-scala/project/Dependencies.scala

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Copyright 2012-2013 Snowplow Analytics Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import sbt._
18+
import Keys._
19+
20+
object Dependencies {
21+
val resolutionRepos = Seq(
22+
"SnowPlow Analytics Maven repo" at "http://maven.snplow.com/releases/"
23+
)
24+
25+
object V {
26+
val yaml = "1.10"
27+
val http = "4.3.3"
28+
object specs2 {
29+
val _29 = "1.12.1"
30+
val _210 = "1.14"
31+
val _211 = "2.3.13"
32+
}
33+
val scalaCheck = "1.10.0"
34+
val scalaUtil = "0.1.0"
35+
val junit = "4.11"
36+
val json = "20140107"
37+
val json4s = "3.2.9"
38+
}
39+
40+
object Libraries {
41+
val yaml = "org.yaml" % "snakeyaml" % V.yaml
42+
val httpClient = "org.apache.httpcomponents" % "httpclient" % V.http
43+
object specs2 {
44+
val _29 = "org.specs2" %% "specs2" % V.specs2._29 % "test"
45+
val _210 = "org.specs2" %% "specs2" % V.specs2._210 % "test"
46+
val _211 = "org.specs2" %% "specs2" % V.specs2._211 % "test"
47+
}
48+
val junit = "junit" % "junit" % V.junit % "test"
49+
val json = "org.json" % "json" % V.json % "test"
50+
val scalaCheck = "org.scalacheck" %% "scalacheck" % V.scalaCheck % "test"
51+
val scalaUtil = "com.snowplowanalytics" % "scala-util" % V.scalaUtil % "test"
52+
val json4sJackson = "org.json4s" %% "json4s-jackson" % V.json4s % "test"
53+
val json4sScalaz = "org.json4s" %% "json4s-scalaz" % V.json4s % "test"
54+
}
55+
56+
def onVersion[A](all: Seq[A] = Seq(), on29: => Seq[A] = Seq(), on210: => Seq[A] = Seq(), on211: => Seq[A] = Seq()) =
57+
scalaVersion(v => all ++ (if (v.contains("2.9.")) {
58+
on29
59+
} else if (v.contains("2.10.")) {
60+
on210
61+
} else {
62+
on211
63+
}))
64+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2012-2013 Snowplow Analytics Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import sbt._
18+
import Keys._
19+
20+
object RefererParserBuild extends Build {
21+
22+
import Dependencies._
23+
import BuildSettings._
24+
25+
// Configure prompt to show current project
26+
override lazy val settings = super.settings :+ {
27+
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
28+
}
29+
30+
// Define our project, with basic project information and library dependencies
31+
lazy val project = Project("referer-parser", file("."))
32+
.settings(buildSettings: _*)
33+
.settings(
34+
libraryDependencies <++= Dependencies.onVersion(
35+
all = Seq(
36+
Libraries.yaml,
37+
Libraries.httpClient,
38+
Libraries.scalaCheck,
39+
Libraries.scalaUtil,
40+
Libraries.junit,
41+
Libraries.json,
42+
Libraries.json4sJackson),
43+
on29 = Seq(Libraries.specs2._29),
44+
on210 = Seq(Libraries.specs2._210),
45+
on211 = Seq(Libraries.specs2._211)
46+
)
47+
)
48+
}

java-scala/project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.0.2
1+
sbt.version=0.13.2

java-scala/src/test/scala/com/snowplowanalytics/refererparser/scala/JsonParseTest.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,19 @@ class JsonParseTest extends Specification {
4040

4141
val internalDomains = List("www.subdomain1.snowplowanalytics.com", "www.subdomain2.snowplowanalytics.com")
4242

43-
def getString(node: JValue, name: String): String =
43+
def getString(node: JValue, name: String): String =
4444
(node \ name) match {
4545
case JString(s) => s
4646
case _ => throw new Exception("The value of field '%s' in referer-tests.json is not a string - this should never happen".format(name))
4747
}
4848

4949
"parse" should {
50-
"extract the expected details from referer with spec" in {
51-
for (test <- testJson) yield {
5250

53-
Parser.parse(getString(test, "uri"), pageHost, internalDomains) shouldEqual
51+
for (test <- testJson) {
52+
53+
"extract the expected details from referer with spec '%s'".format(getString(test, "spec")) in {
54+
55+
Parser.parse(getString(test, "uri"), pageHost, internalDomains) must_==
5456
Some(Referer(
5557
Medium.withName(getString(test, "medium")),
5658
(test \ "source") match {

java-scala/src/test/scala/com/snowplowanalytics/refererparser/scala/ParseFuzzTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ class ParseFuzzTest extends Specification with ScalaCheck {
3131
"The parse function should work for any pair of referer and page Strings" ! e1
3232

3333
def e1 =
34-
prop { (refererUri: String, pageUri: String) => Parser.parse(refererUri, pageUri) must beAnInstanceOf[Parser.MaybeReferer] }
34+
check { (refererUri: String, pageUri: String) => Parser.parse(refererUri, pageUri) must beAnInstanceOf[Parser.MaybeReferer] }
3535
}

0 commit comments

Comments
 (0)