premake / premake/premake-core

C# projects, add mechanism of being able to run custom action for invidividual file

Open
#614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In C++ projects I'm including .lua configuration script as customly built file, for example like this:

vpaths { ["*"] = { lua2compile } }
files { lua2compile }

filter ("files:**" .. lua2compile )
buildrule {
     description = 'Generating project from $(SolutionName).lua file',
     commands = 
         "    premake5.exe --file=\"%Lua%\" " .. buildvsver .. "\r\n" ..
         ")\r\n" ..
         "echo 1>$(IntDir)" .. stateFile
     ,
     outputs = { "$(IntDir)" .. stateFile }
}        
filter {}

But I miss for C# to do the same.

There exists "buildaction", but currently you cannot specify custom command for it.

files { includedFrom }
filter ( "files:**" .. includedFrom )
buildaction "Compile"
filter { }

Using it as "Compile" - tries to compile .lua script, but not to use premake5.exe.

This is an important feature for integrating premake5 to be used for C# based projects.

Someone might claim that you have pre/post build steps for C# projects, that's true - but it's not sufficient. Typically you're modifying .lua script and building / compiling only it & reload project.

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 at the C# project generation path and trace the existing buildaction handling, then compare it with the buildrule example shown for C++ projects. Define the expected behavior for a custom command attached to an individual file, including how it avoids compiling the Lua file, and verify the generated C# project reflects that action.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, lua
Domain
build-system
Issue type
Feature
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.