Skip to content

Commit

Permalink
Merge pull request #49 from davidanthoff/julia-1.3
Browse files Browse the repository at this point in the history
Port to Julia 1.3
  • Loading branch information
davidanthoff authored Nov 29, 2019
2 parents 780e1dd + 2fd18e7 commit 13b88af
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 60 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/jlpkgbutler-ci-master-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0.5, 1.1.1, 1.2.0, 1.3.0]
julia-version: [1.3.0]
julia-arch: [x64, x86]
os: [ubuntu-latest, windows-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86
- os: ubuntu-latest
julia-arch: x86

steps:
- uses: actions/checkout@v1.0.0
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/jlpkgbutler-ci-pr-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0.5, 1.1.1, 1.2.0, 1.3.0]
julia-version: [1.3.0]
julia-arch: [x64, x86]
os: [ubuntu-latest, windows-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86
- os: ubuntu-latest
julia-arch: x86

steps:
- uses: actions/checkout@v1.0.0
Expand Down
78 changes: 78 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[[electronjs_app]]
arch = "x86_64"
git-tree-sha1 = "41afcbdbe95343621162214b9fc07813c12b5d36"
libc = "glibc"
os = "linux"

[[electronjs_app.download]]
sha256 = "405da5f4914cfd63a02f01ce8e1e72d078208422cc752e39f06666c6bff86487"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-x86_64-linux-gnu.tar.gz"
[[electronjs_app]]
arch = "aarch64"
git-tree-sha1 = "7f1cfc16fd19d077fef353b364f0edd5d18aa8ce"
libc = "glibc"
os = "linux"

[[electronjs_app.download]]
sha256 = "d32f28485af706aa07bb02e3ec8cf908c8549e8b3fefdc962d656ac31571175b"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-aarch64-linux-gnu.tar.gz"
[[electronjs_app]]
arch = "armv7l"
git-tree-sha1 = "fcc61e85a8bef71a539b796c8378d2fd559b1f82"
libc = "glibc"
os = "linux"

[[electronjs_app.download]]
sha256 = "01d43e3c57dcec4f0351b01dbf31478afb8535c68d401887fd0c6328cdd69590"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-arm-linux-gnueabihf.tar.gz"
[[electronjs_app]]
arch = "x86_64"
git-tree-sha1 = "41afcbdbe95343621162214b9fc07813c12b5d36"
libc = "musl"
os = "linux"

[[electronjs_app.download]]
sha256 = "be5dab01b4ba3339a3d87b29c2dc605b57c08ac2fd8eb36b0f06df937362b199"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-x86_64-linux-musl.tar.gz"
[[electronjs_app]]
arch = "aarch64"
git-tree-sha1 = "7f1cfc16fd19d077fef353b364f0edd5d18aa8ce"
libc = "musl"
os = "linux"

[[electronjs_app.download]]
sha256 = "13a4539c149c46f48d9640262b445a4610b19d5855ddd3b0149a1444bb647fed"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-aarch64-linux-musl.tar.gz"
[[electronjs_app]]
arch = "armv7l"
git-tree-sha1 = "fcc61e85a8bef71a539b796c8378d2fd559b1f82"
libc = "musl"
os = "linux"

[[electronjs_app.download]]
sha256 = "153005783c17214625132dd8eea1ea6a6e97a3bcc0efc256558ed84d74210bd1"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-arm-linux-musleabihf.tar.gz"
[[electronjs_app]]
arch = "x86_64"
git-tree-sha1 = "8dcb05674719648a37669520bc9a6ef8773032f2"
os = "macos"

[[electronjs_app.download]]
sha256 = "cd266dbeb049ddeb90147aadf090241dda0b45ea46d632feaf3b50af28ddee97"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-x86_64-apple-darwin14.tar.gz"
[[electronjs_app]]
arch = "i686"
git-tree-sha1 = "0337e22522cfe87d096e392f35bf759c4fd0e2f2"
os = "windows"

[[electronjs_app.download]]
sha256 = "12a3b8c3d1eabd1af02786dae8d27b76eef3f04b517eddf88b6335eab77c8bbe"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-i686-w64-mingw32.tar.gz"
[[electronjs_app]]
arch = "x86_64"
git-tree-sha1 = "3cac82ef60c809398a5dd6870b5e97d42dbe2df1"
os = "windows"

[[electronjs_app.download]]
sha256 = "2abb775e36658b77adc809772d35d5f9c241679134f8d56031aaab9cfe926465"
url = "https://github.com/davidanthoff/ElectronBuilder/releases/download/v7.1.2%2B0/ElectronJS-7.1.2+0-x86_64-w64-mingw32.tar.gz"
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The Electron.jl package is licensed under the MIT "Expat" License:

> Copyright (c) 2018: David Anthoff.
> Copyright (c) 2018-2019: David Anthoff.
>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Electron.jl v2.0.0 Release Notes
* Update Electron to version 7.1.2
* Use artifact system
* Drop pre Julia 1.3 support

# Electron.jl v1.1.0 Release Notes
* Add ElectronAPI
* Fix a bug on Julia 1.3
Expand Down
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
URIParser = "30578b45-9adc-5946-b283-645ec420af67"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
JSON = "0.19, 0.20, 0.21"
URIParser = "0.4"
julia = "0.7, 1"
julia = "1.3"

[targets]
test = ["Test"]
48 changes: 0 additions & 48 deletions deps/build.jl

This file was deleted.

Binary file removed res/julia-icns.icns
Binary file not shown.
24 changes: 18 additions & 6 deletions src/Electron.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
module Electron

using JSON, URIParser, Sockets, Base64
using JSON, URIParser, Sockets, Base64, Pkg.Artifacts

export Application, Window, URI, windows, applications, msgchannel, toggle_devtools, load, ElectronAPI

function conditional_electron_load()
try
return artifact"electronjs_app"
catch error
return nothing
end
end

const electronjs_path = conditional_electron_load()

function prep_test_env()
if haskey(ENV, "GITHUB_ACTIONS") && ENV["GITHUB_ACTIONS"] == "true"
if Sys.islinux()
Expand Down Expand Up @@ -98,12 +108,14 @@ function generate_pipe_name(name)
end

function get_electron_binary_cmd()
@static if Sys.isapple()
return joinpath(@__DIR__, "..", "deps", "electron", "Julia.app", "Contents", "MacOS", "Julia")
if electronjs_path===nothing
return "electron"
elseif Sys.isapple()
return joinpath(electronjs_path, "Julia.app", "Contents", "MacOS", "Julia")
elseif Sys.iswindows()
return joinpath(@__DIR__, "..", "deps", "electron", "electron.exe")
return joinpath(electronjs_path, "electron.exe")
else # assume unix layout
return joinpath(@__DIR__, "..", "deps", "electron", "electron")
return joinpath(electronjs_path, "electron")
end
end

Expand Down Expand Up @@ -176,7 +188,7 @@ function Application()
elseif cmd_parsed["cmd"] == "msg_from_window"
win_index = findfirst(w -> w.id == cmd_parsed["winid"], app.windows)
put!(app.windows[win_index].msg_channel, cmd_parsed["payload"])
end
end
catch er
bt = catch_backtrace()
io = PipeBuffer()
Expand Down
11 changes: 9 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ const os = require('os')
const readline = require('readline')

function createWindow(connection, opts) {
if ('webPreferences' in opts) {
opts.webPreferences['nodeIntegration'] = true
}
else {
opts['webPreferences'] = {nodeIntegration: true};
}
opts.webPreferences.nodeIntegration = true
var win = new BrowserWindow(opts)
win.loadURL(opts.url ? opts.url : "about:blank")
win.setMenu(null)
Expand Down Expand Up @@ -38,7 +45,7 @@ function process_command(connection, cmd) {
retval = {data: x===undefined ? null : x}
} catch (errval) {
retval = {error: JSON.stringify(errval)}
}
}
connection.write(JSON.stringify(retval) + '\n')
}
else if (cmd.cmd == 'runcode' && cmd.target == 'window') {
Expand Down Expand Up @@ -94,7 +101,7 @@ app.on('ready', function () {
var win_id = BrowserWindow.fromWebContents(event.sender).id;
sysnotify_connection.write(JSON.stringify({ cmd: "msg_from_window", winid: win_id, payload: arg }) + '\n')
})

const rloptions = { input: connection, terminal: false, historySize: 0, crlfDelay: Infinity }
const rl = readline.createInterface(rloptions)

Expand Down

0 comments on commit 13b88af

Please sign in to comment.