Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 78677e7

Browse files
committedJun 29, 2017
Bump SBT to 0.13.15 (closes #83)
1 parent 377c54a commit 78677e7

File tree

10 files changed

+120
-88
lines changed

10 files changed

+120
-88
lines changed
 

‎build.sbt

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2014-2017 Snowplow Analytics Ltd. All rights reserved.
3+
*
4+
* This program is licensed to you under the Apache License Version 2.0,
5+
* and you may not use this file except in compliance with the Apache License Version 2.0.
6+
* You may obtain a copy of the Apache License Version 2.0 at
7+
* http://www.apache.org/licenses/LICENSE-2.0.
8+
*
9+
* Unless required by applicable law or agreed to in writing,
10+
* software distributed under the Apache License Version 2.0 is distributed on an
11+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the Apache License Version 2.0 for the specific language governing permissions and
13+
* limitations there under.
14+
*/
15+
lazy val root = project.in(file("."))
16+
.settings(
17+
name := "snowplow-kinesis-s3",
18+
version := "0.4.1",
19+
description := "Kinesis sink for S3"
20+
)
21+
.settings(BuildSettings.buildSettings)
22+
.settings(BuildSettings.sbtAssemblySettings)
23+
.settings(
24+
libraryDependencies ++= Seq(
25+
// Java
26+
Dependencies.Libraries.kinesisClient,
27+
Dependencies.Libraries.kinesisConnector,
28+
Dependencies.Libraries.slf4j,
29+
Dependencies.Libraries.hadoop,
30+
Dependencies.Libraries.elephantbird,
31+
Dependencies.Libraries.hadoopLZO,
32+
Dependencies.Libraries.yodaTime,
33+
// Scala
34+
Dependencies.Libraries.scopt,
35+
Dependencies.Libraries.config,
36+
Dependencies.Libraries.scalaz7,
37+
Dependencies.Libraries.json4sJackson,
38+
Dependencies.Libraries.snowplowTracker,
39+
// Scala (test only)
40+
Dependencies.Libraries.specs2,
41+
// Thrift (test only)
42+
Dependencies.Libraries.collectorPayload
43+
)
44+
)
45+
46+
shellPrompt := { _ => "kinesis-s3> " }

‎project/BuildSettings.scala

+32-19
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,44 @@ import Keys._
1818
object BuildSettings {
1919

2020
// Basic settings for our app
21-
lazy val basicSettings = Seq[Setting[_]](
21+
lazy val basicSettings = Seq(
2222
organization := "com.snowplowanalytics",
23-
version := "0.4.1",
24-
description := "Kinesis LZO sink for S3",
2523
scalaVersion := "2.11.11",
26-
scalacOptions := Seq("-deprecation", "-encoding", "utf8",
27-
"-feature", "-target:jvm-1.7"),
28-
scalacOptions in Test := Seq("-Yrangepos"),
24+
scalacOptions := compilerOptions,
2925
resolvers ++= Dependencies.resolvers
3026
)
3127

28+
lazy val compilerOptions = Seq(
29+
"-deprecation",
30+
"-encoding", "UTF-8",
31+
"-feature",
32+
"-language:existentials",
33+
"-language:higherKinds",
34+
"-language:implicitConversions",
35+
"-unchecked",
36+
"-Yno-adapted-args",
37+
"-Ywarn-dead-code",
38+
"-Ywarn-numeric-widen",
39+
"-Xfuture",
40+
"-Xlint"
41+
)
42+
3243
// Makes our SBT app settings available from within the app
33-
lazy val scalifySettings = Seq(sourceGenerators in Compile <+= (sourceManaged in Compile, version, name, organization) map { (d, v, n, o) =>
34-
val file = d / "settings.scala"
35-
IO.write(file, """package com.snowplowanalytics.snowplow.storage.kinesis.s3.generated
36-
|object Settings {
37-
| val organization = "%s"
38-
| val version = "%s"
39-
| val name = "%s"
40-
|}
41-
|""".stripMargin.format(o, v, n))
42-
Seq(file)
43-
})
44+
lazy val scalifySettings = Seq(
45+
sourceGenerators in Compile += Def.task {
46+
val file = (sourceManaged in Compile).value / "settings.scala"
47+
IO.write(file, """package com.snowplowanalytics.snowplow.storage.kinesis.s3.generated
48+
|object Settings {
49+
| val organization = "%s"
50+
| val version = "%s"
51+
| val name = "%s"
52+
|}
53+
|""".stripMargin.format(organization.value, version.value, name.value))
54+
Seq(file)
55+
}.taskValue
56+
)
57+
58+
lazy val buildSettings = basicSettings ++ scalifySettings
4459

4560
// sbt-assembly settings for building a fat jar
4661
import sbtassembly.Plugin._
@@ -63,6 +78,4 @@ object BuildSettings {
6378

6479
assemblyOption in assembly ~= { _.copy(cacheOutput = false) }
6580
)
66-
67-
lazy val buildSettings = basicSettings ++ scalifySettings ++ sbtAssemblySettings
6881
}

‎project/SnowplowS3SinkBuild.scala

-47
This file was deleted.

‎project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.2
1+
sbt.version=0.13.15

‎src/main/scala/com.snowplowanalytics.snowplow.storage.kinesis/package.scala

-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ package object s3 {
3030
*/
3131
type RawRecord = Array[Byte]
3232

33-
/**
34-
* Case class to contain a Failed Record:
35-
* - The list of errors
36-
* - The original line, Base64 Encoded
37-
*/
38-
case class FailedRecord(errors: List[String], line: String)
39-
4033
/**
4134
* Validation for a SnowplowRawEvent
4235
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2014-2015 Snowplow Analytics Ltd.
3+
* All rights reserved.
4+
*
5+
* This program is licensed to you under the Apache License Version 2.0,
6+
* and you may not use this file except in compliance with the Apache
7+
* License Version 2.0.
8+
* You may obtain a copy of the Apache License Version 2.0 at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the Apache License Version 2.0 is distributed
13+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14+
* either express or implied.
15+
*
16+
* See the Apache License Version 2.0 for the specific language
17+
* governing permissions and limitations there under.
18+
*/
19+
20+
package com.snowplowanalytics.snowplow.storage.kinesis.s3
21+
22+
/**
23+
* Case class to contain a Failed Record:
24+
* - The list of errors
25+
* - The original line, Base64 Encoded
26+
*/
27+
case class FailedRecord(errors: List[String], line: String)

‎src/main/scala/com.snowplowanalytics.snowplow.storage.kinesis/s3/S3Emitter.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class S3Emitter(config: KinesisConnectorConfiguration, badSink: ISink, serialize
8484
* The amount of time to wait in between unsuccessful index requests (in milliseconds).
8585
* 10 seconds = 10 * 1000 = 10000
8686
*/
87-
private val BackoffPeriod = 10000
87+
private val BackoffPeriod = 10000L
8888

8989
// An ISO valid timestamp formatter
9090
private val TstampFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(DateTimeZone.UTC)
@@ -154,7 +154,7 @@ class S3Emitter(config: KinesisConnectorConfiguration, badSink: ISink, serialize
154154
val inputStream = new ByteArrayInputStream(outputStream.toByteArray)
155155

156156
val objMeta = new ObjectMetadata()
157-
objMeta.setContentLength(outputStream.size)
157+
objMeta.setContentLength(outputStream.size.toLong)
158158

159159
client.putObject(bucket, filename, inputStream, objMeta)
160160

@@ -200,7 +200,7 @@ class S3Emitter(config: KinesisConnectorConfiguration, badSink: ISink, serialize
200200
*
201201
* Prevents shutdown hooks from running
202202
*/
203-
private def forceShutdown() {
203+
private def forceShutdown(): Unit = {
204204
log.error(s"Shutting down application as unable to connect to S3 for over $maxConnectionTime ms")
205205
tracker foreach {
206206
t =>
@@ -213,7 +213,7 @@ class S3Emitter(config: KinesisConnectorConfiguration, badSink: ISink, serialize
213213
/**
214214
* Closes the client when the KinesisConnectorRecordProcessor is shut down
215215
*/
216-
override def shutdown() {
216+
override def shutdown(): Unit = {
217217
client.shutdown
218218
}
219219

@@ -223,7 +223,7 @@ class S3Emitter(config: KinesisConnectorConfiguration, badSink: ISink, serialize
223223
*
224224
* @param records List of failed records to send to Kinesis
225225
*/
226-
override def fail(records: java.util.List[ EmitterInput ]) {
226+
override def fail(records: java.util.List[EmitterInput]): Unit = {
227227
// TODO: Should there be a check for Successes?
228228
for (Failure(record) <- records.toList) {
229229
log.warn(s"Record failed: $record.line")

‎src/main/scala/com.snowplowanalytics.snowplow.storage.kinesis/s3/SnowplowTracking.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ object SnowplowTracking {
6060
*
6161
* @param tracker a Tracker instance
6262
*/
63-
def initializeSnowplowTracking(tracker: Tracker) {
63+
def initializeSnowplowTracking(tracker: Tracker): Unit = {
6464
trackApplicationInitialization(tracker)
6565

6666
Runtime.getRuntime.addShutdownHook(new Thread() {
67-
override def run() {
67+
override def run(): Unit = {
6868
trackApplicationShutdown(tracker)
6969
}
7070
})
7171

7272
val heartbeatThread = new Thread {
73-
override def run() {
73+
override def run(): Unit = {
7474
while (true) {
7575
trackApplicationHeartbeat(tracker, HeartbeatInterval)
7676
Thread.sleep(HeartbeatInterval)
@@ -95,7 +95,7 @@ object SnowplowTracking {
9595
lastRetryPeriod: Long,
9696
failureCount: Long,
9797
initialFailureTime: Long,
98-
message: String) {
98+
message: String): Unit = {
9999

100100
tracker.trackUnstructEvent(SelfDescribingJson(
101101
"iglu:com.snowplowanalytics.monitoring.kinesis/storage_write_failed/jsonschema/1-0-0",
@@ -112,7 +112,7 @@ object SnowplowTracking {
112112
*
113113
* @param tracker a Tracker instance
114114
*/
115-
private def trackApplicationInitialization(tracker: Tracker) {
115+
private def trackApplicationInitialization(tracker: Tracker): Unit = {
116116
tracker.trackUnstructEvent(SelfDescribingJson(
117117
"iglu:com.snowplowanalytics.monitoring.kinesis/app_initialized/jsonschema/1-0-0",
118118
JObject(Nil)
@@ -124,7 +124,7 @@ object SnowplowTracking {
124124
*
125125
* @param tracker a Tracker instance
126126
*/
127-
def trackApplicationShutdown(tracker: Tracker) {
127+
def trackApplicationShutdown(tracker: Tracker): Unit = {
128128
tracker.trackUnstructEvent(SelfDescribingJson(
129129
"iglu:com.snowplowanalytics.monitoring.kinesis/app_shutdown/jsonschema/1-0-0",
130130
JObject(Nil)
@@ -137,7 +137,7 @@ object SnowplowTracking {
137137
* @param tracker a Tracker instance
138138
* @param heartbeatInterval Time between heartbeats in milliseconds
139139
*/
140-
private def trackApplicationHeartbeat(tracker: Tracker, heartbeatInterval: Long) {
140+
private def trackApplicationHeartbeat(tracker: Tracker, heartbeatInterval: Long): Unit = {
141141
tracker.trackUnstructEvent(SelfDescribingJson(
142142
"iglu:com.snowplowanalytics.monitoring.kinesis/app_heartbeat/jsonschema/1-0-0",
143143
"interval" -> heartbeatInterval

‎src/main/scala/com.snowplowanalytics.snowplow.storage.kinesis/s3/sinks/ISink.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ package com.snowplowanalytics.snowplow.storage.kinesis.s3.sinks
2222
* Shared interface for all sinks
2323
*/
2424
trait ISink {
25-
def store(output: String, key: Option[String], good: Boolean)
25+
def store(output: String, key: Option[String], good: Boolean): Unit
2626
}

‎vagrant/up.playbooks

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
oss-playbooks/java7.yml
22
oss-playbooks/thrift.yml
33
oss-playbooks/scala-2.11.6.yml
4-
oss-playbooks/sbt.yml
4+
oss-playbooks/sbt-13.8.yml
55
oss-playbooks/lzo.yml

0 commit comments

Comments
 (0)
Please sign in to comment.