Overhaul the build process and the CLI

All Make files have been merged into a single top-level Makefile, which
in turn has been cleaned up. The CLI has also been revamped

== Easier installation process

The installation process has also been simplified into two steps:

    make build
    make install

If files need to be installed in a different location, such as a
packaging jail/chroot, you can run the following:

    make build
    make install DESTDIR=example/directory

We also support the PREFIX variable better now. By default DESTDIR is
set to PREFIX, but you can also set them separately. This way you can
customise where the compiler will look for source files using PREFIX,
while still being able to install the files into a (temporary) directory
using DESTDIR. For example:

    make build
    make install PREFIX=/usr/local DESTDIR=/tmp/package-chroot

== Removal of pre-compiled packages

As part of these changes, we stop providing pre-compiled binaries in the
S3 bucket releases.inko-lang.org. This is discussed in
#218, but in short:

1. Few users are likely to use and benefit from these pre-compiled
   binaries.
2. Because of the compile-from-source fallback you still have to install
   all compile-time dependencies.
3. Focusing on package managers (e.g. including Inko in the AUR) is more
   useful.
4. The compiler packages may stop working in the future, if any of the
   OS' decide to change things such that previously compiled binaries
   have to be recompiled.
5. All of this requires a fair amount of complexity on our end, with
   little to no benefit.

== New CLI

This adds a new "inko" executable written in Rust, replacing the
"inko-test", "inkoc", and "inko" Ruby executables, and the "ivm"
executable.

This new executable uses sub-commands for building Inko source files,
running tests, etc. This executable has various paths, such as the path
to the compiler, compiled into itself. This ensures that the "inko"
executable always uses the correct version of the compiler, runtime,
etc.

Usage of the new CLI is as follows:

    inko test.inko          # Compiles and runs test.inko
    inko run test.inko      # Same thing
    inko run test.ibi       # Run a bytecode image
    inko build test.inko    # Just compiles test.inko
    inko test               # Runs all unit tests in ./tests/test

Since the compiler is still written in Ruby, the "inko" executable will
spawn a sub-process to run the compiler. The VM is run in the same
process as the CLI.

To make developing the CLI a bit easier, we now use Cargo workspaces to
separate the VM (= libinko) and the CLI.
parent b7011125
Pipeline #196145228 passed with stages
in 66 minutes and 15 seconds
/compiler/target
/compiler/pkg
/vm/target
/runtime/target
.*.rustfmt
/tmp
/target
......@@ -5,7 +5,7 @@ variables:
AWS_REGION: eu-west-1
# Ensure Windows builds fail when Powershell detects an error.
ErrorActionPreference: 'STOP'
LICENSE_FINDER_CLI_OPTS: '--aggregate-paths=vm compiler'
LICENSE_FINDER_CLI_OPTS: '--aggregate-paths=. compiler'
stages:
- test
......
......@@ -23,11 +23,10 @@ lint:clippy:
image: registry.gitlab.com/inko-lang/development-docker-images:rust-stable
stage: test
before_script:
- cd vm
- rustc --version
- cargo --version
script:
- make clippy
- make vm/clippy
cache:
paths:
- .cargo
......@@ -39,12 +38,11 @@ lint:rustfmt:
image: registry.gitlab.com/inko-lang/development-docker-images:rust-stable
stage: test
before_script:
- cd vm
- rustc --version
- cargo --version
- rustfmt --version
script:
- make rustfmt-check
- make vm/rustfmt-check
except:
- tags
......
......@@ -3,14 +3,15 @@ test:compiler:linux:
image: registry.gitlab.com/inko-lang/development-docker-images:alpine
stage: test
before_script:
- cd compiler
- ruby --version
- gem --version
- bundle --version
- cd compiler
- bundle config set path vendor
- bundle install --retry=3
- cd ..
script:
- make test
- make compiler/test
cache:
key: linux-compiler
paths:
......@@ -20,11 +21,10 @@ test:ivm:linux:
image: registry.gitlab.com/inko-lang/development-docker-images:alpine
stage: test
before_script:
- cd vm
- rustc --version
- cargo --version
script:
- make test
- make vm/test
cache:
key: linux-vm
paths:
......@@ -39,8 +39,7 @@ test:runtime:linux:
- rustc --version
- cargo --version
script:
- make -C vm release
- env RUBYLIB=./compiler/lib ./compiler/bin/inko-test -d runtime --vm ./vm/target/release/ivm
- make runtime/test
cache:
key: linux-vm
paths:
......@@ -49,23 +48,3 @@ test:runtime:linux:
needs:
- test:compiler:linux
- test:ivm:linux
release:compiled:linux-gnu:
image: registry.gitlab.com/inko-lang/development-docker-images:rust-stable
stage: release
before_script:
- ruby --version
- rustc --version
- cargo --version
- aws --version
script:
- make release-compiled
only:
- tags
cache:
key: linux-vm
paths:
- .cargo
- vm/target
needs:
- test:runtime:linux
......@@ -11,14 +11,15 @@ test:compiler:macos:
- .macos-tags
stage: test
before_script:
- cd compiler
- ruby --version
- gem --version
- bundle --version
- cd compiler
- bundle config set path vendor
- bundle install --retry=3
- cd ..
script:
- gmake test
- gmake compiler/test
cache:
key: macos-compiler
paths:
......@@ -30,11 +31,10 @@ test:ivm:macos:
- .macos-tags
stage: test
before_script:
- cd vm
- rustc --version
- cargo --version
script:
- env LLVM_CONFIG_PATH="$(brew --prefix llvm)/bin/llvm-config" gmake test
- env LLVM_CONFIG_PATH="$(brew --prefix llvm)/bin/llvm-config" gmake vm/test
cache:
key: macos-vm
paths:
......@@ -51,8 +51,7 @@ test:runtime:macos:
- rustc --version
- cargo --version
script:
- env LLVM_CONFIG_PATH="$(brew --prefix llvm)/bin/llvm-config" gmake -C vm release
- env RUBYLIB=./compiler/lib ./compiler/bin/inko-test -d runtime --vm ./vm/target/release/ivm
- env LLVM_CONFIG_PATH="$(brew --prefix llvm)/bin/llvm-config" gmake runtime/test
cache:
key: macos-vm
paths:
......@@ -61,26 +60,3 @@ test:runtime:macos:
needs:
- test:compiler:macos
- test:ivm:macos
release:compiled:macos:
extends:
- .only-source-repository
- .macos-tags
stage: release
before_script:
- ruby --version
- rustc --version
- cargo --version
- aws --version
script:
- env LLVM_CONFIG_PATH="$(brew --prefix llvm)/bin/llvm-config"
gmake release-compiled SHA256SUM=gsha256sum
only:
- tags
cache:
key: macos-vm
paths:
- .cargo
- vm/target
needs:
- test:runtime:macos
......@@ -3,7 +3,7 @@ release:source:
image: registry.gitlab.com/inko-lang/development-docker-images:alpine
stage: release
script:
- make release-source
- make release/source
only:
- tags
......@@ -11,6 +11,6 @@ post-release:manifest:
image: registry.gitlab.com/inko-lang/development-docker-images:alpine
stage: post-release
script:
- make rebuild-manifest
- make release/manifest
only:
- tags
......@@ -11,14 +11,15 @@ test:compiler:windows:
- .windows-tags
stage: test
before_script:
- cd compiler
- ruby --version
- gem --version
- bundle --version
- cd compiler
- bundle config set path vendor
- bundle install --retry=3
- cd ..
script:
- make test
- make compiler/test
cache:
key: windows-compiler
paths:
......@@ -30,11 +31,10 @@ test:ivm:windows:
- .windows-tags
stage: test
before_script:
- cd vm
- rustc --version
- cargo --version
script:
- make test
- make vm/test
cache:
key: windows-vm
paths:
......@@ -51,8 +51,7 @@ test:runtime:windows:
- rustc --version
- cargo --version
script:
- make -C vm release
- ruby -I ./compiler/lib ./compiler/bin/inko-test -d runtime --vm ./vm/target/release/ivm.exe
- make runtime/test
cache:
key: windows-vm
paths:
......@@ -61,25 +60,3 @@ test:runtime:windows:
needs:
- test:compiler:windows
- test:ivm:windows
release:compiled:windows:
extends:
- .only-source-repository
- .windows-tags
stage: release
before_script:
- ruby --version
- rustc --version
- cargo --version
- aws --version
script:
- make release-compiled
only:
- tags
cache:
key: windows-vm
paths:
- .cargo
- vm/target
needs:
- test:runtime:windows
......@@ -8,18 +8,18 @@ checksum = "955f37ac58af2416bac687c8ab66a4ccba282229bd7422a28d2281a5e66a6116"
[[package]]
name = "ahash"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d66721683190aeea775c737eee925aea24719058d86d815e8ee121dd9f37d19"
checksum = "0adac150c2dd5a9c864d054e07bda5e6bc010cd10036ea5f17e82a2f5867f735"
dependencies = [
"const-random",
]
[[package]]
name = "aho-corasick"
version = "0.7.10"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
dependencies = [
"memchr",
]
......@@ -64,9 +64,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
[[package]]
name = "autocfg"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "base-x"
......@@ -76,9 +76,9 @@ checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1"
[[package]]
name = "base64"
version = "0.11.0"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]]
name = "bindgen"
......@@ -129,9 +129,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "cc"
version = "1.0.54"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
[[package]]
name = "cexpr"
......@@ -161,9 +161,9 @@ dependencies = [
[[package]]
name = "clap"
version = "2.33.1"
version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [
"ansi_term",
"atty",
......@@ -203,6 +203,12 @@ dependencies = [
"proc-macro-hack",
]
[[package]]
name = "const_fn"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2"
[[package]]
name = "constant_time_eq"
version = "0.1.5"
......@@ -211,9 +217,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "crossbeam-channel"
version = "0.4.2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
dependencies = [
"crossbeam-utils",
"maybe-uninit",
......@@ -236,7 +242,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
"cfg-if",
"crossbeam-utils",
"lazy_static",
......@@ -251,7 +257,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
"cfg-if",
"lazy_static",
]
......@@ -307,9 +313,9 @@ dependencies = [
[[package]]
name = "fs_extra"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "fuchsia-cprng"
......@@ -328,9 +334,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.1.14"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
dependencies = [
"cfg-if",
"libc",
......@@ -345,9 +351,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hermit-abi"
version = "0.1.14"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
dependencies = [
"libc",
]
......@@ -365,28 +371,9 @@ dependencies = [
name = "inko"
version = "0.7.0"
dependencies = [
"ahash",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"dirs-next",
"float-cmp",
"getopts",
"jemallocator",
"libc",
"libffi",
"libloading 0.6.2",
"nix",
"num-bigint",
"num-integer",
"num-traits",
"num_cpus",
"parking_lot",
"rand 0.6.5",
"socket2",
"time",
"wepoll-binding",
"winapi",
"libinko",
]
[[package]]
......@@ -424,15 +411,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.2.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.71"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "libffi"
......@@ -457,6 +444,32 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "libinko"
version = "0.7.0"
dependencies = [
"ahash",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"dirs-next",
"float-cmp",
"libc",
"libffi",
"libloading 0.6.3",
"nix",
"num-bigint",
"num-integer",
"num-traits",
"num_cpus",
"parking_lot",
"rand 0.6.5",
"socket2",
"time",
"wepoll-binding",
"winapi",
]
[[package]]
name = "libloading"
version = "0.5.2"
......@@ -469,10 +482,11 @@ dependencies = [
[[package]]
name = "libloading"
version = "0.6.2"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cadb8e769f070c45df05c78c7520eb4cd17061d4ab262e43cfc68b4d00ac71c"
checksum = "2443d8f0478b16759158b2f66d525991a05491138bc05814ef52a250148ef4f9"
dependencies = [
"cfg-if",
"winapi",
]
......@@ -487,9 +501,9 @@ dependencies = [
[[package]]
name = "log"
version = "0.4.8"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
......@@ -514,11 +528,11 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "memoffset"
version = "0.5.4"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
]
[[package]]
......@@ -550,7 +564,7 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
"num-integer",
"num-traits",
"rand 0.5.6",
......@@ -562,7 +576,7 @@ version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
"num-traits",
]
......@@ -572,7 +586,7 @@ version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
dependencies = [
"autocfg 1.0.0",
"autocfg 1.0.1",
]
[[package]]
......@@ -617,21 +631,21 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "pkg-config"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
[[package]]
name = "proc-macro-hack"
version = "0.5.16"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
[[package]]
name = "proc-macro2"
version = "1.0.18"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
dependencies = [
"unicode-xid",
]
......@@ -781,15 +795,15 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.1.56"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "redox_users"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
dependencies = [
"getrandom",
"redox_syscall",
......@@ -816,9 +830,9 @@ checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
[[package]]
name = "rust-argon2"
version = "0.7.0"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19"
dependencies = [
"base64",
"blake2b_simd",
......@@ -870,15 +884,15 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.114"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
[[package]]
name = "serde_derive"
version = "1.0.114"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
dependencies = [
"proc-macro2",
"quote",
......@@ -887,9 +901,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.55"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226"
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
dependencies = [
"itoa",