Skip to content

Improve local development workflow #861

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

Merged
merged 2 commits into from
Aug 4, 2020
Merged

Improve local development workflow #861

merged 2 commits into from
Aug 4, 2020

Conversation

staticfloat
Copy link
Member

This adds two new capabilities:

  • --deploy=local; for those who really just want to test out their new
    JLLs locally, this makes it a cinch. Just tack --deploy=local onto
    the end of your build_tarballs.jl invocation, and you'll get the
    artifacts installed and the JLL packages built within your
    ~/.julia/dev directory. (Note that you will still need to add that
    directory into any environment you want to use it from)

  • override directories for dev'ed out JLL packages. This allows a
    user to override the binaries within a JLL easily and cheaply. At
    compile time, the JLL package will look for an override directory in
    its project root, and if it finds it, it will attempt to load binaries
    from there instead of from an Artifact. To aid in setting this up, JLLs
    now have a dev_jll() method that will perform the checkout and copy
    over the normal artifact's contents to the override directory,
    allowing for the user to easily see what must be overwritten in order to
    test out a local build of something.

This adds two new capabilities:

* `--deploy=local`; for those who really just want to test out their new
JLLs locally, this makes it a cinch.  Just tack `--deploy=local` onto
the end of your `build_tarballs.jl` invocation, and you'll get the
artifacts installed and the JLL packages built within your
`~/.julia/dev` directory. (Note that you will still need to add that
directory into any environment you want to use it from)

* `override` directories for `dev`'ed out JLL packages.  This allows a
user to override the binaries within a JLL easily and cheaply.  At
compile time, the JLL package will look for an `override` directory in
its project root, and if it finds it, it will attempt to load binaries
from there instead of from an Artifact.  To aid in setting this up, JLLs
now have a `dev_jll()` method that will perform the checkout and copy
over the normal artifact's contents to the `override` directory,
allowing for the user to easily see what must be overwritten in order to
test out a local build of something.
\"\"\"
is_available()

Return whether the artifact is available for the current platform.
\"\"\"
is_available() = false
is_available() = wrapper_available
Copy link
Member

Choose a reason for hiding this comment

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

Maybe call the function wrapper_available? I wasn't 100% happy with is_available

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't care about the name; I just care about the compiler warnings about precompilation being broken when we redefine a top-level method. :P

If you want a different name, you can pick whatever you want. :)

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Thank you!!! That's super helpful!

I left a bunch of nitpicky comments, trying to read from the perspective of a dumb user who tries to make sense of it all (i.e., mine). I hope this doesn't come across as complaining, it is intended as a constructive feedback.

Comment on lines 351 to 353
developer you may want to easily use custom binaries. In both cases, the new `dev` and
`overrides` directory support make it easy to get complete control over the local JLL package
state.
Copy link
Member

Choose a reason for hiding this comment

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

The way this is phrased (esp. the use of "the new ... support") makes it well suited for a release announcement, but IMHO somewhat less so for a permanent entry in the manual. I don't claim to know the perfect way to do this, but in an attempt to be constructive and not just destructive, here is an attempt for an alternative phrasing

Suggested change
developer you may want to easily use custom binaries. In both cases, the new `dev` and
`overrides` directory support make it easy to get complete control over the local JLL package
state.
developer you may want to easily use custom binaries. To support these use cases, we provide
means to make it easy to get complete control over the local JLL package state, which are
described in the following subsections.

## Overriding a prebuilt JLL package's binaries

After running `pkg> dev LibFoo_jll`, a local JLL package will be checked out to your depot's
`dev` directory, (on most installations this is `~/.julia/dev`) and by default it will make
Copy link
Member

Choose a reason for hiding this comment

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

"it" = the JLL?

Suggested change
`dev` directory, (on most installations this is `~/.julia/dev`) and by default it will make
`dev` directory (on most installations this is `~/.julia/dev`), and by default the JLL will make

After running `pkg> dev LibFoo_jll`, a local JLL package will be checked out to your depot's
`dev` directory, (on most installations this is `~/.julia/dev`) and by default it will make
use of binaries within your depot's `artifacts` directory. However, if an `override`
directory is present within that package directory, it will look within that directory for
Copy link
Member

Choose a reason for hiding this comment

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

Again, "it".

Also, when reading this I was unsure what "that package directory" refers to -- presumably the one in ~/.julia/dev? I didn't see mention of another, but "that" sounds (to me, as a non-native speaker, so this may very well be entirely be my own fault!) as if there was some alternate dir to consider? (And perhaps there is and I am just oblivious to it). Perhaps this could be made clearer; I am not quite sure how so; but for me, the following already is a bit clearer.

Suggested change
directory is present within that package directory, it will look within that directory for
directory is present within its package directory, the JLL will look within that directory for


### Auto-populating `override` directory

To ease creation of an `override` directory, JLL packages now contain a `dev_jll()` function,
Copy link
Member

Choose a reason for hiding this comment

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

I am a bit torn of the use of "now" here, for the reason I already outlined above: how will this read to somebody in one year? One way to go about this wold be to insert a date in here, e.g. "since August 2020". But that doesn't seem great, also it depends a bit on when the patch is merged and Yggdrasil updated to use it?

So I guess instead I would suggest this: drop "now" here, and instead insert a comment somewhere along the lines of: "Note that older JLLs which were generated before this feature was introduced may lack a dev_jll
function."

Suggested change
To ease creation of an `override` directory, JLL packages now contain a `dev_jll()` function,
To ease creation of an `override` directory, JLL packages contain a `dev_jll()` function,

that will ensure that a `~/.julia/dev/<jll name>` package is `dev`'ed out, and will copy the
normal artifact contents into the appropriate `override` directory. This will result in no
functional difference from simply using the artifact directory, but provides a template of
files that can be replaced by custom-built binaries.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
files that can be replaced by custom-built binaries.
files that can be replaced by custom-built binaries.
Note that JLLs which were generated before this feature was introduced to
BinaryBuilder may lack a `dev_jll` function.

## Building a custom JLL package locally

When building a new version of a JLL package, if `--deploy` is passed to `build_tarballs.jl`
then a JLL package will be deployed to a GitHub repository. (Read the documentation given
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
then a JLL package will be deployed to a GitHub repository. (Read the documentation given
then the newly-built JLL package will be deployed to a GitHub repository. (Read the documentation given


When building a new version of a JLL package, if `--deploy` is passed to `build_tarballs.jl`
then a JLL package will be deployed to a GitHub repository. (Read the documentation given
by passing `--help` to a `build_tarballs.jl` script for more on `--deploy` options) If
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
by passing `--help` to a `build_tarballs.jl` script for more on `--deploy` options) If
by passing `--help` to a `build_tarballs.jl` script for more on `--deploy` options). If

by passing `--help` to a `build_tarballs.jl` script for more on `--deploy` options) If
`--deploy=local` is passed, the JLL package will still be built in the `~/.julia/dev/`
directory, but it will not be uploaded anywhere. This is useful for local testing and
validation that the built artifacts are working with your package.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
validation that the built artifacts are working with your package.
for validating that the built artifacts are working with your package.

docs/src/jll.md Outdated
their own binaries, the user may use the `dev_jll()` method inside of JLL packages
to check out a mutable copy of the package to their `~/.julia/dev` directory. An
`override` directory will be created within the package directory, providing a
convenient location for the user to copy in their own libraries over the typical
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
convenient location for the user to copy in their own libraries over the typical
convenient location for the user to copy in their own files over the typical

I'd also consider changing "binaries" at the start of this paragraph to "files", as in principle one might also want to tweak, say, a header or config file, right? Wrong?

docs/src/jll.md Outdated
Comment on lines 216 to 217
In the event that a user wishes to override the binaries within a JLL package with
their own binaries, the user may use the `dev_jll()` method inside of JLL packages
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In the event that a user wishes to override the binaries within a JLL package with
their own binaries, the user may use the `dev_jll()` method inside of JLL packages
In the event that a user wishes to override the binaries within a JLL package with
their own binaries, the user may use the `dev_jll()` method provided by that JLL package

@fingolfin
Copy link
Member

I think this resolves #521

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