mundler 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e34cffc5ea496c40d16c21f544456bf5fa2db7f921e7c70aa000c5b5fdb5cdc5
4
- data.tar.gz: 125ad566d2322fa8d931a428c5d8cdfc7df98818dd3e793c1a7a23b66e225758
3
+ metadata.gz: 2a1e212a7e64550513e7b9581af1cddf8e4b9162bfa68cb44c0e1723cc1530ed
4
+ data.tar.gz: b426f4f7f1b4b7da2dfc2a252a48cf232cd18f6709306d35c50060867b317f03
5
5
  SHA512:
6
- metadata.gz: 326e51648e28ea76872db38f4d8c03168960fad4ed5ee8c53e37b7d6da3d8605f62152a1aa87d22dd04b6e4070bfa60fad265cb52ec5dc8046c323f5f4488219
7
- data.tar.gz: ba5c5387ddfa27ac31e10f53c128e4b26c319c03dcfde893bea970309025bc44d1cfdb568662e60071a3a255d72312b758d870bb180e9407e8626dfb81a90c99
6
+ metadata.gz: dd5a38523ad21a2ca981eb1cb996c0ccb14e78e1d6fb56e3fa20750b5ad3c57839ab48da45c539517542f471927e250e038dcab222f4299cac70368e6a92b665
7
+ data.tar.gz: 9535ee1e6dea408f0887a97a8320ec0d1a42f1cb18603cf4dd3ed761a91a12d5258fbe6a0ea8c7cf31d1ce47bb1bff1e0e56e4c2aa32d746e68ceee637f2ca01
@@ -16,8 +16,12 @@ module Mundler
16
16
  end.join("\n")
17
17
  end
18
18
 
19
- def gems
19
+ def gems(platform_name)
20
20
  @config.gems.map do |gem|
21
+ if !gem[:platforms].empty? && !gem[:platforms].include?(platform_name.to_sym)
22
+ next
23
+ end
24
+
21
25
  # e.g. gem = {:name=>"mruby-regexp-pcre", :path=>nil, :github=>nil, :core=>nil}
22
26
  args = ":mgem => #{gem[:name].inspect}"
23
27
 
@@ -165,13 +169,21 @@ module Mundler
165
169
 
166
170
  #{host_platform}
167
171
  #{gemboxes}
168
- #{gems}
172
+ #{gems(:host)}
169
173
  end
170
174
 
171
175
  #{non_host_platforms}
172
176
  CONTENTS
173
177
 
174
- (contents.strip + "\n").gsub("\n\n\n", "\n\n")
178
+ contents = contents.strip + "\n"
179
+
180
+ 3.times do
181
+ contents.gsub!("\n \n", "\n\n")
182
+ contents.gsub!("\n\n\n", "\n\n")
183
+ contents.gsub!("\n\nend", "\nend")
184
+ end
185
+
186
+ contents
175
187
  end
176
188
  end
177
189
  end
data/lib/mundler/dsl.rb CHANGED
@@ -53,13 +53,19 @@ module Mundler
53
53
  config.platforms << { name: name.to_s, options: options }
54
54
  end
55
55
 
56
- def gem(name, core: nil, path: nil, github: nil)
56
+ def gem(name, core: nil, path: nil, github: nil, platforms: [])
57
57
  if path && !path.start_with?("/")
58
58
  app_path = Pathname.new(@path).dirname.to_s
59
59
  path = File.expand_path(File.join(app_path, path))
60
60
  end
61
61
 
62
- config.gems << { name: name, path: path, github: github, core: core }
62
+ config.gems << {
63
+ name: name,
64
+ path: path,
65
+ github: github,
66
+ core: core,
67
+ platforms: Array(platforms)
68
+ }
63
69
  end
64
70
 
65
71
  def env(name, value)
data/lib/mundler/mruby.rb CHANGED
@@ -44,7 +44,8 @@ module Mundler
44
44
 
45
45
  if version
46
46
  system("git reset --hard #{version} >/dev/null 2>&1") ||
47
- error_out("Failed to set version to #{version}")
47
+ system("git reset --hard origin/#{version} >/dev/null 2>&1") ||
48
+ exit_out("Failed to set mruby version to \"#{version}\".")
48
49
  end
49
50
 
50
51
  FileUtils.touch(success_indicator)
@@ -73,7 +74,11 @@ module Mundler
73
74
  puts "Using #{gembox} gembox"
74
75
  end
75
76
  @config.gems.each do |gem|
76
- puts "Using #{gem[:name]} gem"
77
+ if gem[:platforms].empty?
78
+ puts "Using #{gem[:name]} gem"
79
+ else
80
+ puts "Using #{gem[:name]} gem for platforms: #{gem[:platforms]}"
81
+ end
77
82
  end
78
83
 
79
84
  puts "Using mruby (#{version})"
@@ -169,6 +174,11 @@ module Mundler
169
174
 
170
175
  private
171
176
 
177
+ def exit_out(msg)
178
+ STDERR.puts("\e[31m#{msg}\e[0m")
179
+ exit(1)
180
+ end
181
+
172
182
  def installed?
173
183
  success_indicator = File.join(@path, ".mundler_built_successfully")
174
184
  File.file?(success_indicator)
@@ -25,7 +25,7 @@ module AndroidPlatform
25
25
 
26
26
  #{cc_and_linker(options[:options])}
27
27
  #{build_config.gemboxes}
28
- #{build_config.gems}
28
+ #{build_config.gems(:android)}
29
29
  end
30
30
  BUILD
31
31
  end.join("\n")
@@ -29,7 +29,7 @@ module IOSPlatform
29
29
  <<~BUILD
30
30
  MRuby::CrossBuild.new("ios__#{arch}") do |conf|
31
31
  #{build_config.gemboxes}
32
- #{build_config.gems}
32
+ #{build_config.gems(:ios)}
33
33
 
34
34
  conf.cc do |cc|
35
35
  cc.command = #{cc_command.inspect}
@@ -28,7 +28,7 @@ module IOSSimulatorPlatform
28
28
  <<~BUILD
29
29
  MRuby::CrossBuild.new("ios_simulator__#{arch}") do |conf|
30
30
  #{build_config.gemboxes}
31
- #{build_config.gems}
31
+ #{build_config.gems(:ios_simulator)}
32
32
 
33
33
  conf.cc do |cc|
34
34
  cc.command = #{cc_command.inspect}
@@ -0,0 +1,33 @@
1
+ module WASMPlatform
2
+ def self.config(options, build_config)
3
+ cc_command = "emcc"
4
+ linker_command = "emcc"
5
+ archiver_command = "emar"
6
+
7
+ cc_flags = ["-Os"]
8
+
9
+ <<~BUILD
10
+ MRuby::CrossBuild.new("wasm") do |conf|
11
+ toolchain :clang
12
+
13
+ #{build_config.gemboxes}
14
+ #{build_config.gems(:wasm)}
15
+
16
+ conf.cc do |cc|
17
+ cc.command = #{cc_command.inspect}
18
+ cc.flags = #{cc_flags.inspect}
19
+ end
20
+
21
+ conf.linker do |l|
22
+ l.command = #{linker_command.inspect}
23
+ end
24
+
25
+ conf.archiver do |a|
26
+ a.command = #{archiver_command.inspect}
27
+ end
28
+ end
29
+ BUILD
30
+ end
31
+ end
32
+
33
+ define_platform "wasm", WASMPlatform
@@ -1,3 +1,3 @@
1
1
  module Mundler
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Inkpen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -75,6 +75,7 @@ files:
75
75
  - lib/mundler/platforms/host.rb
76
76
  - lib/mundler/platforms/ios.rb
77
77
  - lib/mundler/platforms/ios_simulator.rb
78
+ - lib/mundler/platforms/wasm.rb
78
79
  - lib/mundler/project.rb
79
80
  - lib/mundler/version.rb
80
81
  homepage: https://github.com/Dan2552/mundler