Skip to content

Conversation

@piyushnarang
Copy link
Collaborator

Building on #257. Adding 2.12.0 as a cross version to include. Had to disable building 2.12 for a few projects as they require some finagle 2.12 artifacts (which in turn requires bijection-core 2.12). Once the finagle artifacts are in, we can reenable those projects.

.travis.yml Outdated
include:
- scala: 2.10.6
script: ./sbt ++$TRAVIS_SCALA_VERSION clean scalafmtTest test mimaReportBinaryIssues
script: ./sbt "+++$TRAVIS_SCALA_VERSION clean" "+++$TRAVIS_SCALA_VERSION test" "+++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the 3 +++? I thought it was just ++?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to hook up the sbt-doge plugin to ensure that the overridden crossScalaVersions is respected. Without this I still get the error in the 3 projects we want to skip. I think we've done something similar in: twitter/chill#253

@codecov-io
Copy link

codecov-io commented Nov 28, 2016

Current coverage is 65.21% (diff: 100%)

Merging #258 into develop will decrease coverage by 0.93%

@@            develop       #258   diff @@
==========================================
  Files            50         43     -7   
  Lines          1397       1259   -138   
  Methods        1347       1214   -133   
  Messages          0          0          
  Branches         50         45     -5   
==========================================
- Hits            924        821   -103   
+ Misses          473        438    -35   
  Partials          0          0          

Powered by Codecov. Last update 469154b...d2b7314

@piyushnarang piyushnarang mentioned this pull request Nov 28, 2016
@clhodapp
Copy link
Contributor

FWIW, scalafmtTest should work. The output is a bit janky (there seems to be some mixing between the output for different projects b/c of the way I hacked calling it into the build), but it should report accurate results.

@piyushnarang
Copy link
Collaborator Author

@clhodapp ah you're right. Just tried running it and it seems to work. I can update to turn it back on.

Copy link
Contributor

@clhodapp clhodapp left a comment

Choose a reason for hiding this comment

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

Nothing here stands out as crazy

@johnynek
Copy link
Collaborator

If we turn on coverage by default doesn't that dramatically slow down the local tests?

@piyushnarang
Copy link
Collaborator Author

piyushnarang commented Nov 28, 2016

@johnynek looking at the build time in travis - https://travis-ci.org/twitter/bijection/builds/179597059
Was around 5-6 mins. There seems to be a fair bit of variance in general in the builds there. Seems like it was turned on earlier for 2.11.8 right? Do we want to have it turned on only for that?

@johnynek
Copy link
Collaborator

you should not need to do coverage for more than one version of scala, since it is the same code, right?

I think just picking one version "the main one", whatever we consider that to be, should work.

@piyushnarang
Copy link
Collaborator Author

@johnynek yes, running coverage on one version should suffice. I wasn't able to figure out how to enable coverage via the command line using sbt. Was running into an error:

[info] Set current project to bijection (in build file:/home/travis/build/twitter/bijection/)
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: coverage (similar: coverageReport, coverageEnabled, coverageMinimum)
[error] bijection-core/coverage
[error]                        ^
The command "./sbt "+++$TRAVIS_SCALA_VERSION clean" "+++$TRAVIS_SCALA_VERSION coverage" "+++$TRAVIS_SCALA_VERSION test" "+++$TRAVIS_SCALA_VERSION coverageReport" "+++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues"" exited with 1.

Can check if there's an issue running the sbt-coverage plugin with the sbt-doge +++ operator. Another option would be to enableCoverage in the build.sbt only for 2.11.8.

@piyushnarang
Copy link
Collaborator Author

piyushnarang commented Nov 29, 2016

@johnynek ok not 100% sure what the best way to proceed on this is. Here's what I see. When I set up coverageEnabled conditionally:

val buildLevelSettings = Seq(
...
coverageEnabled := (if (scalaVersion.value startsWith "2.11") true else false),
...
)

I still end up with coverage running in 2.12.0:

[tw-mbp-pnarang bijection (scala-2.12)]$ ./sbt "+++2.12.0 test"
[info] Loading global plugins from /Users/pnarang/.sbt/0.13/plugins
[info] Loading project definition from /Users/pnarang/workspace/bijection/project
[info] Resolving key references (10437 settings) ...
[info] Set current project to bijection (in build file:/Users/pnarang/workspace/bijection/)
[info] Setting version to 2.12.0
[info] Reapplying settings...
[info] Set current project to bijection (in build file:/Users/pnarang/workspace/bijection/)
[info] Compiling 27 Scala sources and 2 Java sources to /Users/pnarang/workspace/bijection/bijection-core/target/scala-2.11/classes...
[info] [info] Cleaning datadir [/Users/pnarang/workspace/bijection/bijection-core/target/scala-2.11/scoverage-data]
[info] [info] Beginning coverage instrumentation
...

Seems like our default setting of scalaVersion = 2.11.8 is ensuring that this can't be updated even if we try to pass it with ++ or +++ (it always is 2.11.8).

This shows up even in the sbt console:

$ ./sbt
> ++ 2.10.6
[info] Setting version to 2.10.6
[info] Reapplying settings...
[info] Set current project to bijection (in build file:/Users/pnarang/workspace/bijection/)
> show scalaVersion
[info] bijection-guava/*:scalaVersion
[info] 	2.11.8
...

Now if I comment out the line in build.sbt setting scalaVersion := "2.11.8", this seems to work ok - both the sbt console and the coverage builds behave as expected. We show the version passed in ++ or +++ and coverageEnabled = true only for 2.11.

Seems like this problem is present even currently. We are checking scalaVersion to set scalacOptions - https://github.com/twitter/bijection/blob/develop/build.sbt#L26. When I tested this out on the sbt command line, it seems like we're always setting the options for 2.11.

My proposal is to remove the line setting scalaVersion. There might be a better way to do this that I may be missing so if folks have other ideas / suggestions, I could try them out.

@clhodapp
Copy link
Contributor

What if you move the setting for coverageEnabled down into the module method?

build.sbt Outdated
scalaVersion := "2.11.8",
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
javacOptions in doc := Seq("-source", "1.6"),
coverageEnabled := true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to enable this in the build? Can't we do +++$TRAVIS_SCALA_VERSION coverage test or something?

What is it about this change that is requiring us to always do coverage?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point. As a dev just trying to see if you broke the tests, you probably wouldn't want coverage to run anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah so I originally tried to do that. The +++$TRAVIS_SCALA_VERSION coverage command doesn't work with the sbt-doge plugin for some reason (see above): #258 (comment)

I needed to pull in the sbt-doge plugin cause I wanted to ensure that bijection-scrooge, bijectionUtil and bijectionFinagleMySql can override the cross-scala versions to skip 2.12 as we don't have the finagle artifacts. Based on searching that seemed to be the best option to skip modules selectively for a given scala version. If you folks know of a better alternative, I could try that and drop the doge plugin.

@piyushnarang
Copy link
Collaborator Author

@clhodapp / @johnynek - made some updates, now code coverage is enabled only on 2.11. Some of the pain is related to sbt-doge which doesn't seem to have been working with the inThisBuild method for some reason. It was always using scalaVersion = 2.11.8. The sbt-doge changes are temporary till finagle is able to publish their 2.12 jars. At that point we can yank it out and enable the builds on the 3 projects that depend on finagle.

@clhodapp
Copy link
Contributor

Not setting a build-level scala version breaks tools like ensime.

Could you try moving just scalaVersion out of the list as scalaVersion in ThisBuild := "2.11.8" and renaming the list back to commonSettings? I wasn't thinking about compatibility with sbt-doge when I did my build refactoring, but I believe that doing this should work.

@piyushnarang
Copy link
Collaborator Author

@clhodapp so I tried setting the scalaVersion like you specified and renaming. Seems like that doesn't end up compiling to 2.12. So the version ends up staying at 2.11.8 even though we specify +++2.12.0.
I don't think we were setting the build level scala version earlier right? I guess I'm also wondering if it is ok to break it for just the finagle release to proceed? Once the finagle jars are published, we don't need the sbt-doge stuff.

@clhodapp
Copy link
Contributor

clhodapp commented Nov 30, 2016

Bleh. OK. I give up then haha. With your PR as-is, bijection is no worse off in any way than it was a few days ago, so it seems reasonable. Once you remove doge, you can set a build-level scala version if desired.

@johnynek
Copy link
Collaborator

johnynek commented Nov 30, 2016 via email

include:
- scala: 2.10.6
script: ./sbt ++$TRAVIS_SCALA_VERSION clean scalafmtTest test mimaReportBinaryIssues
script: ./sbt "+++$TRAVIS_SCALA_VERSION clean" "+++$TRAVIS_SCALA_VERSION scalafmtTest" "+++$TRAVIS_SCALA_VERSION test" "+++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues"
Copy link
Collaborator

Choose a reason for hiding this comment

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

one last thing - do we want this binary check for 2.10 as well? In algebird we only check the 2.11 build.

@sritchie
Copy link
Collaborator

Other than my one comment, 👍 !

@johnynek
Copy link
Collaborator

Actually good point @sritchie but I do think we want to check binary compat in all versions. For instance, the rules in scala 2.12 are different than 2.11 (more changes should be binary compatible due to java 8 features being used). Scala 2.10 and 2.11 might be the same or close, but just to be sure it seems like a good idea to run on all supported versions.

@johnynek johnynek merged commit 886f42e into twitter:develop Nov 30, 2016
@piyushnarang
Copy link
Collaborator Author

Thanks for the review and feedback @johnynek, @clhodapp, @mosesn, @sritchie! Will follow up once the finagle artifacts are out with cleaning this back up :-)

@stuhood
Copy link

stuhood commented Nov 30, 2016

Thanks everyone! Will watch for a release.

@sritchie
Copy link
Collaborator

sritchie commented Dec 4, 2016

@stuhood bijection is out! 0.9.4 should get you going. We're working on algebird now.

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.

7 participants