From 3b8c88db67981ad426fd270918c0d2b75df23687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20P=C3=A1ll=20Geirsson?= Date: Mon, 12 Dec 2016 16:32:48 +0100 Subject: [PATCH] Don't rely on sbt.ivy.home. --- .drone.yml | 17 +++++++++++++++-- build.sbt | 10 +++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index a5d5adee78..6d2e067c03 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,13 +1,26 @@ build: - image: scalaplatform/scala:0.5 + image: danieletorelli/sbt environment: - COURSIER_CACHE=/drone/cache/coursier commands: - export SBT_OPTS="-Xmx24G -XX:MaxPermSize=4G -Xss4M" + # configuring ivy.home doesn't seem to work. Maybe related: + # https://github.com/sbt/sbt/issues/1894 + # After 10+ experiments I've given up on trying to use sbt.ivy.yhome and + # copy the files myself instead, as recommended here: + # http://readme.drone.io/usage/caching/ + - test -d /drone/.sbt && cp -a /drone/.sbt /root + - rm -rf /drone/.sbt + + - test -d /drone/.ivy2 && cp -a /drone/.ivy2 /root + - rm -rf /drone/.ivy2 + - sbt clean test scripted + + - cp -a /root/.ivy2 /drone + - cp -a /root/.sbt /drone cache: mount: - - /drone/.git - /drone/.sbt - /drone/.ivy2 - /drone/cache diff --git a/build.sbt b/build.sbt index f3c199f418..35b46d2a84 100644 --- a/build.sbt +++ b/build.sbt @@ -184,12 +184,20 @@ lazy val `scalafix-sbt` = project.settings( allSettings, ScriptedPlugin.scriptedSettings, sbtPlugin := true, + scriptedLaunchOpts ++= { + if (sys.props.contains("CI")) + Seq( + s"-Dsbt.ivy.home=/drone/.ivy2/", + s"-Divy.home=/drone/.ivy2/" + ) + else Nil + }, scripted := scripted.dependsOn(publishedArtifacts: _*).evaluated, scalaVersion := "2.10.5", moduleName := "sbt-scalafix", sources in Compile += baseDirectory.value / "../core/src/main/scala/scalafix/Versions.scala", - scriptedLaunchOpts := Seq( + scriptedLaunchOpts ++= Seq( "-Dplugin.version=" + version.value, // .jvmopts is ignored, simulate here "-XX:MaxPermSize=256m",