mill icon indicating copy to clipboard operation
mill copied to clipboard

Customize the native binary output file name

Open carlosedp opened this issue 3 years ago • 5 comments

This allows customizing the output file name from out to anything.

Previously it would require:

  def nativeLink = T {
    os.Path(scalaNativeWorker().nativeLink(nativeConfig(), (T.dest / "binaryname").toIO))
  }

With this PR, it would be: def nativeBinaryName = "binaryname"

carlosedp avatar Sep 19 '22 20:09 carlosedp

Now it's passing :)

carlosedp avatar Sep 21 '22 16:09 carlosedp

Can you elaborate whether this is pure convenience or there is a real need for this? I'm not so deep in Scala Native workflows, so I also cc'ing @lolgab here.

lefou avatar Sep 21 '22 17:09 lefou

It's purely for convenience for setting up the output binary name. Currently it's hard-coded to "out".

carlosedp avatar Sep 21 '22 17:09 carlosedp

I changed to:

def nativeBinaryName: String = { this.toString }

So the output binary would be named as the object being generated (also could be set by the user if needed). I think it's even more useful and keeps build.sc cleaner.

carlosedp avatar Sep 21 '22 17:09 carlosedp

I don't want to bloat the API in any way. The motivation is to give flexibility to the user without bloating build.sc itself (I remember as a user looking at both build.sc and build.sbt and thinking "why the hell are they so complex!"). No problem canceling this PR if it would cause maintenance burden in the future.

carlosedp avatar Sep 22 '22 13:09 carlosedp