Unify bazel-bin and bazel-genfiles

287 views
Skip to first unread message

Laurent Le Brun

unread,
Nov 23, 2018, 1:30:36 PM11/23/18
to baze...@googlegroups.com, Lukács T. Berki
Hi,

For historical reasons, we have two symlinks: bazel-genfiles and bazel-bin. The difference between the two is, as far as I know, not significant. Lukács suggested we could merge the two, and keep a single directory. To try it out, he implemented the flag "--noexperimental_separate_genfiles_directory".

When we tried it in the Google codebase, it broke many targets (although it's not clear how many root causes there are, and how much work it would be to fix them), due to bad assumptions in the code base. I wonder if other users of Bazel would be broken by this flag. I have just tried a few repositories (bazel, skydoc, rules_scala, rules_haskell, rule_nodejs, rules_typescript), all the tests pass with --noexperimental_separate_genfiles_directory.

Shall we switch the default value of the flag?

--
Laurent

Philipp Wollermann

unread,
Nov 23, 2018, 2:11:13 PM11/23/18
to Laurent Le Brun, baze...@googlegroups.com, Lukács T. Berki
I'm in favor of switching this. The distinction between bazel-bin and bazel-genfiles is very unintuitive, IMHO.
I couldn't tell you which files go where, without looking into the code.


--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/CAFtxR%2Bm2qtQRCdNr7muq%2BxO9M-sYpdkJpKzrC37Dtofav9Scbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Philipp Wollermann
Software Engineer
phi...@google.com

Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

markus....@ecosia.org

unread,
Nov 23, 2018, 3:09:45 PM11/23/18
to bazel-dev
I am very much in favour of switching the default - in fact we already use that flag in our projects because I found it very confusing also to have most things end up in bazel-bin but then some in bazel-genfiles. So far it did not seem to have caused any issues.

ittai zeidman

unread,
Nov 23, 2018, 3:10:20 PM11/23/18
to bazel-dev
+1
I was in a few situations where people asked me what’s the difference between the two and why is the difference important.
I didn’t have good answers.

Tony Aiuto

unread,
Nov 23, 2018, 10:39:22 PM11/23/18
to ittai zeidman, baze...@googlegroups.com
Yes to switching the default for Bazel.
 But the name  "--noexperimental_separate_genfiles_directory" is strange. It should be --experimental_no_separate_genfiles_directory, so that all the experimental flags sort together and just for grammatical sense.


--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
To post to this group, send email to baze...@googlegroups.com.

Lukács T. Berki

unread,
Nov 26, 2018, 6:56:54 AM11/26/18
to Laurent Le Brun, baze...@googlegroups.com
Ship it.

I think it's a long, long journey to remove this in our internal code base, but if we can flip it in Bazel, it's a big win. Let's go through the usual --incompatible_* process.
--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

Laurent Le Brun

unread,
Nov 26, 2018, 12:03:02 PM11/26/18
to Lukács T. Berki, baze...@googlegroups.com
Thanks!

I've renamed the flag to --incompatible_merge_genfiles_directory (https://github.com/bazelbuild/bazel/commit/e52ea66e057f39e89f70783e08d9520fe1fd4364)

--
Laurent

Laurent Le Brun

unread,
Mar 28, 2019, 6:39:00 PM3/28/19
to Lukács T. Berki, bazel-dev
Update: In Bazel 0.25 (to be released next month), there will be no bazel-genfiles directory by default. If your code or your script breaks, you'll be able to opt out using "--incompatible_merge_genfiles_directory=false".

The API has not been updated. You still have `output_to_bindir` or `output_to_genfiles`. They are not useful anymore, but we keep them for now to avoid breakages.

--
Laurent

Laurent Le Brun

unread,
Jul 25, 2019, 9:53:04 AM7/25/19
to bazel-dev, bazel-discuss
Hi,

Since Bazel 0.25, both `bazel-genfiles` and `bazel-bin` point to the same location.
Bazel 0.29 will add a new flag "incompatible_skip_genfiles_symlink". In Bazel 1.0, the flag will be enabled by default, and the `bazel-genfiles` symlink won't exist anymore.

So if you have references to `bazel-genfiles` in your code base, please replace them with `bazel-bin`.


Note: in case you use the flag --symlink_prefix, the symlinks might have a different name.

reg...@google.com

unread,
Nov 19, 2019, 4:19:09 AM11/19/19
to bazel-dev
On Thursday, July 25, 2019 at 3:53:04 PM UTC+2, Laurent Le Brun wrote:
Hi,

Since Bazel 0.25, both `bazel-genfiles` and `bazel-bin` point to the same location.

Hello Laurent, hello all,

How does the Bazel plugin for IntelliJ handle this? It seems that since this change, I can't access generated sources anymore [neither source genererated with genrule, nor with autovalue, nor with my custom rule].

Cheers,

-- 
Régis

Jingwen Chen

unread,
Nov 19, 2019, 10:51:52 AM11/19/19
to reg...@google.com, Brendan Douglas, bazel-dev

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

Brendan Douglas

unread,
Nov 19, 2019, 11:08:02 AM11/19/19
to Jingwen Chen, reg...@google.com, bazel-dev
No need to speculate -- just file a bug on https://github.com/bazelbuild/intellij with expected vs actual results, and detailed steps to reproduce, and we'll look into it.
Reply all
Reply to author
Forward
0 new messages