Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# A super-simple command line program that just prints hello. | ||
# Build this with the `commandline_app=true` flag in `BuildApp.build_app_bundle`. | ||
|
||
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint | ||
println("Hi what's your name?") | ||
name = readline() | ||
println("Oh hi, $name\! It's a pleasure to meet you.") | ||
println("By the way, here's the current working directory:\n'$(pwd())'") | ||
|
||
println("\nGoodbye! (Press enter to exit)") | ||
readline() | ||
return 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function get_commandline_applescript(exe_dir, executable_path) | ||
""" | ||
set RootPath to POSIX path of (path to me) | ||
tell application id "com.apple.terminal" | ||
do script ("exec '" & RootPath & "$exe_dir/$executable_path'") | ||
activate | ||
end tell | ||
""" | ||
end | ||
|
||
function build_commandline_app_bundle(builddir, binary_name, appname) | ||
|
||
applescript_file = "$builddir/build_$appname.applescript" | ||
exe_dir = "Contents/app" | ||
write(applescript_file, get_commandline_applescript(exe_dir, binary_name)) | ||
|
||
app_path = "$builddir/$appname.app" | ||
run(`osacompile -o $app_path $applescript_file`) | ||
|
||
return joinpath(app_path,exe_dir) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using ApplicationBuilder; using BuildApp | ||
|
||
# Allow this file to be called either as a standalone file to build the above | ||
# example, or from runtests.jl using a provided builddir. | ||
isdefined(:builddir) || (builddir=nothing) # nothing == default builddir. | ||
|
||
build_app_bundle(joinpath(@__DIR__,"..","..","examples","commandline_hello.jl"), | ||
appname="hello", | ||
commandline_app=true, builddir=builddir) |