eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

Make Ceylon scriptable #3306

Open CeylonMigrationBot opened 12 years ago

CeylonMigrationBot commented 12 years ago

[@FroMage] Needs some thinking

[Migrated from ceylon/ceylon-spec#200]

lucaswerkmeister commented 7 years ago

I’m not sure what you mean by point 10. ceylonb isn’t mine, it was added by @quintesse (#6080). And I don’t think it makes sense to have /bin/ceylonb – if you’ve installed a Ceylon package (which the /bin path implies), then you don’t need the bootstrap version, you might as well use ceylon directly.

HenningB commented 7 years ago

Sorry, I mean ceylond. Now corrected in my previous comment.

ceylond because it won't be a big issue if the scripts get recompiled each time (if we don't get the caching right). Or if the user wants to use Ceylon script for building software, like Gradle which also starts a deamon.

luolong commented 7 years ago

Will ceylond be installed as part of official ceylon distribution or do I have to install it separately?

jvasileff commented 7 years ago

Various hash-bang lines are suggested above, such as:

But there are a couple problems.

First, the Ceylon installation directory is not likely to be consistent across machines (it may be /usr/local/bin/ceylon, ~/opt/ceylon/bin, /usr/bin/ceylon, etc., etc.) For portable scripts, this would be solved by using env to search the user's path for ceylon, as in:

#!/usr/bin/env ceylon run --compile

But the second problem is that on linux, only a single argument can be provided to hash-bang commands. The above would be interpreted as #!/usr/bin/env "ceylon run --compile", which wouldn't work. Nor would #!/bin/ceylon run --compile.

So I think we probably need a ceylon-script command that requires no arguments. The suggested usage would be:

#!/usr/bin/env ceylon-script

Note that the caller of the script may also provide arguments to the script.