-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
117 lines (82 loc) · 3.22 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
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
import ReleaseTransformations._
lazy val `fpassembly-protobuf` = project in file(".")
organization := "org.fpassembly"
name := "fpassembly-protobuf"
scalaVersion := "2.12.3"
crossScalaVersions := Seq("2.11.12", scalaVersion.value)
scalacOptions := Seq("-feature", "-unchecked", "-deprecation", "-encoding", "utf8", "-Xlint:_", "-Ywarn-unused-import")
EclipseKeys.useProjectId := true
EclipseKeys.withSource := true
//useGpg := true,
homepage := Some(url("https://github.com/isomorf-org/scala-fpassembly-protobuf"))
scmInfo := Some(ScmInfo(url("https://github.com/isomorf-org/scala-fpassembly-protobuf"),
"[email protected]:isomorf-org/scala-fpassembly-protobuf.git"))
developers := List(Developer("bdkent", "Brian Kent", "[email protected]", url("https://github.com/bdkent")))
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
pomIncludeRepository := { _ => false }
publishMavenStyle := true
// Add sonatype repository settings
publishTo := Some(
if (isSnapshot.value) {
Opts.resolver.sonatypeSnapshots
}
else {
Opts.resolver.sonatypeStaging
}
)
releaseCrossBuild := true
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand(s"sonatypeReleaseAll " + organization.value),
pushChanges
)
commands += Command.command("releaser") {
"release cross" ::
//s"sonatypeReleaseAll ${organizationGlobal}" ::
_
}
commands += Command.command("makeDocs") {
"makeSite" :: "ghdvCopyReadme" :: "ghdvCopyScaladocs" :: _
}
enablePlugins(SiteScaladocPlugin)
siteSubdirName in SiteScaladoc := "scaladocs/api/" + version.value
enablePlugins(PreprocessPlugin)
enablePlugins(SbtGhDocVerPlugin)
preprocessVars in Preprocess := Map("VERSION" -> version.value)
libraryDependencies += "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
PB.targets in Compile := Seq(
scalapb.gen(flatPackage = true) -> (sourceManaged in Compile).value
)
PB.protoSources in Compile ++= Seq(target.value / "external-schemas" / "protobuf")
val schemaVersions = Seq("1", "2")
val downloadProtobufSchemas = taskKey[Unit]("download protobuf schemas")
downloadProtobufSchemas := {
schemaVersions.map({v =>
import java.nio.file.Paths
import java.nio.file.Files
import java.nio.file.StandardCopyOption
val path = Paths.get(s"schemas/v${v}/protobuf/fpassembly.proto")
val src = new java.net.URL(s"http://fpassembly.org/${path}")
val dest = (target.value / "external-schemas" / "protobuf" / "org" / "fpassembly" / "storage" / s"v${v}" / "fpassembly.proto").toPath
Files.createDirectories(dest.getParent)
val s = src.openStream
try {
Files.copy(s, dest, StandardCopyOption.REPLACE_EXISTING)
} finally {
s.close
}
dest.toFile
})
}
(Compile / compile) := ((Compile / compile) dependsOn downloadProtobufSchemas).value