-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
153 lines (136 loc) · 5 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import com.amazonaws.services.s3.model.Region
import com.ambiata.promulgate.project.ProjectPlugin._
import ohnosequences.sbt.SbtS3Resolver.autoImport.{awsProfile, s3region}
import sbt.Def
import buildResolvers.allResolvers
import com.amazonaws.auth.{EnvironmentVariableCredentialsProvider, InstanceProfileCredentialsProvider}
import com.amazonaws.auth.profile.ProfileCredentialsProvider
import com.ambiata.promulgate.project.Sett
lazy val ossBucket: String =
sys.env.getOrElse("AMBIATA_IVY_OSS", "ambiata-oss")
lazy val standardSettings = Defaults.coreDefaultSettings ++
projectSettings ++
compilationSettings ++
testingSettings
lazy val projectSettings: Seq[Def.Setting[_]] = Seq(
organization := "com.ambiata"
, version in ThisBuild := "1.4.1"
, scalaVersion := "2.11.6"
, crossScalaVersions := Seq(scalaVersion.value)
, publishArtifact in (Test, packageBin) := true
, awsProfile := "default"
, s3region := Region.AP_Sydney
, s3credentials := new EnvironmentVariableCredentialsProvider() |
InstanceProfileCredentialsProvider.getInstance() |
new ProfileCredentialsProvider(awsProfile.value)
, resolvers ++= allResolvers.value
, libraryDependencies ++= depend.awsDeps
) ++ Seq(prompt)
lazy val saws = (project in file("."))
.settings(
name := "saws"
, standardSettings
, promulgate.library("com.ambiata.saws", ossBucket)
)
.aggregate(core, ec2, s3, iam, emr, ses, cw, testing)
.dependsOn(core, ec2, s3, iam, emr, ses, cw)
lazy val core = (project in file("saws-core"))
.settings(
moduleName := "saws-core"
, standardSettings
, packageSettings
, libraryDependencies ++= depend.awsLib("core") ++ depend.awsLib("iam") ++ depend.awsLib("ec2") ++
depend.awsLib("s3") ++ depend.awsLib("emr") ++ depend.awsLib("ses") ++ depend.awsLib("cloudwatch") ++
depend.scalaz ++ depend.mundane ++ depend.testing
)
lazy val iam = (project in file("saws-iam"))
.settings(
moduleName := "saws-iam"
, packageSettings
, libraryDependencies ++= depend.awsLib("iam") ++ depend.testing
)
.dependsOn(core)
lazy val ec2 = (project in file("saws-ec2"))
.settings(
moduleName := "saws-ec2"
, packageSettings
, libraryDependencies ++= depend.awsLib("ec2")
)
.dependsOn(core, iam)
lazy val s3 = (project in file("saws-s3"))
.settings(
moduleName := "saws-s3"
, packageSettings
, libraryDependencies ++= depend.awsLib("s3")
)
.dependsOn(core)
lazy val emr = (project in file("saws-emr"))
.settings(
moduleName := "saws-emr"
, packageSettings
, libraryDependencies ++= depend.awsLib("emr")
)
.dependsOn(core)
lazy val ses = (project in file("saws-ses"))
.settings(
moduleName := "saws-ses"
, packageSettings
, libraryDependencies ++= depend.awsLib("ses")
)
.dependsOn(core)
lazy val cw = (project in file("saws-cw"))
.settings(
moduleName := "saws-cw"
, packageSettings
, libraryDependencies ++= depend.awsLib("cloudwatch") ++ depend.scalaz ++ depend.testing ++ depend.disorder ++ depend.mundaneTesting
)
.dependsOn(core)
lazy val testing = (project in file("saws-testing"))
.settings(
moduleName := "saws-testing"
, packageSettings
, libraryDependencies ++= depend.awsLib("test-utils") ++ depend.specs2 ++ depend.ssh ++ depend.mundane ++ depend.mundaneTesting ++ depend.disorder
)
.dependsOn(iam, emr, ec2, ses, s3, cw, cw % "test->test")
lazy val compilationSettings: Seq[Def.Setting[_]] = Seq(
javacOptions ++= Seq("-Xmx3G", "-Xms512m", "-Xss4m"),
maxErrors := 10,
scalacOptions ++= Seq("-feature", "-language:_"),
scalacOptions in Compile ++= Seq(
"-target:jvm-1.6"
, "-deprecation"
, "-unchecked"
, "-feature"
, "-language:_"
, "-Ywarn-value-discard"
, "-Yno-adapted-args"
, "-Xlint"
// , "-Xfatal-warnings" // too painful to fix as my scala knowledge is poor
, "-Yinline-warnings"),
scalacOptions in Test ++= Seq("-Yrangepos")
)
def packageSettings: Seq[Def.Setting[_]] =
standardSettings ++ library(ossBucket)
def library(bucket: String): Seq[Sett] =
promulgateVersionSettings ++
promulgateNotifySettings ++
promulgateSourceSettings ++
promulgateS3LibSettings ++ Seq(
BuildInfoKeys.pkg := organization.value + "." + moduleName.value
, S3LibKeys.bucket := bucket
)
lazy val testingSettings: Seq[Def.Setting[_]] = Seq(
initialCommands in console := "import org.specs2._"
, logBuffered := false
, cancelable := true
, javaOptions += "-Xmx3G"
, fork in Test := Option(System.getenv("NO_FORK")).map(_ != "true").getOrElse(true)
, testOptions in Test ++= (if (Option(System.getenv("FORCE_AWS")).isDefined || Option(System.getenv("AWS_ACCESS_KEY")).isDefined)
Seq()
else
Seq(Tests.Argument("--", "exclude", "aws")))
)
lazy val prompt = shellPrompt in ThisBuild := { state =>
val name = Project.extract(state).currentRef.project
(if (name == "saws") "" else name) + "> "
}