Skip to content

Dunify release#1361

Merged
gpetiot merged 7 commits intoocaml-ppx:masterfrom
Et7f3:dunify-release
Sep 11, 2020
Merged

Dunify release#1361
gpetiot merged 7 commits intoocaml-ppx:masterfrom
Et7f3:dunify-release

Conversation

@Et7f3
Copy link
Copy Markdown
Contributor

@Et7f3 Et7f3 commented May 8, 2020

In reference of #900 (comment) (opened by @gpetiot) Here metadata are stored with dune who is responsible to build opam metadata (less metadata to update when releasing)

Some notes:

  • header is removed because now it is generated by dune. I can use ocamlformat.template to inject header but it will be at the end.
  • opam file differ
-["ocaml" "tools/gen_version.mlt" "lib/Version.ml" version] {pinned}

%%VERSION%% = git describe --always --dirty
the script = git describe --tags --dirty --always
I don't know how should I handle this. I don't get how we can print 0.14.2 for instance and not the commit I have tried with manual git tag my repo but no luck 🤷
maybe #1133 handle correctly ?

I open in draft because I might have broken version field.

@jberdine
Copy link
Copy Markdown
Collaborator

jberdine commented May 8, 2020

It should not be necessary to have a header in a file generated from another file that does have a header. I make no guarantees that the bot is capable of handling that though. But a "header" at the end would not be seen either. Let's not worry about the header until the bot yells at me. It is complaining already and will until #1349 is merged anyhow.

But I expect that this will have to wait for at least #1133. I also could not figure out how to specify the build field of the dune-generated opam file, and getting the correct version when pinning is necessary.

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented May 8, 2020

Thanks for your quick reply. I have tested to manually pin master and my branch with esy and I get unknown as version. I will test with opam to see if we got the same version or not.

But I expect that this will have to wait for at least #1133. I also could not figure out how to specify the build field of the dune-generated opam file, and getting the correct version when pinning is necessary.

I can force dune to add a specific build command (with the template) but it will not update as dune upgrade and change his cli.

EDIT: With opam: my fork: 0.14.1-5-gd3b5a80 master: 0.14.1

@gpetiot gpetiot requested a review from emillon May 11, 2020 11:56
Copy link
Copy Markdown
Collaborator

@jberdine jberdine left a comment

Choose a reason for hiding this comment

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

This seems like it could be basically okay after a bit more iteration. But I do not understand the motivation for this to be honest. I'm not objecting, but it just seems that we'd copy the contents of the opam file into dune-project and change the syntax. I'd be happy to learn more of the motivation.

@Et7f3 Et7f3 marked this pull request as ready for review June 14, 2020 15:41
@gpetiot gpetiot added the no changelog set this to bypass the CI check for changelog entries label Jun 22, 2020
Comment on lines +39 to +40
"@install"
"@runtest" {with-test}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it obvious that these have the same behavior as the version before this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

dune build @runtest === dune runtest but with one command that allow us to build also the project
https://dune.readthedocs.io/en/stable/tests.html?highlight=%40install#running-tests and @install just generate file required for the installation

-p pkg is a shorthand for --root . --only-packages pkg --profile release --default-target @install

https://dune.readthedocs.io/en/stable/opam.html#invocation-from-opam I am a liitle bit confused because we have then @install present two times but it is taken from dune opam template. https://github.com/ocaml/dune/blob/ecbee3d4bf8d82b47667fd6a1f74f01deb5e9eb2/src/dune/opam_create.ml#L24

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok, I hadn't appreciated that {with-test} could be placed on individual arguments instead of whole commands.

Ok, so @install only builds the files to be installed, but does not actually copy them into some other directories, etc. Correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will ask on discord for confirmation.

Copy link
Copy Markdown

@mseri mseri Jun 25, 2020

Choose a reason for hiding this comment

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

Yes they are doing almost the same thing. As written the command build all installable libraries and executables (Even if not needed for the tests) and runs the tests. You can add different filters on each string in the list In the opam files, it’s quite convenient at times. @Et7f3 reply above is spot on

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Jun 25, 2020

This seems like it could be basically okay after a bit more iteration. But I do not understand the motivation for this to be honest. I'm not objecting, but it just seems that we'd copy the contents of the opam file into dune-project and change the syntax. I'd be happy to learn more of the motivation.

When dune generate file: dune automatically insert the good dune lower bound so one metadata whe can ignore. Also dune doesn't have such feature yet (or i'm not aware) but it could do more sanity check for instance: only make available dependencies we have listed in our package

Copy link
Copy Markdown
Collaborator

@jberdine jberdine left a comment

Choose a reason for hiding this comment

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

Ok, thanks for the discussion, this looks good.

One final question: the dune-project file has the look of being auto-formatted. Is it, and how do you do that? AFAIU e.g. dune build @_build/default/fmt formats dune but not dune-project files. Just me?

@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Jun 30, 2020

I rebased and updated the constraint on base according to #1396. I don't think there is a way to format the dune-project file though but it's not an issue.

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Jul 1, 2020

dune format-dune-file FILE This format any dune file.

@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Jul 1, 2020

dune format-dune-file FILE This format any dune file.

Yes but it's not integrated the same way dune files are when running dune @fmt with the promote feature. We would need to make an inplace transformation in the Makefile. I wouldn't mind waiting until they are automatically formatted by dune.

@jberdine
Copy link
Copy Markdown
Collaborator

jberdine commented Jul 1, 2020

FWIW it could be tmp=$(mktemp -t 'dune-format'); dune format-dune-file dune-project > tmp; mv -f tmp dune-project

@emillon
Copy link
Copy Markdown
Collaborator

emillon commented Jul 2, 2020

@jberdine a motivation for this for example is that when you change (lang dune ...) and use opam file generation, the bound in the opam file will be updated automatically.

@@ -0,0 +1,13 @@
build: [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we merge #1133 before this, we can remove this file before merging

@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Sep 9, 2020

Rebased onto master, should be compatible with the dune-build-info changes.

@gpetiot gpetiot requested review from Julow and emillon September 9, 2020 14:36
@gpetiot gpetiot merged commit c59717d into ocaml-ppx:master Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog set this to bypass the CI check for changelog entries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants