-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
Automatic project update #1079
Comments
I tried it once before, but encountered many problems, I will continue to consider this feature, but I cannot guarantee that the current version will implement it. |
We need only add a target named target("autoupdate")
set_kind("binary")
on_build(function (target)
if os.getenv("XMAKE_IN_VSTUDIO") then
os.execv("xmake", {"project", "-k", "vsxmake"}, {detach = true, envs = {XMAKE_CONFIGDIR = os.tmpfile() .. ".xmake"}})
end
end) |
Will try. Shouldn't it be a phony target? |
Of course you can, but after setting to phony, the autoupdate target is invisible in vs. We cannot select it in vs to manually perform the update. |
So I had the chance to test it. It works but it will always regenerate visual studio files, causing the IDE to ask to reload the solution everytime I hit build everything. Would it be possible to not regenerate a project file if they're up to date? |
Woops, I hit the wrong button. |
target("autoupdate")
set_kind("binary")
on_build(function (target)
import("core.project.depend")
if os.getenv("XMAKE_IN_VSTUDIO") then
depend.on_changed(function ()
os.execv("xmake", {"project", "-k", "vsxmake"}, {detach = true, envs = {XMAKE_CONFIGDIR = os.tmpfile() .. ".xmake"}})
end, {files = path.join(os.projectdir(), "vsxmake2019", "xxx.sln")}) -- this file is changed?
end
end)
|
I get strange behavior with that, and it's still regenerating everytime.
|
set kind as phony or override on_install()
|
It seems to fix the install but sadly it doesn't prevent the regeneration when I build the solution. |
depend.on_changed does not work? |
I don't think so, everytime I build autoupdate (directly or via solution generation) the project is regenerated. |
Ok, I will try it. |
I have added a add_rules("mode.debug", "mode.release")
add_rules("plugin.vsxmake.autoupdate")
target("test")
set_kind("binary")
add_files("src/*.c") |
It should work already. |
It's working, but is there a way to have xmake automatically detects new .cpp files and regenerate the VS project if yes? |
? If the cpp file list in xmake.lua is changed, then it will also cause xmake.lua to be changed, and the vs project will be automatically generated during the next build. |
I'm not talking of a xmake.lua change but a filesystem one. Like having a add_files("src/*.cpp") and creating a cpp file. |
I will try to improve it if I have time. |
I have improved it, you can try it again. (dev) |
Well now it's triggering everytime 😅 |
I works for me, you can create a simple project to test it. |
I have fixed it. |
Is your feature request related to a problem? Please describe.
When working on a project, using a makefile, visual studio and more, it happens we edit the xmake file, or add some files and we have to open a shell to rerun xmake project generation, which is a bit frustrating.
Describe the solution you'd like
It would be nice to have an option allowing xmake to regenerate the project (with the same parameters passed the first time) on start, or having a phony target doing so.
CMake is already doing something like that (even though it's much more slower than xmake)
However if something like that happens, it would be very nice for xmake to detect if a project regeneration is required and not do it if nothing changed (as regenerating a project everytime makes VS ask you to reload it and such), as CMake and Premake do for example.
I don't know if xmake already has something to know if something changed between runs.
Describe alternatives you've considered
Adding a phony target that regenerate the project myself, but I'm not sure how to detect the parameters and kind of project.
The text was updated successfully, but these errors were encountered: