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

Generated files not added to sources #389

Closed
PoncinMatthieu opened this issue Aug 7, 2018 · 1 comment
Closed

Generated files not added to sources #389

PoncinMatthieu opened this issue Aug 7, 2018 · 1 comment

Comments

@PoncinMatthieu
Copy link

PoncinMatthieu commented Aug 7, 2018

Hi,
We have a build file with a genrule for handling different configurations. The genrule looks like this:

filegroup(
    name = "selected_config",
    srcs = select({
                ":dev_mode": ["config/dev.py"],
                ":staging_mode": ["config/staging.py"],
                ":prod_mode": ["config/prod.py"],
                "//conditions:default": ["config/dev.py"]
           })
)

genrule(
    name = "make_default_link",
    srcs = [":selected_config"],
    outs = ["config/default.py"],
    cmd = "cp $(location :selected_config) $@"
)

So on build, we generate a file default.py based on the selected configuration. That file will be located in the bazel-genfiles folder but we are able to import it in python just like any other source file from a py_binary rule.

Our issue is that Intellij is unable to resolve the imports on the default file because the location of the generated file bazel-genfiles is not added to the project configuration. We can add it ourselves manually on the Project structure as a source directory but it will be erased every time we resync the project.

It would be great if the genfile location could be added as a source dir or else have the ability to add any arbitrary folder from the .bazelproject file.
This issue might be a duplicate of #205 but it seemed to me to be a relatively different kind of issue.

@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants