Skip to content

Commit 8f0b1ff

Browse files
committed
Slightly improved windows build rake task.
1 parent d31bf98 commit 8f0b1ff

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,16 @@ bundle exec rake build # Build JRuby-specific core gem (alias for `
249249
bundle exec rake build:core # Build concurrent-ruby-<version>-java.gem into the pkg directory
250250
251251
*All except JRuby*
252-
bundle exec rake build # Build core and extension gems
253252
bundle exec rake build:core # Build concurrent-ruby-<version>.gem into the pkg directory
254253
bundle exec rake build:ext # Build concurrent-ruby-ext-<version>.gem into the pkg directory
255254
255+
*When Docker IS installed*
256+
bundle exec rake build:windows # Build the windows binary <version> gems per rake-compiler-dock
257+
bundle exec rake build # Build core, extension, and edge gems, including Windows binaries
258+
259+
*When Docker is NOT installed*
260+
bundle exec rake build # Build core, extension, and edge gems (excluding Windows binaries)
261+
256262
*All*
257263
bundle exec rake clean # Remove any temporary products
258264
bundle exec rake clobber # Remove any generated file
@@ -261,7 +267,7 @@ bundle exec rake compile # Compile all the extensions
261267

262268
## Maintainers
263269

264-
* [Jerry D'Antonio](https://github.com/jdantonio)
270+
* [Jerry D'Antonio](https://github.com/jdantonio) (creator)
265271
* [Michele Della Torre](https://github.com/mighe)
266272
* [Chris Seaton](https://github.com/chrisseaton)
267273
* [Lucas Allan](https://github.com/lucasallan)

Rakefile

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ require 'concurrent/utility/native_extension_loader'
77

88
## load the two gemspec files
99
CORE_GEMSPEC = Gem::Specification.load('concurrent-ruby.gemspec')
10-
EXT_GEMSPEC = Gem::Specification.load('concurrent-ruby-ext.gemspec')
10+
EXT_GEMSPEC = Gem::Specification.load('concurrent-ruby-ext.gemspec')
1111
EDGE_GEMSPEC = Gem::Specification.load('concurrent-ruby-edge.gemspec')
1212

1313
## constants used for compile/build tasks
1414

15-
GEM_NAME = 'concurrent-ruby'
16-
EXT_NAME = 'extension'
17-
EDGE_NAME = 'edge'
15+
GEM_NAME = 'concurrent-ruby'
16+
EXT_NAME = 'extension'
17+
EDGE_NAME = 'edge'
1818
JAVA_EXT_NAME = 'concurrent_ruby_ext'
1919

2020
if Concurrent.on_jruby?
21-
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}-java.gem"
21+
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}-java.gem"
2222
else
23-
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}.gem"
24-
EXT_GEM = "#{GEM_NAME}-ext-#{Concurrent::VERSION}.gem"
23+
CORE_GEM = "#{GEM_NAME}-#{Concurrent::VERSION}.gem"
24+
EXT_GEM = "#{GEM_NAME}-ext-#{Concurrent::VERSION}.gem"
2525
NATIVE_GEM = "#{GEM_NAME}-ext-#{Concurrent::VERSION}-#{Gem::Platform.new(RUBY_PLATFORM)}.gem"
26-
EDGE_GEM = "#{GEM_NAME}-edge-#{Concurrent::EDGE_VERSION}.gem"
26+
EDGE_GEM = "#{GEM_NAME}-edge-#{Concurrent::EDGE_VERSION}.gem"
2727
end
2828

2929
## safely load all the rake tasks in the `tasks` directory
@@ -41,6 +41,11 @@ Dir.glob('tasks/**/*.rake').each do |rakefile|
4141
safe_load rakefile
4242
end
4343

44+
def has_docker?
45+
system("docker version > /dev/null 2>&1")
46+
0 == $?.exitstatus
47+
end
48+
4449
if Concurrent.on_jruby?
4550

4651
## create the compile task for the JRuby-specific gem
@@ -135,21 +140,27 @@ namespace :build do
135140
end
136141
end
137142

138-
desc "Build the windows binary gems per rake-compiler-dock"
139-
task :windows do
140-
require 'rake_compiler_dock'
141-
RakeCompilerDock.sh <<-EOT
143+
if has_docker?
144+
desc "Build the windows binary #{Concurrent::VERSION} gems per rake-compiler-dock"
145+
task :windows do
146+
require 'rake_compiler_dock'
147+
RakeCompilerDock.sh <<-EOT
142148
bundle --without="development testing" &&
143149
rake cross native gem RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2
144-
EOT
150+
rm -rf .bundle
151+
EOT
152+
end
145153
end
146154
end
147155

148156
if Concurrent.on_jruby?
149157
desc 'Build JRuby-specific core gem (alias for `build:core`)'
150158
task :build => ['build:core']
159+
elsif has_docker?
160+
desc 'Build core, extension, and edge gems, including Windows binaries'
161+
task :build => ['build:core', 'build:ext', 'build:edge', 'build:windows']
151162
else
152-
desc 'Build core, extension, and edge gems'
163+
desc 'Build core, extension, and edge gems (excluding Windows binaries)'
153164
task :build => ['build:core', 'build:ext', 'build:edge']
154165
end
155166

0 commit comments

Comments
 (0)