forked from scala-android/sbt-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
75 lines (56 loc) · 2.12 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
import ScriptedPlugin._
name := "android-sdk-plugin"
version := "1.1.2"
organization := "com.hanhuy.sbt"
sourceDirectories in Compile <<= baseDirectory(b => Seq(b / "src"))
scalacOptions ++= Seq("-deprecation","-Xlint")
scalaSource in Compile <<= baseDirectory(_ / "src")
scalaSource in Test <<= baseDirectory(_ / "test")
unmanagedBase <<= baseDirectory(_ / "libs")
resourceDirectory in Compile <<= baseDirectory(_ / "resources")
libraryDependencies ++= Seq(
"asm" % "asm-all" % "3.3.1",
"net.sf.proguard" % "proguard-base" % "4.10",
"com.android.tools.build" % "builder" % "0.6.3"
)
sbtPlugin := true
publishTo <<= (version) { version =>
val scalasbt = "http://scalasbt.artifactoryonline.com/scalasbt/"
val (name, url) = if (version contains "-SNAPSHOT")
("scala-sbt-snapshots", scalasbt + "sbt-plugin-snapshots")
else
("scala-sbt-releases", scalasbt + "sbt-plugin-releases")
Some(Resolver.url(name, new URL(url))(Resolver.ivyStylePatterns))
}
publishMavenStyle := false
// scripted-test settings
scriptedSettings
scriptedLaunchOpts += "-Xmx1024m"
//scriptedBufferLog := false
sbtTestDirectory <<= baseDirectory (_ / "sbt-test")
// TODO reorganize tests better, ditch android-sdk-plugin prefix
// group by test config type
scriptedDependencies <<= ( sbtTestDirectory
, streams
, organization
, name
, version
, sbtVersion) map {
(dir,s, org, n, v, sbtv) =>
val testBase = dir / "android-sdk-plugin"
val tests = testBase.listFiles(DirectoryFilter) filter { d =>
(d ** "*.sbt").get.size > 0 || (d / "project").isDirectory
}
tests foreach { test =>
val project = test / "project"
project.mkdirs()
val pluginsFile = project / "auto_plugins.sbt"
val propertiesFile = project / "build.properties"
pluginsFile.delete()
propertiesFile.delete()
IO.write(pluginsFile,
"""addSbtPlugin("%s" %% "%s" %% "%s")""" format (org, n, v))
IO.write(propertiesFile, """sbt.version=%s""" format sbtv)
}
}
scriptedDependencies <<= scriptedDependencies dependsOn publishLocal