Skip to content
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

Feature mac build #135

Merged
merged 8 commits into from
Nov 13, 2021
Merged

Feature mac build #135

merged 8 commits into from
Nov 13, 2021

Conversation

takujikawata-pr
Copy link
Member

Make this source code available to build both for Mac and Windows platform.

After this change, built succeeded both platform by:

Mac build

  1. install required tools.

    npm install build-tools
    npm install node-gyp
    npm install qunitjs
  2. Install required node modules
    Execute following on the source code directory

    npm install
  3. Install Arduino CLI

    cd compilation/arduino
    curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
    mv bin/arduino-cli ./
    rm -rf bin
    ./arduino-cli core  install arduino:avr
    cd ../../
  4. Update electron build tool (this is needed for building the binary on masOS 12)

    npm install [email protected]
  5. build

    export PATH=$PATH:node_modules/.bin
    electron-builder --mac --x64

Windows build

  1. install required tools.

    npm install -g windows-build-tools
    npm install -g node-gyp
  2. Install required node modules
    Execute following on the source code directory

    npm install
  3. Install Arduino CLI
    get arduino-cli.exe from https://github.com/arduino/arduino-cli/releases and place it under compilation/arduino
    Execute following to install required tools

    cd compilation\arduino
    arduino-cli.exe core  install arduino:avr
    cd ..\..\
  4. Build

    npm run compiler

@logix5
Copy link
Contributor

logix5 commented Nov 12, 2021 via email

@takujikawata-pr
Copy link
Member Author

@logix5

Thanks for the review and thanks for mentioning the boards need to be supported.
Yes, since arduino-cli.exe can only work for Windows and its not the file developed by us, I'm proposing to remove the file and get it from Arduino website when we build our executable for each platform instead.

As mentioned, the build and setup process need to be updated to make the cli tool available for every board our tool need to support. I checked current version for each board. By executing following command inside the arduino directory, tools for the boards (which can work on the platform (mac/windows)) would be installed.

arduino-cli core update-index
arduino-cli core  install arduino:[email protected]
arduino-cli core install arduino:[email protected]
arduino-cli core install arduino:[email protected]
arduino-cli core install esp8266:[email protected]
arduino-cli core install esp32:[email protected]

(since arduino-cli.yaml is in the directory, no need to specify where to download the 3rd party's libraries)

regarding compilation/arduino/userlib/libraries directory, I leave the directory as-is, so any user libraries for arduino will be shared for both Mac and Windows blockly.

We can make the above steps to a build batch file for sure. One thing I've noticed during my sanity test was if we install latest esp8266 code, some blockly block which works with internet won't work (compile fails because of the wrong parameter to a function call). So, having build batch file for arduino setup and explicitly specify which board version to install inside the batch file is a good idea.

About Mac:
By executing the command above, I believe the Mac version can also support esp8266, esp32, mega AVR and SanD boards. Since I don't have them, I haven't upload the code to them but I at least chosen every board type listed in OttoBlockly and confirmed blockly program is built without error.

About Linux:
Yes, since arduino-cli is available for Linux, too, I think the code will work on Linux, too.

@cparrapa cparrapa merged commit 13a38fe into OttoDIY:master Nov 13, 2021
@logix5
Copy link
Contributor

logix5 commented Nov 13, 2021 via email

@takujikawata-pr
Copy link
Member Author

@logix5
Thanks!

About the ESP8266 programs can not be compiled correctly, they were
IoT IFTTT | Ottoky and Open Weather | Ottoky.

They call HTTPClient as:

http.begin(serverName);

but the function signature seems to be changed in the latest version.

About linux build.

Here is my initial try with Ubuntu 20.04 on WSL2.

image

As its running inside widows machine, I couldn't get the USB connection for Arduino, I may have to have standalone linux machine for further testing. I confirmed the compile works fine at least. I think we can build for linux, too by having little further adjustment to the code.

@logix5
Copy link
Contributor

logix5 commented Nov 14, 2021 via email

@takujikawata-pr
Copy link
Member Author

@logix5

Thanks for taking a look.
About the examples.. Thanks, I now see IoT IFTTT | Ottoky and Open Weather | Ottoky examples are for ESP32. In the source code on the other hands, it includes ESP8266 files as like:

#include "ESP8266WiFi.h"

#include "ESP8266HTTPClient.h"

This sample may have to be updated anyway.
If I ensure my point for ESP8266, its latest board tool v 3.0.2 seems to have different function signature for HttpClient::begin(), (we are now in version 2.7.4) so we may have to consider which function signature to use in the future when we have WiFi block.
https://stackoverflow.com/questions/67702822/error-call-to-httpclientbegin-declared-with-attribute-error-obsolete-api

About linux, actually, electron-builder do things for us. It creates .deb file and user can download and manually install blockly app through this package file. The best would be make it publicly available through apt command. There need to be extra steps to make it, but I think we can use the .deb file electron-builder generates for that purpose, too.
About arduino-builder... As I don't know the history of OttoBlockly for the tool usage, I could be wrong but I see arduino-builder is just a wrapper of arduino-cli now, so we can switch to arduino-cli for Linux, too?

Yes, I'm also interesting to have both online and offline version works fine across all major desktop platforms. I think we are very close!

@logix5
Copy link
Contributor

logix5 commented Nov 14, 2021 via email

@takujikawata-pr
Copy link
Member Author

@logix5

Sure! Let's work together for the improvements!

@logix5
Copy link
Contributor

logix5 commented Nov 14, 2021 via email

@logix5
Copy link
Contributor

logix5 commented Nov 15, 2021 via email

@logix5
Copy link
Contributor

logix5 commented Jan 13, 2022 via email

@takujikawata-pr
Copy link
Member Author

takujikawata-pr commented Jan 13, 2022 via email

@logix5
Copy link
Contributor

logix5 commented Jan 13, 2022 via email

@logix5
Copy link
Contributor

logix5 commented Jan 13, 2022 via email

@takujikawata-pr
Copy link
Member Author

takujikawata-pr commented Jan 14, 2022 via email

@logix5
Copy link
Contributor

logix5 commented Jan 14, 2022 via email

@logix5
Copy link
Contributor

logix5 commented Jan 14, 2022 via email

@takujikawata-pr
Copy link
Member Author

takujikawata-pr commented Jan 14, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants