Skip to content

Upgrade to sbt 1 #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ sbt-test/*/*/project/auto_plugins.sbt
sbt-test/*/*/project/build.properties
sbt-test/*/*/*/project/build.properties
sbt-test/*/*/*/project/auto_plugins.sbt
.idea/
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ os:
- linux
jdk:
- oraclejdk8

env:
matrix:
- TEST_COMMAND="scripted android-sdk-plugin/*1of2"
- TEST_COMMAND="scripted android-sdk-plugin/*2of2"
- TEST_COMMAND="scripted gradle-build/*"
global:
- ANDROID_EMU_API_LEVEL=24
- ANDROID_API_LEVEL=26
Expand Down Expand Up @@ -48,6 +51,6 @@ before_script:
script:
- curl -o sbt-launcher.sh https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt
- chmod a+x ./sbt-launcher.sh
- ./sbt-launcher.sh publish-local
- ./sbt-launcher.sh gradlebuild/publish-local
- ./sbt-launcher.sh "scripted android-sdk-plugin/* gradle-build/*"
- ./sbt-launcher.sh publishLocal
- ./sbt-launcher.sh gradlebuild/publishLocal
- ./sbt-launcher.sh "$TEST_COMMAND"
50 changes: 24 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import ScriptedPlugin._

val pluginVersion = "1.8.0-SNAPSHOT"
val gradleBuildVersion = "1.4.0-SNAPSHOT"
val pluginVersion = "2.0.0-SNAPSHOT"
val gradleBuildVersion = "2.0.0-SNAPSHOT"

val androidToolsVersion = "2.3.0"
val gradleToolingApi = "2.6"
Expand Down Expand Up @@ -57,7 +55,7 @@ val gradle = project.in(file("gradle-plugin")).settings(
Nil
).dependsOn(model % "compile-internal")

val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin).settings(
val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin, SbtPlugin).settings(
version := gradleBuildVersion,
resolvers ++= Seq(
"Gradle Releases Repository" at "https://repo.gradle.org/gradle/libs-releases-local/"
Expand All @@ -68,8 +66,7 @@ val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin
organization := "org.scala-android",
scalacOptions ++= Seq("-deprecation","-Xlint","-feature"),
libraryDependencies ++= Seq(
"com.hanhuy.sbt" %% "bintray-update-checker" % "0.2",
"com.google.code.findbugs" % "jsr305" % "3.0.1" % "compile-internal",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile-internal",
"org.gradle" % "gradle-tooling-api" % gradleToolingApi % "provided",
"org.slf4j" % "slf4j-api" % "1.7.10" // required by gradle-tooling-api
),
Expand All @@ -79,10 +76,10 @@ val gradlebuild = project.in(file("gradle-build")).enablePlugins(BuildInfoPlugin
val t = crossTarget.value
val m = (managedClasspath in Compile).value
val g = t / "gradle-tooling-api"
val apiJar = m.collect {
val apiJar = m.collectFirst {
case j if j.get(moduleID.key).exists(_.organization == "org.gradle") &&
j.get(moduleID.key).exists(_.name == "gradle-tooling-api") => j.data
}.headOption
}
FileFunction.cached(streams.value.cacheDirectory / "gradle-tooling-api", FilesInfo.lastModified) { in =>
in foreach (IO.unzip(_, g, { n: String => !n.startsWith("META-INF") }))
(g ** "*.class").get.toSet
Expand Down Expand Up @@ -119,25 +116,26 @@ unmanagedBase := baseDirectory(_ / "libs").value
resourceDirectory in Compile := baseDirectory(_ / "resources").value

libraryDependencies ++= Seq(
"org.ow2.asm" % "asm-all" % "5.0.4",
"com.google.code.findbugs" % "jsr305" % "3.0.1" % "compile-internal",
"org.javassist" % "javassist" % "3.20.0-GA",
"com.hanhuy.sbt" %% "bintray-update-checker" % "0.2", // 1.0 missing
"org.ow2.asm" % "asm-all" % "5.2",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile-internal",
"org.javassist" % "javassist" % "3.22.0-GA",
"com.android.tools.build" % "builder" % androidToolsVersion,
"com.android.tools.build" % "manifest-merger" % "25.3.0",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.51",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.59",
"com.android.tools.build" % "gradle-core" % androidToolsVersion excludeAll
ExclusionRule(organization = "net.sf.proguard"),
"com.android.tools.lint" % "lint" % "25.3.0",
// "com.android.tools.external.com-intellij" % "uast" % "145.597.4", // because google didn't sync the correct version...
"net.orfjackal.retrolambda" % "retrolambda" % "2.5.1"
"io.argonaut" %% "argonaut" % "6.2.3",
"net.orfjackal.retrolambda" % "retrolambda" % "2.5.3",
"org.scalaz" %% "scalaz-core" % "7.2.20"
)

aggregate := false

sbtPlugin := true

enablePlugins(BuildInfoPlugin)
enablePlugins(BuildInfoPlugin, SbtPlugin)

// build info plugin

Expand Down Expand Up @@ -168,16 +166,21 @@ pomExtra :=
</developer>
</developers>

// scripted-test settings
scriptedSettings // remove for 1.0

scriptedLaunchOpts ++= Seq("-Xmx1024m", "-Dplugin.version=" + version.value)
scriptedLaunchOpts ++= Seq(
"-Xmx1024m",
"-Dplugin.version=" + version.value,
"-DgradlePlugin.version=" + gradleBuildVersion
)

//scriptedBufferLog := false
sbtTestDirectory := baseDirectory(_ / "sbt-test").value

// TODO reorganize tests better, ditch android-sdk-plugin prefix
// group by test config type

// TODO these scriptedDependencies blocks can be removed since sbt scripted uses the current
// sbt version in scripted tests and you can use `sys.props("plugin.version")` to fetch
// the current plugin version, rather than adding a task to automatically create these files.
// Leaving a modified version for now to clean up old versions of the files left behind in local workspaces.
scriptedDependencies := {
val dir = sbtTestDirectory.value
val s = streams.value
Expand All @@ -197,11 +200,6 @@ scriptedDependencies := {
val propertiesFile = project / "build.properties"
pluginsFile.delete()
propertiesFile.delete()
IO.writeLines(pluginsFile,
"""addSbtPlugin("%s" %% "%s" %% "%s")""".format(org, n, v) ::
Nil)
IO.write(propertiesFile, """sbt.version=%s""" format sbtv)
}
}

scriptedDependencies := (scriptedDependencies dependsOn publishLocal).value
Loading