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 project files are now correctly located beside script #733

Merged
merged 1 commit into from
Apr 6, 2017

Conversation

samsinsane
Copy link
Member

Fixes #371

@starkos
Copy link
Member

starkos commented Apr 6, 2017

I'm trying to remember the conversations that we had around this. I think the behavior we were trying to implement is that if location were set on the workspace, this value would be inherited by the projects, like any other configuration value. I'm not 100% sure if we have a test for that or not?

workspace "MyWorkspace"
  location "build"

project "MyProject"
  -- implicit location is "build", inherited from MyWorkspace

So if a location is set on the workspace, it should be inherited by the project. But if no location is set, then project should use its basedir.

@samsinsane
Copy link
Member Author

This PR appears to do that.

Using Premake as the test.
Without this PR:

Premake5.sln
Premake5.vcxproj
lua-lib.vcxproj

With this PR:

Premake5.sln
Premake5.vcxproj
contrib/lua/lua-lib.vcxproj

With this PR and --to=testing: (which only applies to the workspace)

testing/Premake5.sln
testing/Premake5.vcxproj
testing/lua-lib.vcxproj

I'm happy to add tests in for this kind of thing, but I'm not sure exactly how to test it?

wks = test.createWorkspace()
origin = os.getcwd()
os.setcwd(origin + "/folder")
prj = test.createproject(wks)
os.setcwd(origin)

test.issame(origin, wks.location)
test.issame(origin + "/folder", prj.location)

This seems like too much of a hack?

@starkos
Copy link
Member

starkos commented Apr 6, 2017

I'm happy to add tests in for this kind of thing, but I'm not sure exactly how to test it?

I'm probably wasn't either, which is probably why there aren't tests for it :) What about…?

wks = test.createWorkspace()
wks.basedir = os.getcwd()

prj = test.createproject(wks)
prj.basedir = path.join(os.getcwd(), "folder")

Going to approve this anyway, since you've confirmed we're getting the behavior we want for both cases.

@tvandijck tvandijck merged commit 5afa9c4 into premake:master Apr 6, 2017
@tritao
Copy link
Contributor

tritao commented Apr 6, 2017

Just had to workaround this issue today... thanks for the fix @samsinsane.

@samsinsane samsinsane deleted the ssurtees/locationFix branch April 7, 2017 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants