This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
/
build.sbt
executable file
·143 lines (119 loc) · 4.83 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
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import ReleaseTransformations._
import PgpKeys._
import sbt.complete.Parsers.spaceDelimited
name := "s2graph"
lazy val commonSettings = Seq(
organization := "org.apache.s2graph",
scalaVersion := "2.11.8",
isSnapshot := version.value.endsWith("-SNAPSHOT"),
scalacOptions := Seq("-language:postfixOps", "-unchecked", "-deprecation", "-feature", "-Xlint", "-Xlint:-missing-interpolator", "-target:jvm-1.8"),
javaOptions ++= collection.JavaConversions.propertiesAsScalaMap(System.getProperties).map { case (key, value) => "-D" + key + "=" + value }.toSeq,
testOptions in Test += Tests.Argument("-oDF"),
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
parallelExecution in Test := false,
libraryDependencies ++= Common.loggingRuntime,
unmanagedClasspath in Runtime <+= (resourceDirectory in Compile).map(Attributed.blank),
resolvers += Resolver.mavenLocal
) ++ Publisher.defaultSettings
Revolver.settings
lazy val s2http = project
.dependsOn(s2core, s2graphql)
.settings(commonSettings: _*)
.settings(dockerSettings: _*)
.enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging)
lazy val s2graphql = project
.dependsOn(s2core)
.settings(commonSettings: _*)
.settings(dockerSettings: _*)
.enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging)
lazy val s2core = project.settings(commonSettings: _*)
lazy val spark = project.settings(commonSettings: _*)
//lazy val loader = project.dependsOn(s2core, spark)
// .settings(commonSettings: _*)
lazy val s2counter_core = project.dependsOn(s2core)
.settings(commonSettings: _*)
lazy val s2counter_loader = project.dependsOn(s2counter_core, spark)
.settings(commonSettings: _*)
lazy val s2jobs = project.dependsOn(s2core)
.settings(commonSettings: _*)
lazy val s2graph_gremlin = project.dependsOn(s2core)
.settings(commonSettings: _*)
lazy val root = (project in file("."))
.aggregate(s2core, s2jobs, s2http)
.dependsOn(s2http, s2jobs, s2counter_loader, s2graphql) // this enables packaging on the root project
.settings(commonSettings: _*)
lazy val dockerSettings = Seq(
dockerfile in docker := {
val appDir: File = stage.value
val targetDir = s"/u/apps/${name.value}"
new Dockerfile {
from("java:8")
entryPoint(s"$targetDir/bin/${executableScriptName.value}")
env("EXTRA_JARS", "")
env("ZONEINFO", "Asia/Seoul")
copy(appDir, targetDir)
workDir(targetDir)
expose(9000)
}
},
bashScriptExtraDefines ++= Seq(
s"""cp $$EXTRA_JARS/* /u/apps/${name.value}/lib""",
"ln -sf /usr/share/zoneinfo/$ZONEINFO /etc/localtime; date"
),
scriptClasspath += "*",
imageNames in docker := Seq(
ImageName(s"s2graph/${name.value}:${version.value}")
),
buildOptions in docker := BuildOptions(
cache = false,
removeIntermediateContainers = BuildOptions.Remove.Always,
pullBaseImage = BuildOptions.Pull.Always
)
)
lazy val runRatTask = inputKey[Unit]("Runs Apache rat on S2Graph")
runRatTask := {
// pass absolute path for apache-rat jar.
val args: Seq[String] = spaceDelimited("<arg>").parsed
s"sh dev/run-rat.sh ${args.head}" !
}
Packager.defaultSettings
publishSigned := {
(publishSigned in s2http).value
(publishSigned in s2core).value
(publishSigned in spark).value
(publishSigned in s2jobs).value
(publishSigned in s2counter_core).value
(publishSigned in s2counter_loader).value
}
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies, // : ReleaseStep
inquireVersions, // : ReleaseStep
runTest, // : ReleaseStep
setReleaseVersion, // : ReleaseStep
commitReleaseVersion, // : ReleaseStep, performs the initial git checks
tagRelease, // : ReleaseStep
publishArtifacts, // : ReleaseStep, checks whether `publishTo` is properly set up
setNextVersion, // : ReleaseStep
commitNextVersion
)
releasePublishArtifactsAction := publishSigned.value
mainClass in Compile := None
parallelExecution in ThisBuild := false