forked from us1415/wire-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
160 lines (139 loc) · 7.04 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
154
155
156
157
158
159
160
import android.Dependencies.LibraryDependency
import android.Keys._
import scala.collection.mutable
import Deps._
val MajorVersion = "2.7"
lazy val buildNumber = Option(System.getenv("BUILD_NUMBER")).map(_.toInt).getOrElse(99999)
version in Global := s"$MajorVersion.$buildNumber"
zmsVersion in Global := Option(System.getenv("ZMESSAGING_VERSION")).getOrElse(zmsDevVersion)
scalaVersion in Global := "2.11.8"
compileOrder in Global := CompileOrder.Mixed
javacOptions in Global ++= Seq("-source", "1.7", "-target", "1.7")
scalacOptions in Global ++= Seq("-feature", "-target:jvm-1.7", "-Xfuture", "-deprecation", "-Yinline-warnings", "-Ywarn-unused-import", "-encoding", "UTF-8")
resolvers in Global ++= Seq (
"Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository",
Resolver.bintrayRepo("wire-android", "releases"),
Resolver.bintrayRepo("wire-android", "snapshots"),
Resolver.bintrayRepo("wire-android", "third-party"),
"android team nexus" at "http://192.168.10.18:8081/nexus/content/groups/public",
"Maven central 1" at "http://repo1.maven.org/maven2",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
"Bintray consp1razy" at "http://dl.bintray.com/consp1racy/maven",
"Localytics" at "http://maven.localytics.com/public"
)
lintDetectors := Seq()//ApiDetector.UNSUPPORTED)
lintStrict := false
val subProjectSettings = android.Plugin.buildAar ++ Seq(
libraryProject := true,
platformTarget := "android-24",
useProguard := false,
debugIncludesTests := false,
dexMulti := true,
publishArtifact in (Compile, packageBin) := false,
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in packageDoc := false,
dexMaxHeap := "6144M",
lintDetectors := Seq(),//ApiDetector.UNSUPPORTED),
lintStrict := false,
transitiveAndroidLibs := false
)
lazy val wireCore = project.in(file("wire-core"))
.settings(androidBuildAar: _ *)
.settings(subProjectSettings: _ *)
.settings(
libraryDependencies ++= Seq(supportv4, appcompatv7, timber, hockey, threetenabp, translations, zMessaging(zmsVersion.value), avsDep)
)
lazy val wireUi = project.in(file("wire-ui"))
.androidBuildWith(wireCore)
.settings(subProjectSettings: _ *)
.settings(
libraryDependencies ++= Seq(recyclerview, threetenabp, preferences, supportdesign,
supportpreferences exclude("net.xpece.android", "support-spinner"),
rebound,
roundedimageview,
"net.xpece.android" % "support-spinner" % "0.8.1")
)
lazy val app = Project("zclient-app", file("app"))
.androidBuildWith(wireUi)
.settings(Flavor.Dev.settings: _*)
.settings(
name := "zclient-app",
versionCode := Some(buildNumber),
libraryProject := false,
localProjects := {
val libs = localProjects.value
libs.map(l => l.layout.base.getName -> l).toMap.values.toSeq
},
platformTarget := "android-24",
proguardCache := Seq(),
debugIncludesTests := false,
useProguard := true,
useProguardInDebug := true,
proguardConfig ++=
IO.readLines(file("app") / "proguard-rules.txt") ++
Option(file("proguard-sbt.txt")).filter(_.exists).fold(Seq.empty[String])(IO.readLines(_)),
typedResources := false,
retrolambdaEnabled := false,
dexMulti := true,
publishArtifact in (Compile, packageBin) := false,
publishArtifact in (Compile, packageDoc) := false,
packagingOptions := {
val p = packagingOptions.value
p.copy(excludes = p.excludes ++ Seq("META-INF/DEPENDENCIES", "META-INF/DEPENDENCIES.txt", "META-INF/LICENSE.txt", "META-INF/NOTICE", "META-INF/NOTICE.txt", "META-INF/LICENSE", "LICENSE.txt", "META-INF/LICENSE.txt", "META-INF/services/javax.annotation.processing.Processor"))
},
dexMainClasses ++= Seq("com.waz.zclient.ZApplication", "com.waz.zclient.MainActivity"),
proguardScala := useProguard.value,
dexInputs := {
val di = dexInputs.value
if (proguardScala.value) di
else {
val names = new mutable.HashSet[String]
(di._1, di._2 filterNot { f => f.getName.startsWith("scala-library") && names.add(f.getName) })
}
},
apkDebugSigningConfig := SigningConfig.Debug,
transitiveAndroidLibs := true,
dexMaxHeap := "6144M",
minSdkVersion := "17",
libraryDependencies ++= Seq (multidex, supportannotations, supportdesign, audioNotifications, cardview,
spotifyAuth, spotifyPlayer, nineoldandroids, localytics, psBase, psGcm, psMaps, psLocation, mp4parser,
"com.jakewharton.hugo" % "hugo-annotations" % "1.2.1" % "provided",
"com.wire" % "testutils" % zmsDevVersion % Test,
"com.geteit" %% "robotest" % "0.7" % Test exclude("org.scalatest", "scalatest"),
"org.scalatest" %% "scalatest" % "2.2.6" % Test,
"junit" % "junit" % "4.12" % Test,
"org.mockito" % "mockito-all" % "2.0.2-beta" % Test,
"org.scalamock" %% "scalamock-scalatest-support" % "3.2.2" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
),
aars <<= android.Tasks.aarsTaskDef,
resources in Test := {
val dir = target.value / "aars"
dir.mkdirs
aars.value foreach { lib: LibraryDependency =>
if ((lib.getFolder / "res").isDirectory)
IO.copyDirectory(lib.getFolder, dir / lib.getFolder.getName)
}
(resources in Test).value
},
fork in Test := true,
parallelExecution in Test := false,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v"),
javaOptions in Test ++= Seq("-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")
)
lazy val custom = flavorOf(app, "flavor-custom", Flavor.Custom.settings: _*)
lazy val internal = flavorOf(app, "flavor-internal", Flavor.Internal.settings: _*)
lazy val experimental = flavorOf(app, "flavor-experimental", Flavor.Experimental.settings: _*)
lazy val candidate = flavorOf(app, "flavor-candidate", Flavor.Candidate.settings: _*)
lazy val prod = flavorOf(app, "flavor-prod", Flavor.Prod.settings: _*)
lazy val avs = flavorOf(app, "flavor-avs", Flavor.Avs.settings: _*)
lazy val qaavs = flavorOf(app, "flavor-qaavs", Flavor.QAAvs.settings: _*)
lazy val root = Project("zclient", file(".")).aggregate(wireCore, wireUi, app)
lazy val aars = TaskKey[Seq[LibraryDependency]]("aars", "unpack the set of referenced aars")
addCommandAlias("releaseInternal", s""";set zmsVersion in Global := "$zmsDevVersion";flavor-internal/android:packageRelease""")
addCommandAlias("releaseExp", s""";set zmsVersion in Global := "$zmsDevVersion";flavor-experimental/android:packageRelease""")
addCommandAlias("releaseProd", s""";set zmsVersion in Global := "$zmsReleaseVersion";flavor-prod/android:packageRelease""")
addCommandAlias("releaseRC", s""";set zmsVersion in Global := "$zmsReleaseVersion";flavor-candidate/android:packageRelease""")
addCommandAlias("releaseAVS", s""";set zmsVersion in Global := "$zmsReleaseVersion";flavor-avs/android:packageRelease""")
addCommandAlias("releaseQAAVS", s""";set zmsVersion in Global := "$zmsReleaseVersion";flavor-qaavs/android:packageRelease""")