Skip to content

Commit 8e605dd

Browse files
committed
Add commandline_hello examples
1 parent 78c42fa commit 8e605dd

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

examples/commandline_hello.jl

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# A super-simple command line program that just prints hello.
2+
# Build this with the `commandline_app=true` flag in `BuildApp.build_app_bundle`.
3+
4+
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
5+
println("Oh hi, World!")
6+
println("Current working directory: $(pwd())")
7+
return 0
8+
end

test/BuildApp.jl

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ builddir = mktempdir()
2121
end
2222
end
2323

24+
@testset "commandline_app" begin
25+
@test 0 == include("build_examples/commandline_hello.jl")
26+
@test success(`open $builddir/hello.app`)
27+
end
28+
2429

2530
function testRunAndKillProgramSucceeds(cmd)
2631
out, _, p = readandwrite(cmd) # Make sure it runs correctly
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using ApplicationBuilder; using BuildApp
2+
3+
# Allow this file to be called either as a standalone file to build the above
4+
# example, or from runtests.jl using a provided builddir.
5+
isdefined(:builddir) || (builddir=nothing) # nothing == default builddir.
6+
7+
build_app_bundle(joinpath(@__DIR__,"..","..","examples","commandline_hello.jl"),
8+
appname="hello",
9+
commandline_app=true, builddir=builddir)

0 commit comments

Comments
 (0)