dwijnand / sbt-extras

A more featureful runner for sbt, the simple/scala/standard build tool
Other
912 stars 171 forks source link

.jvmopts is parsed differently comparing to the original(*) sbt launcher #349

Closed satorg closed 1 year ago

satorg commented 2 years ago

* "original" means https://github.com/sbt/sbt

Description

The original sbt recognizes spaces within lines of .jvmopts as a property separator whereas sbt-extras does not respect the spaces.

How to Reproduce:

Having both the original sbt v1.7.1 and sbt-extras (installed as sbtx from the current master):

  1. $ mkdir sbtx-vs-sbt-jvmopts
  2. $ cd sbtx-vs-sbt-jvmopts
  3. $ mkdir project
  4. $ echo 'sbt.version=1.7.1' > project/build.properties
  5. $ echo '-Daaa=bbb -Dccc=ddd' > .jvmopts
  6. $ echo 'object TheApp extends App { sys.props.foreach(println) }' > TheApp.scala
  7. Run the app with the original launcher: $ sbt run
  8. Observe that aaa=bbb and ccc=ddd are parsed as separate properties:
    ...
    (aaa, bbb)
    (ccc, ddd)
    ...
  9. Run the app with sbt-extras: $ sbtx run
  10. Observe that these two parsed as a single property aaa=bbb -Dccc=ddd:
    ...
    (aaa,bbb -Dccc=ddd)
    ...

Expected Behavior

p.7 and p.9 from the above should emit identical sets of system properties including aaa=bbb and ccc=ddd.

Actual Behavior

The produced results are different, actually.

dwijnand commented 1 year ago

See https://github.com/dwijnand/sbt-extras/pull/358 for why we don't want to change the behaviour. Thank you to @jeffreyolchovy for putting the time into looking at this.