-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
Integrated Android module into vstudio module #2366
Conversation
It's missing 3 things: The 2 hacks in solutionPlatform and archFromConfig, as well as pre-vs2015 behavior
We ignore the tag when marked as default, otherwise act on the tag
Some unit tests cannot be fixed trivially but at least Linux x86 and Android (and other future platforms) won't have to deal with it
The only tricky bit is moving m.categorizeFile as there are multiple layers of functions calling each other
…eprecate anything later
website/docs/datalevellinking.md
Outdated
@@ -0,0 +1,20 @@ | |||
Enables linker optimizations to remove unused data by emitting each data item in a separate section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enables linker optimizations to remove unused data by emitting each data item in a separate section. | |
Emit each data item in a separate section. This help linker optimizations to remove unused data. |
It looks like -ffunction-sections
/-fdata-sections
gcc flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if a more general linksections { "data", "function" }
API would be cleaner here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are correct that these map to -ffunction-sections/-fdata-sections. I have been looking to add the flags in the way you describe, and realized the default is to turn these on. The only reason I was adding this is that in the old module there was a remnant of this option and sounded useful, but given it's on by default, does it still make sense to have it? Is there any reason to turn it off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/questions/4274804/query-on-ffunction-section-fdata-sections-options-of-gcc
There are some possible drawbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, what kind of api would you want then? Disabled by default even though the Android default is on? How would you create an api that disables them? I think I didn't think this particular part through too much :/
I've thought about it for a bit, I think if you don't set anything, the default should apply. If you set something then you have the choice to override it. Otherwise Premake would be changing what the default is for each platform, which we might not want to do. So I'm more in favor of separate datalevellinking and functionlevellinking apis. What do you think? Or, alternatively, is it possible to do something like:
linksections { "data", "off" }
linksections { "function", "on" }
or something like that? I don't particularly mind. Or we can change the name if you like
linksectiondata ('on')
linksectionfunction('off')
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone ahead and added that last one, let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last one seems better, but that might probably go in another PR.
@redorav Regression:
this causes:
Util scripts can EDIT: With that said I apparently don't seem to be able to workaround that with:
so now I'm confused, but what I can tell is that in EDIT 2: I'm dumb, |
@p0358 What kind of script causes your issue? I'm surprised _ACTION is not defined at the point where vstudio is loaded, I thought it was always set to something when you run Premake. This was ported from the Android module so perhaps it needs a different place |
It's probably not a problem to remove it, versions earlier than VS2015 don't support Android projects properly anyway |
To reproduce you just put I would guess _ACTION is only defined at the stage where actual project files are being generated, before that it needs to run through main scripts to collect things such as user generating their own actions etc. So if something similar is in other files, it would also cause issues there as soon as someone tries to load such script earlier to override some stuff in it (and they cannot do it at the stage where Premake is already running an action, since then it might execute functions that the user wanted to override) EDIT: The only workaround that seems to work is to do (in a subfile that's
I don't fully seem to get why, at least by looking at EDIT 2: nah the above workaround is broken too |
I've tried removing the line and one of the unit tests is failing now. I'm trying to figure out what is broken, the test or the line. It's kind of weird because we are setting the action as vs2015 in this line p.action.set("vs2015") Yet somehow the unit test changes, which makes me think that wasn't really working correctly |
I kinda figured out what was happening I think!
It's set in advance indeed, it's just that there isn't always action when a premake command is ran! As such this is the only workaround that actually works:
|
I don't know how to add a unit test that checks for that as our unit tests generally check for output in a correctly generated file, I'll ask around. It's good to know you got to the bottom of it for now at least. |
If premake.vstudio is already defined, then you're changing the action after the global check for _ACTION from vstudio has already ran it'd seem. So you can see how this preemptive check is problematic and surprising xd I imagine the check from the vstudio ran with |
Yes that makes sense, it's obvious in hindsight but I'm still learning about premake. We don't care about the workaround for pre-vs2015 so I've fixed the unit tests and hopefully it can get approved soon |
If they run multiple tests within a single process where they change _ACTION multiple times (and it seems so), then nothing in globals can depend on a value of _ACTION even moreso, only stuff in functions. But in such case indeed I also have no idea how a case like this could be covered there without spawning a new process or using some kind of separate/virtual/fake global scope... It's also non-trivial because something like this could potentially happen in any file. I think they'd just have to kinda dry-load every file to a clean premake scope and ensure it doesn't error out, including with both _ACTION being nil and non-nill, and then also set up some kind of getter proxies to raise an error if anything tries to access any global that might potentially be changing later, at the moment of loading
No worries, I was also confused at my beginning of tinkering with premake about what happens when etc. (though I don't remember the details, I didn't end up refactoring/upstreaming/reworking/finishing everything I wanted back then sadly :/) |
It's probably the case that existing code is already correct, I'll just have to pay more attention in the future. Thanks for reporting and sorry for the breakage! |
What does this PR do?
Integrates VS Android more tightly into the vstudio module, along the lines of the Linux integration. It moves all the functionality of the existing module into vstudio-related files. It also fixes some issues with the previous integration such as tags and options that don't make sense for the Android project type, as well as fixing others (e.g. Android debug PDBs)
How does this PR change Premake's behavior?
It's meant to have no breaking changes. I have tested in my own project that makes use of it and I can build, deploy and debug on VS2019 with an Ant-based project (Ant-based projects were deprecated for VS022 so that would be further work to integrate Gradle projects if I can get them to work). All unit tests are passing locally too.
Anything else we should know?
The idea is to integrate core functionality as tightly as possible with Premake. I personally think the module approach is quite complicated to follow and edit, especially if they are in core already. My hope is that we can bring in other extensions into premake core
Did you check all the boxes?
closes #XXXX
in comment to auto-close issue when PR is merged)You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!