HipByte / Flow

Cross-platform libraries for RubyMotion
BSD 2-Clause "Simplified" License
141 stars 29 forks source link

No such file or directory build/.../repl_ports.txt #29

Closed andrewhavens closed 8 years ago

andrewhavens commented 8 years ago

I'm trying to run the reddit sample app. I downloaded the source and tried running rake super_repl, then I saw this error:

$ rake super_repl
> rake aborted!
No such file or directory - build/ios/iPhoneSimulator-9.3-Development/repl_ports.txt
/Library/RubyMotion/lib/motion/project/xcode_config.rb:655:in `initialize'
/Library/RubyMotion/lib/motion/project/xcode_config.rb:655:in `open'
/Library/RubyMotion/lib/motion/project/xcode_config.rb:655:in `local_repl_port'
/Library/RubyMotion/lib/motion/project/template/ios.rb:230:in `block in <top (required)>'
Tasks: TOP => simulator
(See full trace by running task with --trace)
     Start com.yourcompany.reddit/.MainActivity
rake aborted!
No such file or directory - build/android/Development-23/repl_ports.txt
/Library/RubyMotion/lib/motion/project/template/android/config.rb:523:in `initialize'
/Library/RubyMotion/lib/motion/project/template/android/config.rb:523:in `open'
/Library/RubyMotion/lib/motion/project/template/android/config.rb:523:in `local_repl_port'
/Library/RubyMotion/lib/motion/project/template/android.rb:719:in `run_apk'
/Library/RubyMotion/lib/motion/project/template/android.rb:781:in `block (2 levels) in <top (required)>'
Tasks: TOP => emulator:start
(See full trace by running task with --trace)
--------- beginning of main
--------- beginning of system

I'm using the latest code from master, and RubyMotion 4.12.

andrewhavens commented 8 years ago

Ah, I think I found the source of the issue. The "super repl" seems to skip the build step: https://github.com/HipByte/Flow/blob/master/lib/motion-flow.rb#L234-L235

This seems unintuitive since we have always been used to the build step running automatically for us when we run our apps in the simulator. Not sure why this would intentionally skip the build step.

jjaffeux commented 8 years ago

@andrewhavens must be a regression due to 4.12

@MarkVillacampa what do you think ?

lrz commented 8 years ago

Actually it's by design, as I have been using the super REPL frequently for demos I wanted it to run as fast as possible (and therefore skip the build steps). Maybe we could simply honor a "skip_build" environment variable (and by default build both targets).

jjaffeux commented 8 years ago

@andrewhavens could you try this on android please ?

desc "Start a combined iOS/Android REPL"
task "super_repl" do
  require "readline"
  cmd = %w{ /usr/bin/rake }
  ios_cmd = cmd + ['ios:simulator']
  android_cmd = cmd + ['android:emulator:start']
  if ENV.fetch("skip_build", nil)
    ios_cmd << 'skip_build=1'
    android_cmd << 'skip_build=1'
  end
  ios_io = IO.popen(ios_cmd.join(' '), 'w')
  android_io = IO.popen(android_cmd.join(' '), 'w')
  while expr = Readline.readline("> ", true)
    ios_io.puts expr
    android_io.puts expr
    sleep 0.2
  end
end

Tried on iOS and it's working fine, but don't have a machine with android setup, and my internet is terrible...

andrewhavens commented 8 years ago

@jjaffeux Yes, that code solves the "missing repl_ports.txt" error. Works for Android too.

However, now that I am using the "super repl", a different problem arises. The iOS and Android log statements are all mixed together. When one simulator/emulator crashes, there's no way to relaunch it without stopping the other one. I've learned that when Dropbox is syncing (which it's always doing), I have trouble launching the iOS simulator.

...but I'll leave those topics for a different discussion.

jjaffeux commented 8 years ago

Ok fixed by : https://github.com/HipByte/Flow/commit/d51438d14696f249a6fbcec22c6459f9d7f8751a

Thanks for testing. Will think about the other issues.