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

Stdlib: Reorganize build, test and nix setup #1131

Closed
wants to merge 8 commits into from

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jan 17, 2020

Noteworthy changes:

  • Stdlib sources are in stdlib/src
    tests are in stdlib/test
    docs are in stdlib/doc
    (no more rm $out/*Test.mo)

  • Individual Makefiles in these directories,
    as well as the three examples in stdlib/examples/*

  • In stdlib/tests, auto-generate a test that simply imports
    all stdlib files. This makes sure the stdlib actually compiles
    (was not the case before)

  • Tests and examples use package imports "mo:stdlib/…" to import
    the stdlib, instead of relative paths.
    The Makefiles are set up to point to ./stdlib/src by default. But
    when building via nix, we are building against the stdlib as
    installed by nix

  • More fine-grained nix setup, so when you just change the examples,
    or the tests, the stdlib derivation does not have to be rebuild.

  • Runs the tests for Rx and ActorSpec using wasmtimes

Noteworthy changes:

 * Stdlib sources are in `stdlib/src`
   tests are in `stdlib/test`
   docs are in `stdlib/doc`
   (no more `rm $out/*Test.mo`)

 * Individual Makefiles in these directories,
   as well as the three examples in `stdlib/examples/*`

 * In `stdlib/tests`, auto-generate a test that simply imports
   all stdlib files. This makes sure the stdlib actually compiles
   (was not the case before)

 * Tests and examples use package imports `"mo:stdlib/…"` to import
   the stdlib, instead of relative paths.
   The `Makefile`s are set up to point to `./stdlib/src` by default. But
   when building via nix, we are building against the stdlib as
   installed by nix

 * More fine-grained nix setup, so when you just change the examples,
   or the tests, the `stdlib` derivation does not have to be rebuild.

 * Runs the tests for `Rx` and `ActorSpec` using `wasmtimes`
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 17, 2020

(if someone is worried about possible merge conflicts of their PRs against stdlib, I volunteer to merge master into them after this lands.)

@matthewhammer
Copy link
Contributor

This is great; thanks, Joachim!

Copy link
Contributor

@matthewhammer matthewhammer left a comment

Choose a reason for hiding this comment

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

LGTM

default.nix Outdated Show resolved Hide resolved
Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

Let me try these.

stdlib/doc/Makefile Outdated Show resolved Hide resolved
stdlib/doc/Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

Unfortunately the .md, .html files are garbled?

import Prim "mo:prim";
import Iter "iter.mo";

module {
Hash values

Try

head ~/motoko/stdlib/doc/_out/hash.md

Similarly

tail ~/motoko/stdlib/doc/_out/hash.md

@matthewhammer maybe you can adapt the doc extractor to deal with the new-fangled imports and module { ... } wrapping? (Could be in a follow-up PR!)

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 18, 2020

Is that a regression with the docs?

I am tempted to work on a simple doc system that is good enough to get the stdlib docs into the current manual soon (even if it's not anything we can hand out to people to use on their own libraries yet). So I'd rather not hold this up by the (currently unused) docs.

Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

Yah, polished docs can wait. LGTM!

@nomeata nomeata added the automerge-squash When ready, merge (using squash) label Jan 18, 2020
@nomeata
Copy link
Collaborator Author

nomeata commented Jan 18, 2020

Closed in favor of #1135

@nomeata nomeata closed this Jan 18, 2020
@nomeata nomeata deleted the joachim/stdlib/makefile branch January 18, 2020 17:35
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Jan 18, 2020
@matthewhammer
Copy link
Contributor

matthewhammer commented Jan 21, 2020

@matthewhammer maybe you can adapt the doc extractor to deal with the new-fangled imports and module { ... } wrapping? (Could be in a follow-up PR!)

I like the idea of fixing this (it should be fixed), but I don't like the idea of investing more energy in my python script. It was never meant to live this long, honestly.

What did we decide this morning, in the team meeting?

@nomeata
Copy link
Collaborator Author

nomeata commented Jan 21, 2020

We didn't decide anything really. I am inclined to have a closer look at what we have, maybe refine the hack we have, and produce asciidoc that can be included as a chapter in the manual maybe.

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.

3 participants