-
Notifications
You must be signed in to change notification settings - Fork 34
Arduino exe now found on windows #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0421314
a35eda9
f6d33e7
d795443
6da6a76
d01a852
74c92d2
91a947b
9bc712b
9eaa85b
ff668e2
740662a
974edde
6df2412
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ unittest: | |
- uno | ||
- due | ||
- leonardo | ||
compilers: | ||
- g++ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
require 'shellwords' # fingers crossed this works on win32 | ||
require 'win32/registry' | ||
require "arduino_ci/arduino_downloader" | ||
require 'open-uri' | ||
|
||
module ArduinoCI | ||
|
||
|
@@ -27,19 +28,28 @@ def prepare | |
# (for logging purposes) | ||
# @return [string] | ||
def downloader | ||
"wget" | ||
"open-uri" | ||
end | ||
|
||
# Download the package_url to package_file | ||
# @return [bool] whether successful | ||
def download | ||
powershell("(New-Object Net.WebClient).DownloadFile('#{package_url}', '#{package_file}')") | ||
puts 'Downloading from ' + package_url | ||
# Turned off ssl verification | ||
open(URI.parse(package_url), ssl_verify_mode: 0) do |url| | ||
File.open(package_file, 'wb') { |file| file.write(url.read) } | ||
end | ||
end | ||
|
||
# Move the extracted package file from extracted_file to the force_install_location | ||
# @return [bool] whether successful | ||
def install | ||
powershell("Move-Item", extracted_file, self.class.force_install_location) | ||
puts 'Installing to ' + self.class.force_install_location | ||
# Move only the content of the directory | ||
powershell("Move-Item", extracted_file + "\*", self.class.force_install_location) | ||
# clean up the no longer required root extracted folder | ||
puts 'Removing ' + package_file | ||
powershell("Remove-Item", extracted_file) | ||
end | ||
|
||
# The local filename of the desired IDE package (zip/tar/etc) | ||
|
@@ -58,7 +68,11 @@ def extracter | |
# Extract the package_file to extracted_file | ||
# @return [bool] whether successful | ||
def extract | ||
powershell("Expand-Archive", package_file, "-dest", extracted_file) | ||
puts 'Extracting ' + package_file + " to " + extracted_file | ||
powershell("Expand-Archive", "-Path", package_file, "-DestinationPath", extracted_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to mute the output from this command? It dominates the build log https://ci.appveyor.com/project/ianfixes/arduino-ci/build/1.0.31#L144 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't see any flags in the powershell command definition although it suggests there might be common parameters. Standard suggestions on google appear to be to pipe to null. I just pushed up a version with this but it looks like you have merged already so I am not sure if that was included or not. Note - This doesn't happen when run locally, you just get a nice nice progress bar: I did wonder if both extract and move could be done using a ruby dependency rather than powershell, but my ruby knowledge is minimal to none. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting those in pure ruby is probably the right way to go. I more or less ported the Of course, having working cross-platform CI is a great enabler for that kind of thing in the first place... so I can't thank you enough for your help here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I cherry-picked your commit with no problems. Thanks |
||
# clean up the no longer required zip | ||
puts 'Removing ' + package_file | ||
powershell("Remove-Item", package_file) | ||
end | ||
|
||
# The local file (dir) name of the extracted IDE package (zip/tar/etc) | ||
|
@@ -78,25 +92,22 @@ def self.existing_installation | |
# The executable Arduino file in an existing installation, or nil | ||
# @return [string] | ||
def self.existing_executable | ||
arduino_reg = 'Software\SOFTWARE\Classes\Arduino file\shell\open\command' | ||
arduino_reg = 'SOFTWARE\WOW6432Node\Arduino' | ||
Win32::Registry::HKEY_LOCAL_MACHINE.open(arduino_reg) do |reg| | ||
reg.each_key do |key| | ||
k = reg.open(key) | ||
puts key | ||
puts k | ||
return k | ||
# puts k["DisplayName"] rescue "?" | ||
# puts k["DisplayVersion"] rescue "?" | ||
# puts | ||
end | ||
path = reg.read_s('Install_Dir') | ||
exe = File.join(path, "arduino_debug.exe") | ||
puts "Using existing exe located at " + exe | ||
return exe if File.exist? exe | ||
end | ||
rescue | ||
nil | ||
end | ||
|
||
# The executable Arduino file in a forced installation, or nil | ||
# @return [string] | ||
def self.force_installed_executable | ||
exe = File.join(self.force_install_location, "arduino.exe") | ||
exe = File.join(self.force_install_location, "arduino_debug.exe") | ||
puts "Using force installed exe located at " + exe | ||
return nil if exe.nil? | ||
exe | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this line is necessary to make things work, please open an issue for that... the
compilers
setting should be automatically inherited from https://github.com/ianfixes/arduino_ci/blob/master/misc/default.yml#L83-L84There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. That is what I thought originally until I spotted TestSomething had it explicitly defined so I assumed it must have been a misunderstanding on my part. Note that this behaviour is the same on Windows and Linux. I'll raise an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue #44 raised