Skip to content
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

Remove coursier cache from slug #131

Closed
jkutner opened this issue Sep 11, 2018 · 4 comments
Closed

Remove coursier cache from slug #131

jkutner opened this issue Sep 11, 2018 · 4 comments

Comments

@jkutner
Copy link
Contributor

jkutner commented Sep 11, 2018

Coursier leaves a large .sbt_home/.cache/coursier/ directory in the slug. I'm not sure what it's job is, but it can probably be removed from the slug and kept in the build cache.

@drobert
Copy link

drobert commented May 7, 2020

We ran into the same thing. Seems to be a quick fix, I can try to put a PR up tonight, but:

if [ "$KEEP_COURSIER_CACHE" != "true" ] && [ -d $SBT_USER_HOME/.coursier ]; then
status "Dropping coursier cache from the slug"
rm -rf $SBT_USER_HOME/.coursier
fi
looks for a directory .coursier but the directory name, as noted, is .cache

@drobert
Copy link

drobert commented May 7, 2020

PR available: #148

@drobert
Copy link

drobert commented May 7, 2020

Incidentally, as a temporary workaround, we've done this in build.sbt:

  .settings(
    // ...
    stageCleanupTask := {
      val localStage = (stage in Universal).value
      val log = streams.value.log
      if (sys.env.getOrElse("POST_STAGE_CLEAN", "true").equals("true")) {
        def cleanup(base: File): PathFinder = {
          // build artifacts typically within a "target" dir, but even
          // the root's aren't needed
          base ** "target" * ("scala-2.12" || "streams") +++
          // any 'target' directory that isn't the root project's
          ((base ** "target") --- (base / "target")) +++
          // ivy2 or coursier lib caches
          base ** (".ivy2" || ".cache")
        }
        sbt.IO.delete(cleanup(baseDirectory.value).get)
      }
      localStage
    },
    stage := stageCleanupTask.value,
    // ...

@Malax
Copy link
Member

Malax commented Aug 10, 2020

This seems to be fixed since 18da922, closing.

@Malax Malax closed this as completed Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants