Skip to content

Commit

Permalink
Change default build to release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Dec 3, 2024
1 parent 1150a89 commit 3178165
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ COPY lib lib
COPY src src
COPY include include

ARG NAT_BUILD_MODE=debug
ARG NAT_BUILD_MODE=release
RUN rake build_${NAT_BUILD_MODE}

COPY spec spec
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ rake
- If you get an error about missing `bundler`, then your operating system probably didn't
install it alongside Ruby. You can run `gem install bundler` to get it.
**NOTE:** Currently, the default build is the "debug" build, since Nataile is in active development.
But you can build in release mode with `rake build_release`.
## Usage
**REPL:**
Expand Down
27 changes: 8 additions & 19 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require_relative './lib/natalie/compiler/flags'

task default: :build

DEFAULT_BUILD_TYPE = 'debug'.freeze
DEFAULT_BUILD_TYPE = 'release'.freeze
DL_EXT = RbConfig::CONFIG['DLEXT']
SO_EXT = RbConfig::CONFIG['SOEXT']
SRC_DIRECTORIES = Dir.new('src').children.select { |p| File.directory?(File.join('src', p)) }
Expand All @@ -13,7 +13,12 @@ task :build do
Rake::Task["build_#{type}"].invoke
end

desc 'Build Natalie with no optimization and all warnings (default)'
desc 'Build Natalie with release optimizations enabled and warnings off (default)'
task build_release: %i[set_build_release libnatalie prism_c_ext] do
puts 'Build mode: release'
end

desc 'Build Natalie with no optimization and all warnings'
task build_debug: %i[set_build_debug libnatalie prism_c_ext ctags] do
puts 'Build mode: debug'
end
Expand All @@ -23,11 +28,6 @@ task build_asan: %i[set_build_asan libnatalie prism_c_ext] do
puts 'Build mode: asan'
end

desc 'Build Natalie with release optimizations enabled and warnings off'
task build_release: %i[set_build_release libnatalie prism_c_ext] do
puts 'Build mode: release'
end

desc 'Remove temporary files created during build'
task :clean do
SRC_DIRECTORIES.each do |subdir|
Expand Down Expand Up @@ -300,17 +300,6 @@ task :docker_build_clang do
'.'
end

task :docker_build_clang_release do
sh "docker build -t natalie_clang_#{ruby_version_string}_release " \
"--build-arg IMAGE='ruby:#{ruby_version_number}' " \
'--build-arg NAT_CXX_FLAGS=-DNAT_GC_GUARD ' \
'--build-arg CC=clang ' \
'--build-arg CXX=clang++ ' \
'--build-arg NAT_CXX_FLAGS=-DNAT_GC_GUARD ' \
'--build-arg NAT_BUILD_MODE=release ' \
'.'
end

task docker_bash: :docker_build_clang do
sh "docker run -it --rm --entrypoint bash natalie_clang_#{ruby_version_string}"
end
Expand Down Expand Up @@ -391,7 +380,7 @@ task docker_test_all_ruby_spec_nightly: :docker_build_clang do
"natalie_clang_#{ruby_version_string} test_all_ruby_spec_nightly"
end

task docker_test_perf: :docker_build_clang_release do
task docker_test_perf: :docker_build_clang do
sh "docker run #{docker_run_flags} " \
"-e STATS_API_SECRET=#{(ENV['STATS_API_SECRET'] || '').inspect} " \
"-e GIT_SHA=#{(ENV['LAST_COMMIT_SHA'] || '').inspect} " \
Expand Down

0 comments on commit 3178165

Please sign in to comment.