Skip to content

Invert version defaulting #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 23, 2016

Conversation

djspiewak
Copy link
Collaborator

@djspiewak djspiewak commented Nov 21, 2016

See #6 for motivation. Also adds an isTravisBuild setting, which is generally useful in more complex builds.

@@ -3,9 +3,26 @@ package sbttravisci
import sbt._, Keys._

object TravisCiPlugin extends AutoPlugin {
private val DefaultScalaVersion = "2.10.6" // for compatibility with stock sbt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we default to 2.12.0 instead? I just set it to 2.10 since that's the default SBT behavior if you don't specify scalaVersion.

Copy link
Owner

@dwijnand dwijnand Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still afk so can't explain fully, but I think we should bomb by default. Avoids circular dependencies between the two keys that I had to avoid in my wartremover patch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with that. Will implement.

Copy link
Owner

@dwijnand dwijnand Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No .travis.yml with scala versions, no party.

override def requires = plugins.JvmPlugin
override def trigger = allRequirements
override def buildSettings = Seq(
isTravisBuild := sys.env.get("TRAVIS").isDefined,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env vars are global, so it would be even better to set this in globalSettings. Won't change anything for 99% of the cases, but it's more correct.l technically. Its in the docs: new key defaults should be set in globalSettings.

Also this is a great addition.

@@ -24,7 +24,9 @@ Other than that, as `sbt-travisci` is an AutoPlugin that is all that is required

## Detail

`crossScalaVersions in ThisBuild` will be automatically set to the scala versions in `.travis.yml`.
`crossScalaVersions in ThisBuild` will be automatically set to the scala versions in `.travis.yml`. `scalaVersion in ThisBuild` will be automatically set to the `last` version in `crossScalaVersions`, and so by default, SBT will assume you want to develop under the *last* version listed in `.travis.yml`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/SBT/sbt/ please :-) even at the start of the sentence. Think eBay or iPhone

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of the branding change. Is this just part of discouraging "sbt's" use as an acronym?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. Not just to discourage "simple build tool" but also "scala build tool" as it works as a java build tool too

@dwijnand
Copy link
Owner

This is great. Let me get back to a keyboard and re-read and respond to everything (and it wasn't too much spam, its great stuff). Thanks.

@dwijnand
Copy link
Owner

Again, this is great. And I agree to all parts of it.

Some Scala builds don't depend on TRAVIS_SCALA_VERSION, but I'm happy for this to be opinionated as such.

@dwijnand dwijnand merged commit c7ee05e into dwijnand:master Nov 23, 2016
@djspiewak djspiewak deleted the feature/invert-version-defaulting branch November 25, 2016 22:43
if (isTravisBuild.value)
sys.env.get("TRAVIS_SCALA_VERSION").get
else
crossScalaVersions.value.last // sort .travis.yml versions in ascending order
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that:

The jobs which are explicitly included inherit the first value of the expansion keys defined.

https://docs.travis-ci.com/user/build-matrix/#explicitly-included-jobs-inherit-the-first-value-in-the-array

This includes (IIUC) jobs added with matrix.include, job.include or build stages.

So... in hindsight, the default should be .head not .last... Not sure what to do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh, interesting! Good point. I think it's worth changing, but obviously it will require some sort of version bump. Probably 2.0?

Copy link
Owner

@dwijnand dwijnand Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I don't have an immediate need, but we can go that way if it comes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants