Skip to content

Order of Scala compile options not maintained #164

Open
@s-nel

Description

@s-nel

Describe the bug

The order of -Wconf options is important in evaluating which warning configuration rules apply. In Scala 2.13.15 the last matching rule will apply. In Gradle everything works and the order we specify the -Wconf is respected, however when we export the Bloop build, the order is completely changed.

That's because this plugin converts the list of options into a set and then sorts the set.

val additionalOptions: Set[String] = {
val opts = options.getAdditionalParameters
if (opts == null) Set.empty
else {
// scalac options are passed back as Strings but under the hood can be GStringImpls which aren't Strings - so cope with that
val optionList =
opts.asScala.toList
.asInstanceOf[List[Object]]
.filter(_ != null)
.map(_.toString)
fuseOptionsWithArguments(optionList).toSet
}
}
// Sort compiler flags to get a deterministic order when extracting the project
splitFlags(
baseOptions.union(loggingPhases).union(additionalOptions).toList.sorted
)

Expected behavior

The order of Scala compiler options should match exactly what Gradle uses to compile Scala.

Operating system

macOS

Version of Gradle

7.6.4

Version of gradle-bloop

1.6.2

Version of Bloop

1.5.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions