Skip to content

Build outputs are infinitely recursively processed #1940

@artemking4

Description

@artemking4

What seems to be the problem?
When using custom rules, if a buildoutput happens to use the same file extension as the rule itself, premake gets into an infinite recursion loop and later dies with stack smashing(?).

What did you expect to happen?
I had expected premake not to compile already compiled files again. Though, something like that can be by design, i.e. you do .bmp>.png>.jpg, but not .png>.png>... (unless specified so)

What have you tried so far?
A dirty hack: create a file with a different extension and then copy it to the output directory.

How can we reproduce this?

rule "sampleRule"
    fileextension ".txt"

    -- buildmessage and buildcommands dont seem to matter
    buildmessage 'Copying %{file.relpath}'
    buildcommands 'cp %{file.relpath} new_%{file.relpath}'
    buildoutputs '%{file.basename}.txt'

workspace "sample"
    configurations { "Debug", "Release" }

project "sample"
    kind "Utility"
    rules { "sampleRule" }

    files { "**.txt" }

Keep in mind that for order for this to work you need to first have #1939 installed.
My premake script uses a required script and overrides the gmake utility project generator, so the version is still relevant, nothing is touched except that.

  • Visual Studio 2022 (vs2022)
  • Visual Studio 2019 (vs2019)
  • Visual Studio 2017 (vs2017)
  • Visual Studio 2015 (vs2015)
  • Visual Studio 2012 (vs2012)
  • Visual Studio 2010 (vs2010)
  • Visual Studio 2008 (vs2008)
  • Visual Studio 2005 (vs2005)
  • GNU Makefile (gmake)
  • GNU Makefile 2 (gmake2)
  • XCode (xcode)
  • Codelite
  • Other (Please list below)

What version of Premake are you using?
5.0.0-beta1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions