Skip to content

Use Skylib's skylark_library for rules. - #214

Merged
mattmoor merged 4 commits into
bazelbuild:masterfrom
Capstan:skylib_library
Dec 7, 2017
Merged

mattmoor merged 4 commits into
bazelbuild:masterfrom
Capstan:skylib_library

Conversation

@Capstan

@Capstan Capstan commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

This only addresses docker directory and its dependencies: the container and skylib directories.

@mattmoor

mattmoor commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

Travis is unhappy:

The command "buildifier -mode=check $(find . -name WORKSPACE -type f)" exited with 4.

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I think my only concern is potential impact to dependents.

Comment thread WORKSPACE Outdated
d_repositories()

# For skylib_library.
git_repository(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think dependents will need these dependencies, so can you add them to the repositories() function in container/container.bzl?

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 can do bazel_skylib, but apparently trying to do that with io_bazel ends up with a chicken-and-egg problem:

ERROR: Failed to load Skylark extension '@io_bazel//tools/build_defs/hash:hash.bzl'.
It usually happens when the repository is not defined prior to being used.
Maybe repository 'io_bazel' was defined later in your WORKSPACE file?

Since WORKSPACE loads container.bzl and that loads container/image.bzl and that refers to io_bazel, I'm not sure how to extract that nicely into repositories only and structural defines separately. Would you want a container_repos.bzl that was specific to WORKSPACE includes? This model kinda sucks. I would think it'd want to at least warn you that you were asking for a different (esp. if later) tag or commit instead of the "I just hope somebody includes it" model.

@Capstan Capstan Nov 4, 2017 •

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.

Alright, I have some kludges that do this in Capstan@ec938fa It makes there be a separation between Skylark to establish repos and Skylark for rules. This allows the latter to refer to other repositories but ensures that all of those repository names have been defined first. A top-level WORKSPACE must load and invoke the repos macro before trying to load other Skylark in that project.

I'm not sure I like it better, but it works (well, it gets further along in e2e). Also, /bin/true doesn't exist by default on an Xcode-laden Mac (it's /usr/bin/true), and I'm not sure yet what else doesn't work when locally running e2e test on a Mac.

@Capstan

Capstan commented Nov 4, 2017

Copy link
Copy Markdown
Contributor Author

buildifier wanted a slightly different order in the WORKSPACE file. Fixed.

@Capstan
Capstan force-pushed the skylib_library branch 3 times, most recently from de26cdd to b234d62 Compare November 4, 2017 08:25
@mattmoor

mattmoor commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

@Capstan IIUC, if we wait until a sufficiently modern Bazel is released, and start to require that version, we could avoid the breaking change?

If so, can we determine when said change would land in a Bazel release? /cc @damienmg

I think my preference would be to force users upgrading rules_docker with older Bazel versions to upgrade Bazel too vs. breaking everyone that upgrades. :(

If we're talking about O(weeks), then I think I'd rather we wait on merging the PR (and perhaps merge the change directly into the mono-repo to unblock you).

Hopefully that all makes sense? WDYT?

@damienmg

damienmg commented Nov 9, 2017 via email

Copy link
Copy Markdown
Contributor

@Capstan

Capstan commented Nov 9, 2017 •

Copy link
Copy Markdown
Contributor Author

@mattmoor Yes, a modern Bazel would also work here. It doesn't ultimately solve the problem that upstream Bazel source changes will not be applied to rules_docker identically: two developers with different Bazel versions with different hash.bzl files may build rules_docker differently. It's a pretty narrow boundary case, so perhaps fine to leave as a known issue. Or, you could institute a "you must build this with this version of Bazel" as something analogous to importing a specific tag/commit at theWORKSPACE level.

@damienmg Ooh, that's good to hear. I thought my commit was going to be after the cutoff for 0.8. Too bad we don't have labels to show "commit first released in release" I can wait 10 days. though this is starting to block forward progress on my end.

@Capstan

Capstan commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

I manually installed 0.8-rc2 and moved build references back to build_tools and it worked. Additionally, I made travis point at bazel testing branch so that it should at least validate that e2e tests will run with the release is live.

@mattmoor

mattmoor commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

I believe you already have this change against the mono-repo, can we merge that and hold off on this for ~10 days? I think that should unblock you?

@Capstan

Capstan commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

@mattmoor SGTM.

@Capstan Capstan closed this Nov 21, 2017
@Capstan
Capstan deleted the skylib_library branch November 21, 2017 17:02
@Capstan
Capstan restored the skylib_library branch November 22, 2017 08:51
@Capstan

Capstan commented Nov 22, 2017

Copy link
Copy Markdown
Contributor Author

Doh, inadvertently closed it.

@Capstan Capstan reopened this Nov 22, 2017
@bazel-io

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

@Capstan
Capstan force-pushed the skylib_library branch 2 times, most recently from a902698 to 45f021d Compare November 27, 2017 16:06
@Capstan

Capstan commented Nov 27, 2017

Copy link
Copy Markdown
Contributor Author

Now that 0.8 has been released, I've backed out the .travis.yml change to use the testing release instead of the stable release.

@Capstan

Capstan commented Dec 5, 2017 •

Copy link
Copy Markdown
Contributor Author

@mattmoor I think you launched this before Chocolatey was updated (bazelbuild/bazel#4196 (comment)), and so got 0.8.0 anyway.

@mattmoor

mattmoor commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

Bazel CI is green. I'm going to close / reopen to retrigger everything now.

@mattmoor mattmoor closed this Dec 5, 2017
@mattmoor mattmoor reopened this Dec 5, 2017
@bazel-io

bazel-io commented Dec 5, 2017

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

@mattmoor

mattmoor commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

Test this please

@mattmoor

mattmoor commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

@Capstan Looks like all that's left is buildifier :)

@mattmoor

mattmoor commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

Test this please

@mattmoor

mattmoor commented Dec 5, 2017

Copy link
Copy Markdown
Contributor

I tried to "Resolve conflicts" through the web editor, but that seems to have done nothing but retrigger CI... I fixed the buildifier issues separately (sorry for the churn), so this should be good to go after a rebase.

I am going to work through the various other PRs that have accumulated (I'm assuming you aren't still online), but ping me on hangouts if you want to take a lock to avoid going back and forth with merge conflicts :)

@mattmoor

mattmoor commented Dec 7, 2017

Copy link
Copy Markdown
Contributor

Test this please

@mattmoor

mattmoor commented Dec 7, 2017

Copy link
Copy Markdown
Contributor

@Capstan thanks for your patience and persistence :)

@mattmoor
mattmoor merged commit 58bea7a into bazelbuild:master Dec 7, 2017
@Capstan
Capstan deleted the skylib_library branch December 7, 2017 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants