Skip to content
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

Inject a source identifer into moc #1631

Merged
merged 7 commits into from
Jun 21, 2020
Merged

Inject a source identifer into moc #1631

merged 7 commits into from
Jun 21, 2020

Commits on Jun 20, 2020

  1. Inject a source identifer into moc

    I have been preaching this for so long to other teams, I really better
    clean up my own backyard: Make sure that you can run
    
        moc --version
    
    and get a somewhat useful indication what version that is. This is
    important for when random people use `moc` from random versions of SDK
    or – later – build it themselves and then provide bug reports.
    
    When building locally, with `.git` around, this now injects the git
    revision:
    
        $ ./moc --version
        Motoko compiler (revision 9abae15e-dirty)
    
    (the `-dirty` indicates that my work-tee is not clean).
    
    When `.git` is _not_ available, as typially (and rightfully) when
    building with nix, it looks if Nix’s `$out` variable is set, and
    includes that:
    
        ~/dfinity/motoko $ $(nix-build -A moc)/bin/moc --version
        Motoko compiler (revision xx6fmamdh5bjph9law6x02d7f4hw8f84-moc-bin)
    
    This is less useful for end-users, but it still allows us to (hopefully)
    identify the version, in the worst case by running this command on all
    revisions to find the right one:
    
        $ nix-store --query --outputs $(nix-instantiate -A moc-bin)
        /nix/store/xx6fmamdh5bjph9law6x02d7f4hw8f84-moc-bin
    
    Or by querying hydra (as @basvandijk suggests in
    dfinity/sdk#383 (comment))
    
    Once we do versioned releases, we can of course extend this to inject
    the version number there, and use `git describe --tag` to have
    `v1.0-200-9abae15e` like derscriptions.
    
    I _hope_ this will not cause extra recompilations with `dune`, and will
    work out-of-the box for everyone, but we’ll see.
    nomeata committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    0c12f55 View commit details
    Browse the repository at this point in the history
  2. Patch shebangs

    nomeata committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    0d9e685 View commit details
    Browse the repository at this point in the history
  3. More patch shebangs

    nomeata committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    817b6a8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1a9b4ca View commit details
    Browse the repository at this point in the history
  5. Strip nix hash a bit

    so that it will hopefully not be picked up as a “dependency”
    nomeata committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    6f571b8 View commit details
    Browse the repository at this point in the history
  6. Obscure the ID some more

    so that it does not get picked up by `common.lib.standaloneRust`
    nomeata committed Jun 20, 2020
    Configuration menu
    Copy the full SHA
    8ed661d View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2020

  1. Configuration menu
    Copy the full SHA
    8cd5c20 View commit details
    Browse the repository at this point in the history