premake / premake/premake-core

vpath logic is dodgy at times

Open
#167 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

What I mean is best illustrated with some examples (What I use is VisualStudio, the version doesn't really matter as long as it's 201x I guess, but if my memory serves me right then I observed it on CodeBlocks back with premake4 as well).
They all pretty much try to create a nice simple SourceTree out of lua's src folder, so here goes:

Base:

files { "../src/liblua.rc", "../src/*.c", "../src/*.h" }
removefiles { "../src/lua.c", "../src/luac.c" }

Test1:

vpaths
{
    ["Headers"] =                   "../src/*.h",
    ["Headers/Libs"] =              "../src/*lib.h",

    ["Sources"] =                   "../src/*.c",
    ["Sources/Libs"] =              "../src/*lib.c"
}

Result: Everything works as intended

Test2:

vpaths
{
    ["Headers"] =                   "../src/*.h",
    ["Headers/Libs"] =              "../src/*lib.h",

    ["Sources"] =                   "../src/*.c",
    ["Sources/Libs"] =              "../src/*lib.c",

    ["Resources"] =                 "../src/*.rc"
}

Result: Everything works fine except for "Sources/Libs" which is missing and it's files are located in "Sources"
The same can be observed if I replace "../src/" with another * to create the ** pattern in both tests

Note: Scrambling the entries around doesn't usually change anything (though I think it did back with premake4)

I've had more issues like that in earlier projects with more complex vpath structures where entire sub-folders went missing just like "Sources/Libs" here but on premake4 (I could probably get those in here as well if those simple ones aren't enough to hunt it down).

I failed to see what could cause it on the source code so maybe someone here is able to spot it...

A Side note: liblua.rc seems to be forced into the SourceTree even though it doesn't exist, I can't think of any reason why it should do that, but on the other hand maybe I'm just spoiled by the wildcard's autodetection~

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Test1 and Test2 vpaths examples from the issue with the VisualStudio generator, then inspect the vpath handling that assigns matching files to virtual folders. Done means Sources/Libs contains the matching files in both cases and the nonexistent liblua.rc is not added unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.