@@ -14,8 +14,8 @@ rescue Bundler::BundlerError => e
1414 exit e . status_code
1515end
1616
17- # load File.expand_path('./ext/thread_id/Rakefile', __dir__)
18- # load File.expand_path('./ext/rbspy/Rakefile', __dir__)
17+ load File . expand_path ( './ext/thread_id/Rakefile' , __dir__ )
18+ load File . expand_path ( './ext/rbspy/Rakefile' , __dir__ )
1919
2020task default : %w[ hello ]
2121
@@ -28,106 +28,3 @@ spec = Bundler.load_gemspec('pyroscope.gemspec')
2828# add your default gem packing task
2929Gem ::PackageTask . new ( spec ) do |pkg |
3030end
31-
32- exttask1 = Rake ::ExtensionTask . new ( 'thread_id' , spec ) do |ext |
33- ext . lib_dir = 'lib'
34- ext . source_pattern = '*.{rs,toml}'
35- ext . cross_compile = true
36- ext . cross_platform = %w[ x86_64-linux x86_64-darwin arm64-darwin aarch64-linux ]
37- end
38-
39- exttask2 = Rake ::ExtensionTask . new ( 'rbspy' , spec ) do |ext |
40- ext . lib_dir = 'lib'
41- ext . source_pattern = '*.{rs,toml}'
42- ext . cross_compile = true
43- ext . cross_platform = %w[ x86_64-linux x86_64-darwin arm64-darwin aarch64-linux ]
44- end
45-
46- namespace :gem do
47- desc "Push all freshly-built gems to RubyGems"
48- task :push do
49- Rake ::Task . tasks . select { |t | t . name =~ %r{^pkg/#{ spec . name } -.*\. gem} && t . already_invoked } . each do |pkgtask |
50- sh "gem" , "push" , pkgtask . name
51- end
52-
53- Rake ::Task . tasks
54- . select { |t | t . name =~ %r{^gem:cross:} && exttask1 . cross_platform . include? ( t . name . split ( ":" ) . last ) }
55- . select ( &:already_invoked )
56- . each do |task |
57- platform = task . name . split ( ":" ) . last
58- sh "gem" , "push" , "pkg/#{ spec . full_name } -#{ platform } .gem"
59- end
60- end
61-
62- namespace :cross do
63- task :prepare do
64- require "rake_compiler_dock"
65- sh "bundle package"
66- end
67-
68- exttask1 . cross_platform . each do |platform |
69- desc "Cross-compile all native gems in parallel"
70- multitask :all => platform
71-
72- desc "Cross-compile a binary gem for #{ platform } "
73- task platform => :prepare do
74- RakeCompilerDock . sh <<-EOT , platform : platform , image : "rbsys/rcd:#{ platform } "
75- set -e
76-
77- if [ -d "/opt/osxcross/target/bin" ]; then
78- # This string replacement is a workaround for https://github.com/oxidize-rb/rb-sys/pull/23
79- TARGET_CC="${CARGO_BUILD_TARGET/darwin/darwin20.2}-cc"
80- TARGET_AR="${CARGO_BUILD_TARGET/darwin/darwin20.2}-ar"
81- else
82- TARGET_CC="#{ platform } -gnu-gcc"
83- TARGET_AR="#{ platform } -gnu-ar"
84- fi
85- export TARGET_CC TARGET_AR
86- export GVB_VERSION_OVERRIDE="#{ spec . version } "
87- [[ "#{ platform } " =~ ^a ]] && apt-get update && apt-get install -y libssl-dev
88- [[ "#{ platform } " =~ ^a ]] && rustup default nightly
89- # This re-installs the nightly version of the relevant target after
90- # we so rudely switch the default toolchain
91- [ "#{ platform } " = "arm64-darwin" ] && rustup target add aarch64-apple-darwin
92- [ "#{ platform } " = "aarch64-linux" ] && rustup target add aarch64-unknown-linux-gnu
93- bundle install
94- rake native:#{ platform } gem RUBY_CC_VERSION=3.1.0
95- EOT
96- end
97- end
98-
99- exttask2 . cross_platform . each do |platform |
100- desc "Cross-compile all native gems in parallel"
101- multitask :all => platform
102-
103- desc "Cross-compile a binary gem for #{ platform } "
104- task platform => :prepare do
105- RakeCompilerDock . sh <<-EOT , platform : platform , image : "rbsys/rcd:#{ platform } "
106- set -e
107-
108- #apt-get update
109- #apt-get install -y libssl-dev
110-
111- if [ -d "/opt/osxcross/target/bin" ]; then
112- # This string replacement is a workaround for https://github.com/oxidize-rb/rb-sys/pull/23
113- TARGET_CC="${CARGO_BUILD_TARGET/darwin/darwin20.2}-cc"
114- TARGET_AR="${CARGO_BUILD_TARGET/darwin/darwin20.2}-ar"
115- else
116- TARGET_CC="#{ platform } -gnu-gcc"
117- TARGET_AR="#{ platform } -gnu-ar"
118- fi
119- export TARGET_CC TARGET_AR
120- export GVB_VERSION_OVERRIDE="#{ spec . version } "
121- [[ "#{ platform } " =~ ^a ]] && apt-get update && apt-get install -y libssl-dev
122- [[ "#{ platform } " =~ ^a ]] && rustup default nightly
123- # This re-installs the nightly version of the relevant target after
124- # we so rudely switch the default toolchain
125- [ "#{ platform } " = "arm64-darwin" ] && rustup target add aarch64-apple-darwin
126- [ "#{ platform } " = "aarch64-linux" ] && rustup target add aarch64-unknown-linux-gnu
127- bundle install
128- rake native:#{ platform } gem RUBY_CC_VERSION=3.1.0
129- EOT
130- end
131- end
132- end
133- end
0 commit comments