-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
102 lines (93 loc) · 3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
require 'rspec/core/rake_task'
require 'rubygems/package'
require 'pact/ffi/version'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
## Supportable platforms with FFI
# aarch64-linux
# arm64-darwin
# x64-mingw-ucrt
# x86_64-darwin
# x86_64-linux
## Additional platforms supported by Nokogiri
# arm-linux
# x86-linux
# x86-mingw32
PLATFORMS = [
{
ruby_platform: 'aarch64-linux',
ffi_location: 'linux-arm64',
ffi_name: 'libpact_ffi.so'
},
{
ruby_platform: 'aarch64-linux-musl',
ffi_location: 'linux-arm64-musl',
ffi_name: 'libpact_ffi.so'
},
{
ruby_platform: 'arm64-darwin',
ffi_location: 'macos-arm64',
ffi_name: 'libpact_ffi.dylib'
},
{
ruby_platform: 'x86_64-linux',
ffi_location: 'linux-x64',
ffi_name: 'libpact_ffi.so'
},
{
ruby_platform: 'x86_64-linux-musl',
ffi_location: 'linux-x64-musl',
ffi_name: 'libpact_ffi.so'
},
{
ruby_platform: 'x86_64-darwin',
ffi_location: 'macos-x64',
ffi_name: 'libpact_ffi.dylib'
},
{
ruby_platform: 'x64-mingw-ucrt',
ffi_location: 'windows-x64',
ffi_name: 'pact_ffi.dll'
},
{
ruby_platform: 'x64-mingw32',
ffi_location: 'windows-x64',
ffi_name: 'pact_ffi.dll'
}
]
task :build do
gemspec = Gem::Specification.load('pact-ffi.gemspec')
sh 'mkdir -p pkg'
PLATFORMS.each do |platform|
platform_gemspec = gemspec.clone
puts platform_gemspec
platform_gemspec.files.push(['ffi', platform[:ffi_location], platform[:ffi_name]].join('/'))
puts platform_gemspec.name
puts platform_gemspec.files
platform_gemspec.platform = platform[:ruby_platform]
Gem::Package.build(platform_gemspec)
sh "mv #{platform_gemspec.name}-#{platform_gemspec.version}-#{platform[:ruby_platform]}.gem pkg/"
end
end
task :clean do
sh 'rm -rf pkg'
end
task :yank do
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform arm64-darwin"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform x64-mingw-ucrt"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform x86_64-darwin"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform aarch64-linux"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform x86_64-linux"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform aarch64-linux-musl"
sh "gem yank pact-ffi -v #{Pact::Version::VERSION} --platform x86_64-linux-musl"
end
task :push do
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-arm64-darwin.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-x64-mingw-ucrt.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-x86_64-darwin.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-aarch64-linux.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-x86_64-linux.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-aarch64-linux-musl.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-x86_64-linux-musl.gem"
sh "cd pkg && gem push pact-ffi-#{Pact::Version::VERSION}-x64-mingw32.gem"
end