Skip to content

Add constant with compiler flags #15611

@spuun

Description

@spuun

I'd like a constant with compiler flags so I can print build info when my process is starting. Today I do

{% begin %}
  {%
    flags = [] of String
    flags << "-Dpreview_mt" if flag?(:preview_mt)
    flags << "-Dmt" if flag?(:mt)
    flags << "-Dexecution_context" if flag?(:execution_context)
    flags << "-Drelease" if flag?(:release)
    flags << "-Dtracing" if flag?(:tracing)
    flags << "-Dperf_tools" if flag?(:perf_tools)
  %}
  puts "Built with #{Crystal::VERSION} #{Crystal::BUILD_COMMIT} {{flags.join(" ").id}}"
{% end %}

which needs to be updated as I start using new flags. I'd like something like

  puts "Built with #{Crystal::VERSION} #{Crystal::BUILD_COMMIT} #{Crystal::COMPILER_FLAGS.join(" ")}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueThis is an issue suited for newcomers to become aquianted with working on the codebase.help wantedThis issue is generally accepted and needs someone to pick it upkind:featuretopic:compiler:semantic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions