Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message about non-release mode to crystal --version #13254

Merged
merged 5 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ override FLAGS += -D strict_multi_assign -D preview_overload_order $(if $(releas
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler --exclude-warnings spec/primitives
SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )$(if $(order),--order=$(order) )
CRYSTAL_CONFIG_LIBRARY_PATH := '$$ORIGIN/../lib/crystal'
CRYSTAL_CONFIG_BUILD_COMMIT := $(shell git rev-parse --short HEAD 2> /dev/null)
CRYSTAL_CONFIG_BUILD_COMMIT ?= $(shell git rev-parse --short HEAD 2> /dev/null)
CRYSTAL_CONFIG_PATH := '$$ORIGIN/../share/crystal/src'
SOURCE_DATE_EPOCH := $(shell (git show -s --format=%ct HEAD || stat -c "%Y" Makefile || stat -f "%m" Makefile) 2> /dev/null)
SOURCE_DATE_EPOCH ?= $(shell (git show -s --format=%ct HEAD || stat -c "%Y" Makefile || stat -f "%m" Makefile) 2> /dev/null)
ifeq ($(shell command -v ld.lld >/dev/null && uname -s),Linux)
EXPORT_CC ?= CC="$(CC) -fuse-ld=lld"
endif
Expand Down
20 changes: 14 additions & 6 deletions src/compiler/crystal/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ module Crystal
end

def self.description
formatted_sha = "[#{build_commit}] " if build_commit
<<-DOC
Crystal #{version} #{formatted_sha}(#{date})
String.build do |io|
io << "Crystal " << version
io << " [" << build_commit << "]" if build_commit
io << " (" << date << ")" unless date.empty?

LLVM: #{llvm_version}
Default target: #{self.host_target}
DOC
io << "\n\nThe compiler was not built in release mode." unless release_mode?

io << "\n\nLLVM: " << llvm_version
io << "\nDefault target: " << host_target
io << "\n"
end
end

def self.build_commit
Expand All @@ -40,6 +44,10 @@ module Crystal
end
end

def self.release_mode?
{{ flag?(:release) }}
end

@@host_target : Crystal::Codegen::Target?

def self.host_target : Crystal::Codegen::Target
Expand Down