Skip to content

Cross compiling library versions #270

@pgrandjean

Description

@pgrandjean

I need to cross compile an SBT multi-project against different Spark and Hadoop versions, and have developed a possible solution that works with sbt-release. Borrowing the vocab introduced by sbt-cross plugin, Spark & Hadoop are the two "axes" for cross compilation.

The release process looks like the following:

  releaseProcess := Seq[ReleaseStep](
    checkSnapshotDependencies,
    inquireVersions,
    setReleaseVersion,
    commitReleaseVersion,
    tagRelease,
    crossProjects(
      crossReleaseSteps(
        runClean,
        runTest,
        publishArtifacts
      )
    ),
    setNextVersion,
    commitNextVersion,
    pushChanges
  )

The crossProjects add-on iterates over a list of sub-projects and crossReleaseSteps iterates over a list of settings to be cross compiled. In this example both are combined but it is possible to use them independently.

There are two additional settings to be set. For example, if there are 3 sub-projects and two axes for cross compilation:

releaseCrossProjects := Seq(subproject1, subproject2, subproject3)
releaseCrossSettings := List(
  List(hadoopClassifier -> "hadoop2.7", sparkClassifier -> "spark2.4"),
  List(hadoopClassifier -> "hadoop3.1", sparkClassifier -> "spark3.0")
)

I tried integrating sbt-cross and sbt-release together but could not make it work. Therefore I developed these add-ons for sbt-release

Would the sbt-release project be interested in adding the above features to sbt-release? I would be happy to prepare a PR.

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