-
Notifications
You must be signed in to change notification settings - Fork 974
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
[question] How to use source_buildenv #16578
Comments
Hi @Drllap
I'd say that generated code is somehow different from the user source, and might belong better to The main reason is that Also, the temporary build folders like "build" are typically already .gitignored, so no need to track those and make sure that the generated code doesn't slip as changes when committing changes to source.
It seems there is something missing in the docs. The
|
@memsharded
It appears that the |
The |
Not sure what you want me to test but, I tried this:
Then I run
If I uncomment the
so the |
You are right, there is a small detail that when doing the job in def test_generate_buildenv(self, client):
c = client
pkg = textwrap.dedent("""
from conan import ConanFile
from conan.tools.env import VirtualBuildEnv
import platform
class Pkg(ConanFile):
name = "pkg"
version = "0.1"
tool_requires = "tool/0.1"
def generate(self):
VirtualBuildEnv(self).generate()
cmd = "mytool.bat" if platform.system() == "Windows" else "mytool.sh"
self.run(cmd, env="conanbuildenv")
""")
c.save({"conanfile.py": pkg})
c.run("create . -vv")
assert "MY-TOOL! tool/0.1" in c.out
c.run("install .") # to generate conanbuild script first, so it is available
assert "MY-TOOL! tool/0.1" in c.out The solution is to do the |
What is your question?
Hi! I'm trying to create a conan package that generates a library with open API.
I have added
to my recipe.
If I add
this works.
But then I thought maybe it makes more sense to generate the code in the
source
method, so I tried this:but this doesn't work, even if I add
source_buildenv = True
The first question is, where would generating the code make the most sense? In
build
,source
, orgenerate
?What am I missing in regards with
source_buildenv
, why isn't the environment the same inbuild
andsource
?Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: