rpremote 0.5.0 → 0.7.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.ja.md +30 -46
  4. data/README.md +30 -47
  5. data/RELEASING.md +2 -2
  6. data/THIRD_PARTY_NOTICES.md +1 -1
  7. data/lib/rpremote/bootsel_command.rb +8 -6
  8. data/lib/rpremote/build_command.rb +3 -3
  9. data/lib/rpremote/builder.rb +15 -9
  10. data/lib/rpremote/cli/filesystem_commands.rb +105 -0
  11. data/lib/rpremote/cli.rb +20 -105
  12. data/lib/rpremote/config.rb +6 -5
  13. data/lib/rpremote/config_show.rb +13 -5
  14. data/lib/rpremote/deploy_command.rb +85 -55
  15. data/lib/rpremote/help/dfu_commands.rb +59 -0
  16. data/lib/rpremote/help/filesystem_commands.rb +36 -0
  17. data/lib/rpremote/help/project_commands.rb +89 -0
  18. data/lib/rpremote/help/remote_commands.rb +54 -0
  19. data/lib/rpremote/help/root_text.rb +63 -0
  20. data/lib/rpremote/help.rb +27 -300
  21. data/lib/rpremote/language_source.rb +19 -2
  22. data/lib/rpremote/mrbgems/definition.rb +116 -0
  23. data/lib/rpremote/mrbgems/file_writer.rb +26 -0
  24. data/lib/rpremote/mrbgems/lockfile.rb +131 -0
  25. data/lib/rpremote/mrbgems.rb +95 -155
  26. data/lib/rpremote/mrbgems_command.rb +19 -4
  27. data/lib/rpremote/picoruby_compiler.rb +28 -0
  28. data/lib/rpremote/picoruby_source_patch.rb +0 -4
  29. data/lib/rpremote/target.rb +1 -1
  30. data/lib/rpremote/terminal.rb +0 -2
  31. data/lib/rpremote/version.rb +1 -1
  32. data/lib/rpremote.rb +1 -0
  33. data/patches/picoruby-4.0.4-pwm-sleep-clock.patch +27 -0
  34. data/sig/rpremote.rbs +20 -4
  35. data/tasks/firmware_build.rb +10 -2
  36. metadata +12 -3
  37. data/patches/picoruby-3.4.5-bootsel.patch +0 -71
  38. data/patches/picoruby-4.0.3-bootsel.patch +0 -71
data/sig/rpremote.rbs CHANGED
@@ -188,6 +188,15 @@ module Rpremote
188
188
  def apply: (String source) -> void
189
189
  end
190
190
 
191
+ class PicoRubyCompiler
192
+ CANDIDATES: Array[String]
193
+
194
+ class Error < StandardError
195
+ end
196
+
197
+ def self.ensure_legacy_path!: (String root) -> String
198
+ end
199
+
191
200
  class Builder
192
201
  class Error < Rpremote::Error
193
202
  end
@@ -199,7 +208,7 @@ module Rpremote
199
208
  ?board: String,
200
209
  ?cache_dir: String,
201
210
  ?firmware: String?,
202
- ?mrbgems: String | false | nil,
211
+ ?mrbgems_lock: String | false | nil,
203
212
  ?output: IO,
204
213
  ?error: IO
205
214
  ) -> void
@@ -228,6 +237,7 @@ module Rpremote
228
237
  attr_reader path: String?
229
238
  attr_reader require_name: String?
230
239
  attr_reader auto_require: bool
240
+ attr_reader groups: Array[Symbol]
231
241
  end
232
242
 
233
243
  class Overlay < Data
@@ -238,6 +248,9 @@ module Rpremote
238
248
  attr_reader path: String
239
249
  attr_reader lock_path: String
240
250
 
251
+ def self.parse_groups: (String value) -> Array[Symbol]
252
+ def self.normalize_groups: (untyped values) -> Array[Symbol]
253
+
241
254
  def initialize: (
242
255
  ?path: String,
243
256
  ?lock_path: String?,
@@ -246,15 +259,18 @@ module Rpremote
246
259
  ) -> void
247
260
  def exist?: () -> bool
248
261
  def dependencies: () -> Array[Dependency]
262
+ def selected_dependencies: (?with: Array[String | Symbol], ?without: Array[String | Symbol]) -> Array[Dependency]
249
263
  def vm: () -> Symbol?
250
264
  def check: () -> Array[Dependency]
251
- def lock: (?update: bool) -> Hash[String, untyped]
265
+ def lock: (?update: bool, ?with: Array[String | Symbol], ?without: Array[String | Symbol]) -> Hash[String, untyped]
252
266
  def read_lock: (?required: bool) -> Hash[String, untyped]?
267
+ def require_names: () -> Array[String]
268
+ def prepend_requires: (String source) -> String
269
+ def locked_vm: () -> Symbol?
253
270
  def generate_overlay: (
254
271
  base_config: String,
255
272
  target: String,
256
- directory: String,
257
- ?update: bool
273
+ directory: String
258
274
  ) -> Overlay
259
275
  end
260
276
 
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "fileutils"
5
+ require_relative "../lib/rpremote/picoruby_compiler"
5
6
 
6
7
  REPOSITORY_ROOT = File.expand_path(ENV.fetch("RPREMOTE_ROOT", File.expand_path("../..", __dir__)))
7
8
  DEFAULT_BOARD = "pico2"
@@ -14,7 +15,7 @@ def command!(*command, chdir:, env: {})
14
15
  end
15
16
 
16
17
  language = ENV.fetch("RPREMOTE_LANGUAGE", "picoruby")
17
- target_version = ENV.fetch("RPREMOTE_LANGUAGE_VERSION", "4.0.3")
18
+ target_version = ENV.fetch("RPREMOTE_LANGUAGE_VERSION", "latest")
18
19
  board = ENV.fetch("RPREMOTE_BOARD", DEFAULT_BOARD)
19
20
  abort "Unsupported language: #{language}" unless language == "picoruby"
20
21
  abort "Unsupported board: #{board}" unless SUPPORTED_BOARDS.include?(board)
@@ -43,7 +44,8 @@ command!("rake", "r2p2:setup", chdir: picoruby_root) unless File.directory?(pico
43
44
  version_header = File.join(picoruby_root, "include/version.h")
44
45
  version = File.read(version_header)[/#define PICORUBY_VERSION "(.+?)"/, 1]
45
46
  abort "Could not determine PicoRuby version from #{version_header}" unless version
46
- abort "PicoRuby source is #{version}, but #{target_version} was requested." unless version == target_version
47
+ abort "PicoRuby source is #{version}, but #{target_version} was requested." \
48
+ unless target_version == "latest" || version == target_version
47
49
 
48
50
  cache_file = File.join(output_dir, "CMakeCache.txt")
49
51
  if File.file?(cache_file) && !File.read(cache_file).include?("CMAKE_HOME_DIRECTORY:INTERNAL=#{cmake_source_dir}")
@@ -64,6 +66,12 @@ if fingerprint && File.directory?(mruby_build_dir)
64
66
  FileUtils.rm_rf(mruby_build_dir)
65
67
  end
66
68
  command!("rake", chdir: picoruby_root, env: build_env)
69
+ begin
70
+ compiler = Rpremote::PicoRubyCompiler.ensure_legacy_path!(picoruby_root)
71
+ puts "Using PicoRuby compiler: #{compiler}"
72
+ rescue Rpremote::PicoRubyCompiler::Error => e
73
+ abort e.message
74
+ end
67
75
 
68
76
  cmake_definitions = [
69
77
  "-D", "PICORUBY_ROOT=#{picoruby_root}",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpremote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ogom
@@ -31,6 +31,7 @@ files:
31
31
  - lib/rpremote/builder.rb
32
32
  - lib/rpremote/checksum.rb
33
33
  - lib/rpremote/cli.rb
34
+ - lib/rpremote/cli/filesystem_commands.rb
34
35
  - lib/rpremote/config.rb
35
36
  - lib/rpremote/config_show.rb
36
37
  - lib/rpremote/deploy_command.rb
@@ -40,12 +41,21 @@ files:
40
41
  - lib/rpremote/flash_command.rb
41
42
  - lib/rpremote/flasher.rb
42
43
  - lib/rpremote/help.rb
44
+ - lib/rpremote/help/dfu_commands.rb
45
+ - lib/rpremote/help/filesystem_commands.rb
46
+ - lib/rpremote/help/project_commands.rb
47
+ - lib/rpremote/help/remote_commands.rb
48
+ - lib/rpremote/help/root_text.rb
43
49
  - lib/rpremote/language.rb
44
50
  - lib/rpremote/language_source.rb
45
51
  - lib/rpremote/mrbgems.rb
52
+ - lib/rpremote/mrbgems/definition.rb
53
+ - lib/rpremote/mrbgems/file_writer.rb
54
+ - lib/rpremote/mrbgems/lockfile.rb
46
55
  - lib/rpremote/mrbgems_command.rb
47
56
  - lib/rpremote/nuke_firmware.rb
48
57
  - lib/rpremote/picomodem.rb
58
+ - lib/rpremote/picoruby_compiler.rb
49
59
  - lib/rpremote/picoruby_source_patch.rb
50
60
  - lib/rpremote/recursive_copy.rb
51
61
  - lib/rpremote/remote_path.rb
@@ -57,11 +67,10 @@ files:
57
67
  - lib/rpremote/target.rb
58
68
  - lib/rpremote/terminal.rb
59
69
  - lib/rpremote/version.rb
60
- - patches/picoruby-3.4.5-bootsel.patch
61
70
  - patches/picoruby-3.4.5-ruby-exception-status.patch
62
- - patches/picoruby-4.0.3-bootsel.patch
63
71
  - patches/picoruby-4.0.3-pwm-sleep-clock.patch
64
72
  - patches/picoruby-4.0.3-ruby-exception-status.patch
73
+ - patches/picoruby-4.0.4-pwm-sleep-clock.patch
65
74
  - sig/rpremote.rbs
66
75
  - tasks/firmware_build.rb
67
76
  - tasks/release.rake
@@ -1,71 +0,0 @@
1
- diff --git a/mrbgems/picoruby-machine/include/machine.h b/mrbgems/picoruby-machine/include/machine.h
2
- --- a/mrbgems/picoruby-machine/include/machine.h
3
- +++ b/mrbgems/picoruby-machine/include/machine.h
4
- @@ -48,1 +48,2 @@
5
- void Machine_reboot(void);
6
- +void Machine_bootsel(void);
7
- diff --git a/mrbgems/picoruby-machine/mrblib/machine.rb b/mrbgems/picoruby-machine/mrblib/machine.rb
8
- --- a/mrbgems/picoruby-machine/mrblib/machine.rb
9
- +++ b/mrbgems/picoruby-machine/mrblib/machine.rb
10
- @@ -22,0 +23,4 @@
11
- + def self.bootsel
12
- + self._bootsel
13
- + end
14
- +
15
- diff --git a/mrbgems/picoruby-machine/ports/rp2040/machine.c b/mrbgems/picoruby-machine/ports/rp2040/machine.c
16
- --- a/mrbgems/picoruby-machine/ports/rp2040/machine.c
17
- +++ b/mrbgems/picoruby-machine/ports/rp2040/machine.c
18
- @@ -12,0 +13,1 @@
19
- +#include "pico/bootrom.h"
20
- @@ -32,0 +34,6 @@
21
- +void
22
- +Machine_bootsel(void)
23
- +{
24
- + rom_reset_usb_boot(0, 0);
25
- +}
26
- +
27
- diff --git a/mrbgems/picoruby-machine/src/mruby/machine.c b/mrbgems/picoruby-machine/src/mruby/machine.c
28
- --- a/mrbgems/picoruby-machine/src/mruby/machine.c
29
- +++ b/mrbgems/picoruby-machine/src/mruby/machine.c
30
- @@ -417,0 +418,11 @@
31
- +static mrb_value
32
- +mrb_s__bootsel(mrb_state *mrb, mrb_value self)
33
- +{
34
- +#if !defined(PICORB_PLATFORM_POSIX)
35
- + Machine_bootsel();
36
- +#else
37
- + mrb_raise(mrb, E_NOTIMP_ERROR, "Machine._bootsel is not available on this platform");
38
- +#endif
39
- + return mrb_nil_value();
40
- +}
41
- +
42
- @@ -443,0 +455,1 @@
43
- + mrb_define_class_method_id(mrb, module_Machine, MRB_SYM(_bootsel), mrb_s__bootsel, MRB_ARGS_NONE());
44
- diff --git a/mrbgems/picoruby-machine/src/mrubyc/machine.c b/mrbgems/picoruby-machine/src/mrubyc/machine.c
45
- --- a/mrbgems/picoruby-machine/src/mrubyc/machine.c
46
- +++ b/mrbgems/picoruby-machine/src/mrubyc/machine.c
47
- @@ -252,0 +253,11 @@
48
- +static void
49
- +c_Machine__bootsel(mrbc_vm *vm, mrbc_value *v, int argc)
50
- +{
51
- +#if !defined(PICORB_PLATFORM_POSIX)
52
- + Machine_bootsel();
53
- +#else
54
- + mrbc_raise(vm, MRBC_CLASS(RuntimeError), "Machine.bootsel is not available on this platform.");
55
- +#endif
56
- + SET_NIL_RETURN();
57
- +}
58
- +
59
- @@ -439,0 +451,1 @@
60
- + mrbc_define_method(vm, module_Machine, "_bootsel", c_Machine__bootsel);
61
- diff --git a/mrbgems/picoruby-shell/shell_executables/_path.txt b/mrbgems/picoruby-shell/shell_executables/_path.txt
62
- --- a/mrbgems/picoruby-shell/shell_executables/_path.txt
63
- +++ b/mrbgems/picoruby-shell/shell_executables/_path.txt
64
- @@ -16,0 +17,1 @@
65
- +/bin/bootsel
66
- diff --git a/mrbgems/picoruby-shell/shell_executables/bootsel.rb b/mrbgems/picoruby-shell/shell_executables/bootsel.rb
67
- new file mode 100644
68
- --- /dev/null
69
- +++ b/mrbgems/picoruby-shell/shell_executables/bootsel.rb
70
- @@ -0,0 +1 @@
71
- +Machine.bootsel
@@ -1,71 +0,0 @@
1
- diff --git a/mrbgems/picoruby-machine/include/machine.h b/mrbgems/picoruby-machine/include/machine.h
2
- --- a/mrbgems/picoruby-machine/include/machine.h
3
- +++ b/mrbgems/picoruby-machine/include/machine.h
4
- @@ -68,1 +68,2 @@
5
- void Machine_reboot(void);
6
- +void Machine_bootsel(void);
7
- diff --git a/mrbgems/picoruby-machine/mrblib/machine.rb b/mrbgems/picoruby-machine/mrblib/machine.rb
8
- --- a/mrbgems/picoruby-machine/mrblib/machine.rb
9
- +++ b/mrbgems/picoruby-machine/mrblib/machine.rb
10
- @@ -22,0 +23,4 @@
11
- + def self.bootsel
12
- + self._bootsel
13
- + end
14
- +
15
- diff --git a/mrbgems/picoruby-machine/ports/rp2040/machine.c b/mrbgems/picoruby-machine/ports/rp2040/machine.c
16
- --- a/mrbgems/picoruby-machine/ports/rp2040/machine.c
17
- +++ b/mrbgems/picoruby-machine/ports/rp2040/machine.c
18
- @@ -10,0 +11,1 @@
19
- +#include "pico/bootrom.h"
20
- @@ -42,0 +44,6 @@
21
- +void
22
- +Machine_bootsel(void)
23
- +{
24
- + rom_reset_usb_boot(0, 0);
25
- +}
26
- +
27
- diff --git a/mrbgems/picoruby-machine/src/mruby/machine.c b/mrbgems/picoruby-machine/src/mruby/machine.c
28
- --- a/mrbgems/picoruby-machine/src/mruby/machine.c
29
- +++ b/mrbgems/picoruby-machine/src/mruby/machine.c
30
- @@ -496,0 +497,11 @@
31
- +static mrb_value
32
- +mrb_s__bootsel(mrb_state *mrb, mrb_value self)
33
- +{
34
- +#if !defined(PICORB_PLATFORM_POSIX)
35
- + Machine_bootsel();
36
- +#else
37
- + mrb_raise(mrb, E_NOTIMP_ERROR, "Machine._bootsel is not available on this platform");
38
- +#endif
39
- + return mrb_nil_value();
40
- +}
41
- +
42
- @@ -529,0 +541,1 @@
43
- + mrb_define_class_method_id(mrb, module_Machine, MRB_SYM(_bootsel), mrb_s__bootsel, MRB_ARGS_NONE());
44
- diff --git a/mrbgems/picoruby-machine/src/mrubyc/machine.c b/mrbgems/picoruby-machine/src/mrubyc/machine.c
45
- --- a/mrbgems/picoruby-machine/src/mrubyc/machine.c
46
- +++ b/mrbgems/picoruby-machine/src/mrubyc/machine.c
47
- @@ -316,0 +317,11 @@
48
- +static void
49
- +c_Machine__bootsel(mrbc_vm *vm, mrbc_value *v, int argc)
50
- +{
51
- +#if !defined(PICORB_PLATFORM_POSIX)
52
- + Machine_bootsel();
53
- +#else
54
- + mrbc_raise(vm, MRBC_CLASS(RuntimeError), "Machine.bootsel is not available on this platform.");
55
- +#endif
56
- + SET_NIL_RETURN();
57
- +}
58
- +
59
- @@ -546,0 +558,1 @@
60
- + mrbc_define_method(vm, module_Machine, "_bootsel", c_Machine__bootsel);
61
- diff --git a/mrbgems/picoruby-shell/shell_executables/_path.txt b/mrbgems/picoruby-shell/shell_executables/_path.txt
62
- --- a/mrbgems/picoruby-shell/shell_executables/_path.txt
63
- +++ b/mrbgems/picoruby-shell/shell_executables/_path.txt
64
- @@ -17,0 +18,1 @@
65
- +/bin/bootsel
66
- diff --git a/mrbgems/picoruby-shell/shell_executables/bootsel.rb b/mrbgems/picoruby-shell/shell_executables/bootsel.rb
67
- new file mode 100644
68
- --- /dev/null
69
- +++ b/mrbgems/picoruby-shell/shell_executables/bootsel.rb
70
- @@ -0,0 +1 @@
71
- +Machine.bootsel