premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.24k stars 617 forks source link

C# backend error with filters (fcfg is nil in dotnet.lua) #589

Open tritao opened 8 years ago

tritao commented 8 years ago

So I was changing some code I have to use per-configuration filters like the following:

  filter { "system:windows", "architecture:x86" }
    files { "CSharp/i686-pc-win32-msvc/**.cs" }

  filter { "system:windows", "architecture:x86_64" }
    files { "CSharp/x86_64-pc-win32-msvc/**.cs" }

  filter { "system:macosx", "architecture:x86" }
    files { "CSharp/i686-apple-darwin12.4.0/**.cs" }

  filter { "system:macosx", "architecture:x86_64" }
    files { "CSharp/x86_64-apple-darwin12.4.0/**.cs" }

And now I get:

stack traceback:
    /Users/joao/Dev/premake-core/src/tools/dotnet.lua:35: in function 'fileinfo'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:294: in function 'selector'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:116: in function 'onleaf'
    /Users/joao/Dev/premake-core/src/base/tree.lua:241: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:235: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:235: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:266: in function 'traverse'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:114: in function 'listsources'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:292: in function '?'
    ...Users/joao/Dev/premake-core/src/base/_foundation.lua:108: in function 'callArray'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:57: in function 'callback'
    /Users/joao/Dev/premake-core/src/base/premake.lua:155: in function 'fn'
    /Users/joao/Dev/premake-core/src/base/premake.lua:49: in function 'capture'
    /Users/joao/Dev/premake-core/src/base/premake.lua:153: in function 'generate'
    ...ers/joao/Dev/premake-core/src/actions/make/_make.lua:46: in function 'onProject'
    /Users/joao/Dev/premake-core/src/base/action.lua:108: in function 'call'
    /Users/joao/Dev/premake-core/src/_premake_main.lua:330: in function '?'
    ...Users/joao/Dev/premake-core/src/base/_foundation.lua:108: in function 'callArray'
    /Users/joao/Dev/premake-core/src/_premake_main.lua:371: in function </Users/joao/Dev/premake-core/src/_premake_main.lua:370>
Error: /Users/joao/Dev/premake-core/src/tools/dotnet.lua:38: attempt to index local 'fcfg' (a nil value)

If I remove the last filter block then the error goes away.

tvandijck commented 8 years ago

The C# backend currently does not handle per file configurations... I have a fix for that here at Blizzard, just haven't made a PR for it yet...

maybe you could try the fix first? https://github.com/Blizzard/premake-core/commit/0bb4c6702c7b4d4faa4401b4d10a1352411e945c

I think for the gmake backend however (which is what you seem to be using), there is also fixes in the dotnet.lua that may fix this particular issue... I still think however that the make_csharp.lua would need additional fixes to support per file configurations...