Wednesday, November 6, 2013

Upgrading for 1.0 (Wha?)

Dart 1.0 is coming! Dart 1.0 is coming!

OK there may not be an official release date or anything, but it's encouraging to have an actual mention of the until-now-mythical milestone. To get in the spirit, I will take the advice in the announcement and ensure that one of my Pub packages is 1.0 ready.

Since the ctrl-alt-foo package's build is currently failing, I will use this as an opportunity to fix is as well. Before fixing any remaining tests (I actually may already have them shipshape), I upgrade everything to the Dart 1.0 compatible settings. This involves a few changes to the pubspec.yaml file:
name: ctrl_alt_foo
version: 0.3.0
description: For creating simple keyboard shortcuts.
- Chris Strom <>
  sdk: ">=0.8.10+6 <2.0.0"
  unittest: any
I have bumped the version of my own library from 0.2.0 to 0.3.0. This is mostly because I am breaking some of the API in an attempt to use more of the new KeyEvent stuff. The large version bump is not really necessary just for preparing for 1.0.

The announcement specifically mentions that the days of any version constraints has past with the approaching 1.0. I am unsure if that applies to development dependencies like unittest. I rather like using the more recent version of development dependencies. No doubt I will change my mind once multiple builds break on a future library change, but for now I will risk it.

The important change is the sdk restriction to 0.8.10+6 or higher, which will support the 1.0 release. Armed with that change and the most recent version of the SDK, I begin the upgrade process. And quickly hit a roadblock:
➜  ctrl-alt-foo git:(key-event) ✗ pub upgrade   
Resolving dependencies...
Package ctrl_alt_foo requires SDK version >=0.8.10+6 <2.0.0 but the current SDK is 0.8.10+3.r29803.
This is just how much on the bleeding edge I am—I am following announcement instructions from the future! At the time of this writing 29803 is the most recent SDK on the site.

Rather than relaxing the SDK constraint, I will pull down the more recent continuous build from the continuous build archives. With that, I am able to grab the most recent version of unittest and its dependencies:
➜  ctrl-alt-foo git:(key-event) ✗ pub upgrade
Resolving dependencies...............
Downloading unittest 0.9.0 from hosted...
Downloading stack_trace 0.9.0 from hosted...
Downloading path 0.9.0 from hosted...
Dependencies upgraded!
I run into an odd utf-8 issue. Utf-8 that I had placed into a string was no longer coming through as utf-8, but rather the the utf-8 representation of the three bytes in the original utf-8 string. For now, I chalk that up to running the bleeding edge and implement a quick workaround.

After merging my code changes, I am ready to publish to
➜  ctrl-alt-foo git:(master) pub lish
Publishing "ctrl_alt_foo" 0.3.0 to
|-- .gitignore
|-- lib
|   |-- helpers.dart
|   |-- key_event_x.dart
|   |-- key_identifier.dart
|   |-- keys.dart
|   '-- shortcut.dart
|-- pubspec.yaml
'-- test
    |-- index.html
    '-- test.dart

Looks great! Are you ready to upload your package (y/n)? y
ctrl_alt_foo 0.3.0 uploaded successfully.
And that's all there is to getting ready for the big 1.0. At least in this package.

Now if you'll excuse me, I do believe that I need to finish up the next edition of Dart for Hipsters. Quickly.

Day #927

No comments:

Post a Comment