GithubHelp home page GithubHelp logo

Comments (10)

eed3si9n avatar eed3si9n commented on July 23, 2024

I am reluctant to add any sort of file transformation magic. I think sbt-assembly should focus on getting files together in one jar. You could probably define a sbt task to merge files together and generate one yourself.

from sbt-assembly.

rkuhn avatar rkuhn commented on July 23, 2024

Yes, I understand your reluctance, but adding an external merging task is not enough: the result would still need to be inserted into the fat jar, and that is currently not possible, given that it must have the same name as the things it was merged from.

from sbt-assembly.

eed3si9n avatar eed3si9n commented on July 23, 2024

I wonder if I could refactor the sbt-assembly to give you a task that generates the raw list of files right before it gets packaged into the jar. Suppose we call it assembledFiles or something. That'll give you a hook point to place whatever you want in there after ignoring reference.conf from all jars.

from sbt-assembly.

rkuhn avatar rkuhn commented on July 23, 2024

That sounds like it might just cut it: then we just need a task which can for a given project retrieve and merge all reference.conf and put the result somewhere which is also ignored.

from sbt-assembly.

eed3si9n avatar eed3si9n commented on July 23, 2024

Added assembledMappings task and published 0.7.4: a2779b1

from sbt-assembly.

rkuhn avatar rkuhn commented on July 23, 2024

Thanks a bunch, will look into in when I’m back from vacation (next week)!

from sbt-assembly.

rkuhn avatar rkuhn commented on July 23, 2024

Sorry, it took a bit longer. I got the desired effect using the following:

assembledMappings in assembly <<= (assembledMappings in assembly) map { (old: File => Seq[(File, String)]) =>
  (f: File) => old(f) :+ (file("src/main/resources/reference.conf"), "reference.conf")
}

I guess there is some nicer way with some other SBT operator, but this also works :-)

One little thing: where did you publish 0.7.4? I had to publish-local to test this …

from sbt-assembly.

eed3si9n avatar eed3si9n commented on July 23, 2024

It's published on the community repo:

resolvers += Resolver.url("sbt-plugin-releases",
  new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

from sbt-assembly.

rkuhn avatar rkuhn commented on July 23, 2024

Ah, okay. Plans for pushing that to central?

For the record, this is the nicest build.sbt code I could come up with:

excludedFiles in assembly <<= (excludedFiles in assembly) {
  (old) => (bases) => old(bases) ++ (bases flatMap (base => (base / "reference.conf").get))
}

assembledMappings in assembly <<= (assembledMappings in assembly) map {
  (old) => (f) => old(f) :+ (file("src/main/resources/reference.conf"), "reference.conf")
}

Going to write some actual merging to produce our reference.conf next.

from sbt-assembly.

eed3si9n avatar eed3si9n commented on July 23, 2024

Plans for pushing that to central?

I don't think so. The next version of sbt would have it resolved by default and it's only sbt that needs it.

from sbt-assembly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.