Giter VIP home page Giter VIP logo

Comments (10)

eed3si9n avatar eed3si9n commented on May 27, 2024 1

https://github.com/sbt/launcher hosts launcher-interface and launcher. launcher-interface is the Java interface that exposes an API to the application to be launched, whereas launcher is an รผber JAR of a generic launcher implementation. This code lives somewhat independently from sbt. sbt-launch is a repackaging of launcher with sbt's configuration like which repositories to read from (it used to be hosted on an Ivy repo for sbt 0.13, for example).

from sbt.

eed3si9n avatar eed3si9n commented on May 27, 2024

Probably coming from https://github.com/sbt/launcher/blob/1.x/launcher-implementation/src/main/scala/xsbt/boot/Boot.scala. Would a system property like sbt.boot.exit=false work?

from sbt.

sschuberth avatar sschuberth commented on May 27, 2024

Would a system property like sbt.boot.exit=false work?

For my use-case, yes. Though I believe that introducing conditional code for this could be more complex and introduce pitfalls (like users setting that system property despite using SBT via the CLI) compared to just doing a refactoring that introduces a runLauncher() or similar function (sorry, pseudo-code):

main(String args) {
    arrayOfArgs = parseArgs(args)
    runLauncher(arrayOfArgs)
    exit(0)
}

runLauncher(Array args) {
    // Do the actual work.
}

The Jar's main entry point would still be main(), but programmatic users could just call runlauncher() instead.

from sbt.

eed3si9n avatar eed3si9n commented on May 27, 2024

I don't know if the original scope of sbt launcher was to be a generic launcher, but given that almost no one else but sbt uses it I'd suggest looking into Couriser app as a launcher, or drive Coursier programmatically instead.

Here's launcher code for Giter8 for example https://github.com/foundweekends/giter8/blob/develop/launcher/src/main/scala/LauncherMain.scala that resolves artifacts from Maven repo and calls run via reflection.

from sbt.

sschuberth avatar sschuberth commented on May 27, 2024

Hmm, I'm starting to get confused about launcher-related artifacts now... what's the difference between

from sbt.

sschuberth avatar sschuberth commented on May 27, 2024

Thanks. And where does Coursier now come into play? IIUC Coursier is "just" a dependency resolver, but not a launcher. So maybe launcher at some point started to use Coursier as the dependency resolver?

Anyway, what I'm looking for is a way to programmatically bootstrap the SBT version configured in a project, just like the launcher does, and to run commands like sbt projects / sbt makePom just like from the command line. All in all, what's your recommendation how to achieve that currently?

from sbt.

eed3si9n avatar eed3si9n commented on May 27, 2024

Anyway, what I'm looking for is a way to programmatically bootstrap the SBT version... All in all, what's your recommendation how to achieve that currently?

To some extent that's what CI process like GitHub Actions and Jenkins do basically by creating files and shelling out to an external process. So think that would be probably the easiest regardless of the programming language you're currently on. You can use sbt --client for example to let sbt server run in the background so you don't pay the loading for each command, and shut it down with sbt --client shutdown.

from sbt.

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.