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 1d2976e commit 0ff4f00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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
29 changes: 9 additions & 20 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 @@ -297,17 +297,6 @@ task :docker_build_clang do
'--build-arg CC=clang ' \
'--build-arg CXX=clang++ ' \
'--build-arg NAT_CXX_FLAGS=-DNAT_GC_GUARD ' \
'.'
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 ' \
"--build-arg NEED_VALGRIND=#{ENV.fetch('NEED_VALGRIND', 'false')} " \
'.'
end
Expand Down Expand Up @@ -394,14 +383,14 @@ end

task :docker_test_perf do
ENV['NEED_VALGRIND'] = 'true'
Rake::Task['docker_build_clang_release'].invoke
Rake::Task['docker_build_clang'].invoke
sh "docker run #{docker_run_flags} " \
"-e STATS_API_SECRET=#{(ENV['STATS_API_SECRET'] || '').inspect} " \
"-e GIT_SHA=#{(ENV['LAST_COMMIT_SHA'] || '').inspect} " \
"-e GIT_BRANCH=#{(ENV['BRANCH'] || '').inspect} " \
'--rm ' \
'--entrypoint rake ' \
"natalie_clang_#{ruby_version_string}_release test_perf"
"natalie_clang_#{ruby_version_string} test_perf"
end

task docker_tidy: :docker_build_clang do
Expand Down

0 comments on commit 0ff4f00

Please sign in to comment.