Skip to content

Define libhxcpp and hxcpp as the checkout's version, not 6.0.0 - #515

Draft
dimensionscape wants to merge 1 commit into
mainfrom
fix/checkout-version-defines
Draft

dimensionscape wants to merge 1 commit into
mainfrom
fix/checkout-version-defines

Conversation

@dimensionscape

Copy link
Copy Markdown
Member

A checkout of libhxcpp defines libhxcpp and hxcpp as 6.0.0 whatever its version. On main, which haxelib.json puts at 6.1.0, this is not compiled:

#if (libhxcpp >= version("6.0.2"))
// built against libhxcpp 6.0.2 or newer
#end

haxelib dev and haxelib git both give it. Installed with either, main defines 6.0.0 for both names, and haxelib git at v6.0.4 does too. Every tag from v6.0.0-rc.1 to v6.0.4 has the same two lines.

A C++ build against such a checkout also warns:

Warning: Haxe generated this code for hxcpp 6.0.0, but libhxcpp 6.1.0 from <path> is building it. If that is not intended, make haxelib and HXCPP point at the same copy

Cause

extraParams.hxml names the version in its two define lines, and has named 6.0.0 in every commit. The release workflow corrects the lines with Release stamp in the files it packages, and the commit keeps 6.0.0. haxelib's own -D line gives the name asked for the right version, and the macro lines then replace it.

The build tool takes the version out of the first of those lines, as Haxe records it in Options.txt, for the warning added for #79. That is where the false warning comes from.

The change

  • extraParams.hxml names 6.1.0, the version haxelib.json gives.
  • Release check, and so stamp, stops unless extraParams.hxml defines each name as the version, in one line each, and prints the line it needs. stamp no longer rewrites the file: the package gets the commit's lines, so a tag and its package agree.
  • RELEASING.md: the release commit, and the commit that opens the next version, set the version in both files.

The cost is a second file to edit at each version change. A macro that reads haxelib.json would spare that, at the price of the build tool's warning: the line Haxe records would hold no version, and the version in that line is what the warning compares.

Tests

  • test/release_stamp/check.sh now checks the checkout itself, its two define lines against its haxelib.json. It also runs Release check on a release commit whose extraParams.hxml has one name on another version, the other name on another version, a version that only starts the same (6.0.10 for 6.0.1), a missing line, and a second line for one name. Each is refused with the line it needs. With the test changed and the code as on main, 12 of its 17 checks fail.
  • test/haxelib/check.sh installs the checkout with haxelib dev and reads the defines a build gets. On main that check fails with hxcpp=6.0.0 libhxcpp=6.0.0.

Both ran on 64-bit Windows in Git Bash with Haxe 4.3.7, and pass. CI runs them on pushes to main and not on pull requests.

Also checked by hand:

  • haxelib git from a local clone: main and v6.0.4 give 6.0.0 for both names, and this branch gives 6.1.0.
  • -lib hxcpp and -lib libhxcpp each give both defines as 6.1.0. >= version("6.0.2") and >= version("6.1.0") are true, and >= version("6.1.1") is false.
  • A Lime project that names hxcpp: the release.hxml Lime writes for it compiles with 6.0.0 for both names on main and 6.1.0 here.
  • EnvironmentWide and CppiaHostArgs built against the branch print no warning. With the hxcpp line of Options.txt changed by hand to 6.0.4, the build tool warns that the code was generated for hxcpp 6.0.4, so the warning still fires for a real difference.

Not run here: Linux and macOS.

extraParams.hxml named 6.0.0 in every commit, and the release workflow
corrected it only in the package it built. haxelib dev and haxelib git
install a commit as it is, so a build against a checkout of 6.1.0 was
given libhxcpp=6.0.0 and hxcpp=6.0.0, as was one against the commit a
release tag names, and (libhxcpp >= version("6.0.2")) was false there.
The build tool reads the same line to warn when Haxe generated the code
for another version, so a C++ build against such a checkout warned that
it was generated for hxcpp 6.0.0.

extraParams.hxml now names the version haxelib.json gives, 6.1.0. The
release check stops when the two differ, and the release no longer
rewrites the line in its package, so the commit a tag names is right as
well. test/release_stamp holds the checkout's two files together, and
test/haxelib installs the checkout with haxelib dev and reads the
defines a build gets.

The line keeps its form, with the version in it: the build tool's
warning of two copies mixed (#79) takes the version from that line.
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.

1 participant