Alexis Laferrière [Tue, 8 May 2018 23:52:02 +0000 (19:52 -0400)]
json: rename and improve the quick and easy `deserialize_json`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 3 May 2018 23:15:49 +0000 (19:15 -0400)]
Merge: parse_examples: minor fixes
This PR fixes two things:
1. call `visit_all` so statements are all visited
2. also count newly instanciated mclasses
Pull-Request: #2639
Alexandre Terrasa [Thu, 3 May 2018 15:20:36 +0000 (11:20 -0400)]
parse_examples: count new on classes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Thu, 3 May 2018 13:46:32 +0000 (09:46 -0400)]
Merge: No intrude rope stream
Two things happening here, in two commits:
* the first commit moves the definition of `decoder` into Stream, and renames it to `codec` since both coding/decoding will be used by streams when dealing with String semantics.
* the second commit removes the `intrude inport ropes` from stream as this was not necessary, and performance-wise did not matter sufficiently to justify this
Pull-Request: #2632
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 3 May 2018 13:44:24 +0000 (09:44 -0400)]
Merge: Read byte rewrite
As part of the stream refactor series, this patches cleanup msgpack a bit and introduce a lower-level `read_byte` implementation on which `read_byte(s)` will rely for reading data from a source.
In the future, the lowest-level interface to read bytes, and the only one required for implementing a new stream will be the `raw_read_byte(s)` functions.
A cleanup of the current streams will be needed for this to be used properly, coming in the next few PRs.
Note: The first two commits have already been submitted under #2632, therefore disregard them for this PR.
Pull-Request: #2633
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 3 May 2018 13:44:21 +0000 (09:44 -0400)]
Merge: nitmetrics: metrics about ReadMe files
This PR add an option `--readme` to extract metrics about ReadMe / Markdown files.
Running the following command:
~~~sh
nitmetrics --readme tests/test_prog
~~~
Will produce the following output:
~~~md
*** METRICS ***
# ReadMe metrics
## package test_prog (test_prog/README.md)
* has_package 1
* has_readme 1
* md_lines 12
* nb_section 0
* md_blocks 14
* BlockParagraph 4
* BlockUnorderedList 1
* BlockListItem 4
* SpanCode 4
* Image 1
~~~
Pull-Request: #2634
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 3 May 2018 13:44:19 +0000 (09:44 -0400)]
Merge: Some lib/graph love
I needed an Eulerian circuit so I implemented a quick and dirty one
Pull-Request: #2635
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 3 May 2018 13:44:18 +0000 (09:44 -0400)]
Merge: model_collect: collect all modules from a package
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2638
Jean Privat [Thu, 3 May 2018 13:44:16 +0000 (09:44 -0400)]
Merge: lib/msgpack: unify several cases for deserialization
Some cases were treated independently while retaining mostly the same
code.
This commit tries to unite such cases into a single branch.
Doing so helps readability, reduces code duplication and should
hopefully improve performance as the number of tests to be performed is
lower.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Pull-Request: #2640
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Lucas Bajolet [Wed, 25 Apr 2018 20:27:31 +0000 (16:27 -0400)]
lib/core: add no-overhead read_bytes implementation
read_bytes as a simple interface is relevant, but may hinder
performances in case a chunk is repeatedly read and discarded as for
each read operation, a buffer is re-allocated.
A secondary read operation is introduced to read directly to a CString,
using closer-to-C semantics.
Also start using codec lookahead as source for reading bytes.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Alexandre Terrasa [Tue, 1 May 2018 15:34:36 +0000 (11:34 -0400)]
tests: add test for --readme option from nitmetrics
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 1 May 2018 15:34:14 +0000 (11:34 -0400)]
nitmetrics: extract metrics about Readme/Markdown files
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Lucas Bajolet [Mon, 30 Apr 2018 22:23:39 +0000 (18:23 -0400)]
lib/msgpack: unify several cases for deserialization
Some cases were treated independently while retaining mostly the same
code.
This commit tries to unite such cases into a single branch.
Doing so helps readability, reduces code duplication and should
hopefully improve performance as the number of tests to be performed is
lower.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Lucas Bajolet [Fri, 6 Apr 2018 05:57:29 +0000 (01:57 -0400)]
lib/core: remove ropes intrude import in stream
The intrude import of ropes in lib/core/stream was only due to the
ropification of the read_all_bytes.
As the leaves were too small to have a positive impact with the actual
threshold value being chosen here, we remove the ropification in the
read_all function.
This simplifies code a lot, and keeps out the intrude import of the
ropes module.
We also take advantage of this modification to start using codecs here
to decode the string.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Lucas Bajolet [Fri, 6 Apr 2018 02:15:28 +0000 (22:15 -0400)]
stream: move decoder to stream and rename as codec
Since every stream will need to pass through a codec to code/decode to
and from textual data, the former 'decoder' attribute is now moved to
Stream and renamed to better reflect its use.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Lucas Bajolet [Fri, 6 Apr 2018 05:57:29 +0000 (01:57 -0400)]
lib/core: remove ropes intrude import in stream
The intrude import of ropes in lib/core/stream was only due to the
ropification of the read_all_bytes.
As the leaves were too small to have a positive impact with the actual
threshold value being chosen here, we remove the ropification in the
read_all function.
This simplifies code a lot, and keeps out the intrude import of the
ropes module.
We also take advantage of this modification to start using codecs here
to decode the string.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Lucas Bajolet [Fri, 6 Apr 2018 02:15:28 +0000 (22:15 -0400)]
stream: move decoder to stream and rename as codec
Since every stream will need to pass through a codec to code/decode to
and from textual data, the former 'decoder' attribute is now moved to
Stream and renamed to better reflect its use.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Alexandre Terrasa [Tue, 1 May 2018 17:47:25 +0000 (13:47 -0400)]
parse_examples: visit all statements
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 1 May 2018 17:44:08 +0000 (13:44 -0400)]
model_collect: collect all modules from a package
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Tue, 1 May 2018 15:41:53 +0000 (11:41 -0400)]
lib/graph: add `Digraph::eulerian_path`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 1 May 2018 15:40:52 +0000 (11:40 -0400)]
lib/graph: add MutableDigraph::add_graph
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 1 May 2018 15:39:48 +0000 (11:39 -0400)]
lib/graph: remove unneeded import in docunits
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 1 May 2018 15:01:30 +0000 (11:01 -0400)]
lib: rename graphs to graph
plurial in packagename is weird
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 27 Apr 2018 16:19:33 +0000 (12:19 -0400)]
Merge: core/stream: change read_byte return type to Int
A read_byte used to return a nullable Byte, which could cause
unnecessary boxings, and thus could harm performance.
This commit changes its return to Int, and adopts a closer-to-C api,
returning a negative value when an error occurs.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Pull-Request: #2631
Lucas Bajolet [Thu, 29 Mar 2018 19:57:22 +0000 (15:57 -0400)]
core/stream: change read_byte return type to Int
A read_byte used to return a nullable Byte, which could cause
unnecessary boxings, and thus could harm performance.
This commit changes its return to Int, and adopts a closer-to-C api,
returning a negative value when an error occurs.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Jean Privat [Fri, 6 Apr 2018 02:04:37 +0000 (22:04 -0400)]
Merge: nitc: do not autocast primitive types
Fix #2629
Pull-Request: #2630
Jean Privat [Fri, 6 Apr 2018 02:04:36 +0000 (22:04 -0400)]
Merge: tests: fix locale issue on non-Debian linux
The C.UTF-8 locale is Debian-specific and causes issues on other
platforms.
To avoid setlocale error messages, the LC_ALL export will default on C
if C.UTF-8 is unavailable on the target platform.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Pull-Request: #2628
Jean Privat [Fri, 6 Apr 2018 02:04:36 +0000 (22:04 -0400)]
Merge: gitignore: ignore nit_compile folders and contents
nit_compile are a series of generated intermediate C files that should
not be versioned.
We therefore add them to the .gitignore to eliminate them from the
index.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Pull-Request: #2627
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 6 Apr 2018 02:04:35 +0000 (22:04 -0400)]
Merge: console: don't color output when stdout is not a TTY (by default)
Change the behavior of the `console` package to ignore color commands like `Text::green` when stdout is not a TTY. You can override this behavior by setting `force_console_colors = true`.
I made this change to color the output of nitpm, however, it can be useful to other tools to support stdout redirection by default.
Pull-Request: #2626
Jean Privat [Fri, 6 Apr 2018 02:01:35 +0000 (22:01 -0400)]
Merge: Extend nitpm (formerly picnit) to support package versions and dependencies
Rename picnit to nitpm and intro 4 main new features.
### Install package versions
Install specific versions of a package using the following command:
~~~
nitpm install gamnit=0.5
~~~
The version string (the `0.5` in the above example) must be a Git branch or tag, it will be used when cloning the package locally. The package will be downloaded to `~/.local/lib/nit/gamnit=0.5/`, allowing multiple versions of the same package to be installed concurrently.
### Dependencies in package.ini
Packages should now declare dependencies to other nitpm packages in the `package.ini` at the `import` key:
~~~
[package]
name=my_package
import=hello_nitpm, gamnit=0.5
~~~
The dependencies can then be installed automatically with `nitpm install` from the root of the package.
Nit tools read the local `package.ini` to redirect imports of `gamnit` inside this package to this specific version. So for `my_package` described above, all references to `gamnit` will use the implementation `gamnit=0.5`.
### Recursive installation
nitpm installs dependencies recursively, so if `gamnit` requires `glesv2`, after an explicit command to install `gamnit` nitpm will also install `glesv2`. This implementation is minimal, it could be improved by precalculating all dependencies and asking for confirmation.
### Customizable install directory
You can now use the env var `NITPM_PATH` to set the path where libraries are installed. This will override the default path at `~/.local/lib/nit/`.
### Others
* `nitpm uninstall` can uninstall many packages at once, it is safer and it accepts the -f option to skip the confirmation.
* `nitpm list` lists packages in alphabetical order.
Pull-Request: #2622
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 5 Apr 2018 18:05:46 +0000 (14:05 -0400)]
nitc: do not autocast primitive types
Signed-off-by: Jean Privat <jean@pryen.org>
Lucas Bajolet [Thu, 29 Mar 2018 19:53:46 +0000 (15:53 -0400)]
tests: fix locale issue on non-Debian linux
The C.UTF-8 locale is Debian-specific and causes issues on other
platforms.
To avoid setlocale error messages, the LC_ALL export will default on
C.UTF-8, the system utf-8 locale if unavailable, and on C if no better
choice is available.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Lucas Bajolet [Thu, 29 Mar 2018 03:20:12 +0000 (23:20 -0400)]
gitignore: ignore nit_compile folders and contents
nit_compile are a series of generated intermediate C files that should
not be versioned.
We therefore add them to the .gitignore to eliminate them from the
index.
Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
Alexis Laferrière [Thu, 29 Mar 2018 14:47:52 +0000 (10:47 -0400)]
tests: remove colors from savs of nitls, nitlight, etc.
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 29 Mar 2018 14:51:14 +0000 (10:51 -0400)]
rubix: force console colors because it makes no sense without it
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 16 Mar 2018 14:42:22 +0000 (10:42 -0400)]
console: only color outputs if stdout isa TTY
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 29 Mar 2018 00:11:33 +0000 (20:11 -0400)]
Merge: Make the `do catch` great again
This PR removes some of the limitations of the `do catch` :
* Hard-coded limit of 100 jumping environments is gone, the array is now dynamic
* The structure for managing jump environments is now lazy initialized
* Now using gcc's `__thread` specifier so that each thread has it's own jumping stack
Pull-Request: #2612
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Thu, 29 Mar 2018 00:11:32 +0000 (20:11 -0400)]
Merge: share: shallow clone bdwgc for Android and iOS
When compiling a Nit app for Android, a specific branch of bdwgc/libgc/boehm-gc is cloned locally. Using a shallow clone only fetches the last commit, for a faster download and to use less disk space.
Closes #2621.
Pull-Request: #2624
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Jean Privat [Thu, 29 Mar 2018 00:11:31 +0000 (20:11 -0400)]
Merge: curl: basic Unix domain socket support
Support using a Unix socket to send an HTTP request.
~~~
var request = new CurlHTTPRequest("http://localhost/")
request.unix_socket_path = "/tmp/nginx.sock"
var response = request.execute
~~~
@matthmsl Is this what you needed for #2623?
Pull-Request: #2625
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Alexis Laferrière [Fri, 16 Mar 2018 14:40:44 +0000 (10:40 -0400)]
console: move up services from String to Text, and update doc
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 16 Mar 2018 14:39:41 +0000 (10:39 -0400)]
console: fix typos and doc
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 5 Mar 2018 20:37:24 +0000 (15:37 -0500)]
tests: niti skips nitpm because it doesn't support curl callbacks
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 5 Mar 2018 15:54:18 +0000 (10:54 -0500)]
tests: updates test for nitpm with new services
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 3 Mar 2018 20:53:20 +0000 (15:53 -0500)]
share: update picnit man page
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 5 Mar 2018 20:56:47 +0000 (15:56 -0500)]
nitpm: tweak -h and -v to please check_manpages.sh
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 4 Mar 2018 21:47:21 +0000 (16:47 -0500)]
nitpm: protect uninstall from deleting parent folders
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 5 Mar 2018 15:54:50 +0000 (10:54 -0500)]
nitpm: uninstall accepts many packages and can be forced
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 4 Mar 2018 20:48:29 +0000 (15:48 -0500)]
nitpm: list packages in alphabetical order
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 3 Mar 2018 23:27:43 +0000 (18:27 -0500)]
nitpm: rename from picnit
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 3 Mar 2018 13:27:03 +0000 (08:27 -0500)]
nitpm: keep going if a package is already installed
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 3 Mar 2018 13:24:49 +0000 (08:24 -0500)]
nitpm/loader: use NITPM_PATH
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 26 Feb 2018 19:22:18 +0000 (14:22 -0500)]
loader: search for the package version declared in package.ini
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 2 Mar 2018 23:51:57 +0000 (18:51 -0500)]
nitpm: recursively install imported packages
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 2 Mar 2018 23:51:45 +0000 (18:51 -0500)]
nitpm: support installing a specific package version
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 3 Mar 2018 21:11:04 +0000 (16:11 -0500)]
nitpm: install packages listed in package.ini by default
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 26 Feb 2018 21:19:09 +0000 (16:19 -0500)]
nitpm: intro service to parse the import line in package.ini
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Romain Chanoir [Wed, 24 Jan 2018 20:37:21 +0000 (21:37 +0100)]
additional tests for `do catch` structure
Signed-off-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Romain Chanoir [Wed, 24 Jan 2018 20:36:46 +0000 (21:36 +0100)]
abstract_compiler: Multi threaded and dynamic `do catch` mecanism
Signed-off-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Alexis Laferrière [Sun, 25 Mar 2018 12:49:59 +0000 (08:49 -0400)]
curl: intro `CurlHTTPRequest::unix_socket_path`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 25 Mar 2018 14:06:38 +0000 (10:06 -0400)]
share: shallow clone bdwgc for Android and iOS
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 25 Mar 2018 12:48:59 +0000 (08:48 -0400)]
curl: cleanup, remove a typo and a callback from C to Nit
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 26 Feb 2018 19:21:47 +0000 (14:21 -0500)]
loader: fix typo in `search_module_by_amodule_name`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Sat, 3 Mar 2018 21:35:57 +0000 (16:35 -0500)]
Merge: Fix regressions in make
* nitc_0 is rebuild when needed
* tools are spited into two groups to lighten the initial build
Close #2619
Pull-Request: #2620
Jean Privat [Sat, 3 Mar 2018 19:30:59 +0000 (14:30 -0500)]
makefile: split tools into 2 groups
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 3 Mar 2018 19:30:13 +0000 (14:30 -0500)]
makefile: force dependency on all .nit file of src
It is a good approximation of tool changes I suppose.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Sat, 3 Mar 2018 19:21:45 +0000 (14:21 -0500)]
makefile: nitc is in ../bin/
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 2 Mar 2018 19:16:56 +0000 (14:16 -0500)]
Merge: Improve lib/html and nitlight
Various improprement in the whole nitlight chain.
Before: nitlight --keep-going -d tmp ../lib/ ../src
* Elapsed (wall clock) time: 28.71
* User time (seconds): 47.25
* System time (seconds): 1.05
* Maximum resident set size (Gbytes): 2.1311
After: nitlight --keep-going -d tmp ../lib/ ../src
* Elapsed (wall clock) time: 22.97 (-20%)
* User time (seconds): 34.42 (-27%)
* System time (seconds): 1.06
* Maximum resident set size (Gbytes): 1.8924 (-11%)
After + new option: nitlight --keep-going -d tmp ../lib/ ../src --no-infobox
* Elapsed (wall clock) time: 10.71 (-63%)
* User time (seconds): 14.49 (-69%)
* System time (seconds): 0.83
* Maximum resident set size (Gbytes): 1.6713 (-20%)
Pull-Request: #2618
Jean Privat [Fri, 2 Mar 2018 15:40:50 +0000 (10:40 -0500)]
src/nitlight: add option --no-infobox
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 2 Mar 2018 15:40:21 +0000 (10:40 -0500)]
src/htmlight: Do not create the whole infobox unless needed
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 2 Mar 2018 14:53:37 +0000 (09:53 -0500)]
lib/core::Text::html_escape: better implementation.
But it is shortcut anyway by the implementation in Flat anyway :(
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 2 Mar 2018 14:51:05 +0000 (09:51 -0500)]
lib/html: really implements Writable::write_to
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 2 Mar 2018 14:50:17 +0000 (09:50 -0500)]
lib/html: use Array as it improve performances
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 1 Mar 2018 19:04:30 +0000 (14:04 -0500)]
Merge: Intro picnit, the (minimal) Nit package manager
picnit is a command line tool to install Nit packages, it supports the following actions:
* `picnit install <package or git-repository>` Install a package by name or from a git-repository
* `picnit list` List installed packages
* `picnit upgrade <package>` Upgrade a package
* `picnit uninstall <package>` Uninstall a package
* `picnit help [command]` Show general help message or the help for a command
The Nit loader has been modified to search for packages where picnit puts them.
You can try picnit with:
~~~
picnit install hello_picnit
picnit list
nit hello_picnit
~~~
The install command clones the Git repo to `~/.local/lib/nit/hello_picnit/` where it will be found by all Nit tools. It can then be interpreted directly by nit (as in the above) or imported by any Nit module.
The server offers only static files, the package.ini renamed for the package (as in hello_picnit.ini). For now, the package list is on my server, so if you want me to add a package, just send me a link to the package.ini! You can see the full list of available packages at https://xymus.net/picnit/.
I'll continue testing and improving picnit by moving gamnit out of the Nit repo and rely on picnit to install it.
Current and planned future features:
- [x] Install from git repository.
- [x] Update, list and uninstall installed packages.
- [x] nitc and others use the installed packages.
- [x] Install by package name, using a centralized server to keep the package.inis.
- [ ] Post install/upgrade hooks: to compile something, suggest installing native libs, etc.
- [ ] A command to show data from the package.ini: issue URL, etc.
- [ ] Centralized server support for unapproved packages, moderation, rating, etc.
- [ ] Advanced search: "Did you mean?" and search in doc of all packages
- [ ] Support nested packages, the git.dir option and more than one package per repo.
- [ ] Detect or declare dependencies of each packages and auto install them.
- [ ] Pin version / branch / tag per project.
- [ ] Windows support.
Pull-Request: #2615
Alexis Laferrière [Thu, 1 Mar 2018 15:00:38 +0000 (10:00 -0500)]
loader: use NIT_TESTING_TESTSSH to ignore picnit packages when testing
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 1 Mar 2018 14:58:28 +0000 (09:58 -0500)]
tests: intro NIT_TESTING_TESTSSH
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 1 Mar 2018 14:42:06 +0000 (09:42 -0500)]
Merge: Tests maintenance for macOS
Update the expected result of `hello_ios` and blacklist two more tests on macOS. Both gettext and mongoc (the failure behind nitweb) are available on macOS, however, they would require some configuration.
Pull-Request: #2617
Jean Privat [Thu, 1 Mar 2018 14:42:04 +0000 (09:42 -0500)]
Merge: inkscape_tools: fix Inkscape version detection on Ubuntu
The regex detecting the Inkscape version was too permissive and expected 3 numbers. This made it wrongly match the revision string on Ubuntu where the version string has only 2 numbers:
`Inkscape 0.91 r13725`
Thanks @BlackMinou!
Pull-Request: #2616
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Jean Privat [Thu, 1 Mar 2018 14:42:02 +0000 (09:42 -0500)]
Merge: Explain failed asserts for easier debugging, error reporting and TDD
When an assert fails, the program prints the details of the failed expression to the console, above the stacktrace. This change makes it easier and even fun to implement methods by writing the tests first and using nitunit to debug.
The AST rewrite can explain binary comparisons (printing the expected and actual values in a similar way to JUnit's `assertEquals`), `not` and `isa` expressions, as well as the receiver and arguments sent to a method returning `Bool`. It does not explain `and` & `or` expressions as they could cause unwanted side-effects in the current implementation.
Example of a method call:
~~~
var x = 0.0
var y = 1.0
assert x.is_approx(y, 0.5)
~~~
Output:
~~~
Runtime assert: 0.0.is_approx(1.0, 0.5)
Runtime error: Assert failed (a.nit:3)
~~~
Expressions are executed only once by assigning each printed values to a variable. The values are then printed via a superstring, inheriting its automatic call to `to_s`.
Example of a binary comparison with a possible side-effect and protected nullable types:
~~~
fun foo(v: nullable Int): nullable Int do
print "foo"
return v
end
assert foo(null) != null
~~~
Output:
~~~
foo
Runtime assert: null != null
Runtime error: Assert failed (b.nit:6)
~~~
---
I don't like that the phase has so many dependencies, but they appeared to be required by `ASTBuilder` which greatly simplify the code and they also help to deal with nullable types. Future work could probably remove some dependencies and work on the pure AST.
This PR may break the reproducibility of some tests, but I have another PR in the works that could fix that.
Pull-Request: #2541
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Alexis Laferrière [Mon, 26 Feb 2018 17:16:32 +0000 (12:16 -0500)]
tests: update Darwin skip list
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 26 Feb 2018 17:16:19 +0000 (12:16 -0500)]
tests: hello_ios now has an empty "assets" folder
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 21 Feb 2018 17:28:52 +0000 (12:28 -0500)]
inkscape_tools: fix Inkscape version detection on Ubuntu
The regex detecting the Inkscape version was too permissive and expected
3 numbers. This make it wrongly match to the revision string on Ubuntu
where the version string has 2 numbers:
Inkscape 0.91 r13725
Reported-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 18 Feb 2018 00:53:53 +0000 (19:53 -0500)]
tests: test picnit
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 17 Feb 2018 23:59:00 +0000 (18:59 -0500)]
share: add picnit manual
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 17 Feb 2018 23:23:55 +0000 (18:23 -0500)]
loader: look for packages installed via picnit
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 17 Feb 2018 21:35:02 +0000 (16:35 -0500)]
picnit: install and update Nit packages from Git repos
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 5 Oct 2017 12:33:35 +0000 (08:33 -0400)]
tests: skip tests failing on timeout or file size limit error by ld
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 5 Oct 2017 12:23:58 +0000 (08:23 -0400)]
nitc: explain asserts only if Array is available, for nitcg
nitcg failed on base.isa.base_isa_vt_gen1.
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 29 Sep 2017 14:06:52 +0000 (10:06 -0400)]
rta: visit the superstring created by explain_assert
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 16 Feb 2018 16:45:45 +0000 (11:45 -0500)]
Merge: Infer more attribute types
Extend the detection of the static type of attributes from their literal values to support three new cases:
* Simple arrays like `[0, 1, 2]` and `[new Set[Int], new Set[Int]]`. However, it does not accept arrays with an explicit type because we can't subtype/anchor at that point, as far as I know.
* Negative integers and floats. This cheats a bit as the return type of the unary - is defined in the core libary. However this should help 99.9% of the time, in particular for Nit beginners, and a workaround is to declare the attribute static type when defining a different kernel library.
* The `once` keyword.
~~~
class A
# Now detected
var i = -1
var f = -1.0
var a = [0, 1]
var o = once [0, 1]
# These are refused
var a1 = [0, 1.0, "a"] # Different types
var a2 = [0, 1: Int] # Can't reliably check subtypes
var a4 = [1+1] # Expression
var o1 = once [0, "a"] # Forwarded error
end
~~~
---
You may want to review commit by commit as the first commit is a small refactoring.
Pull-Request: #2614
Jean Privat [Fri, 16 Feb 2018 16:45:44 +0000 (11:45 -0500)]
Merge: Intro and use `prompt`, an alternative to `readline`
The new package `prompt` offers two basic services to create a shell interface. It does not depend on external libraries and it is licensed under Apache 2.0.
The `prompt` API is optionally implemented by the `readline` package which can be used as a drop-in replacement.
This PR uses `prompt` in nitx to remove the dependency on readline. This dependency would prevent us from compiling Nit on platforms that do not offer the native library, and someone could argue that there are possible legal ramifications in which I would not want to ensnare the Nit project. See the past discussion on GNU readline: #2083
Anyone can still mixin readline with nitx using: `nitc nitx.nit -m readline`
This will also fix the Nit Docker image failing to build: https://hub.docker.com/r/nitlang/nit/builds/
Pull-Request: #2613
Alexis Laferrière [Fri, 16 Feb 2018 16:26:25 +0000 (11:26 -0500)]
Merge branch 'explain-assert' into master
Alexis Laferrière [Thu, 28 Sep 2017 14:38:13 +0000 (10:38 -0400)]
frontend: fix missing location
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 15 Feb 2018 17:58:50 +0000 (12:58 -0500)]
*: remove newly superfluous static types on attributes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 15 Feb 2018 16:24:21 +0000 (11:24 -0500)]
tests: test the new inferrable attribute types
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 15 Feb 2018 16:18:45 +0000 (11:18 -0500)]
model: infer the types of attributes with unary - and once
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 15 Feb 2018 16:18:27 +0000 (11:18 -0500)]
model: infer the array types of attributes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 15 Feb 2018 14:46:44 +0000 (09:46 -0500)]
model: extract infer_static_type to support recursive calls
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 14 Feb 2018 13:34:01 +0000 (08:34 -0500)]
nitin: use `prompt`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 14 Feb 2018 13:25:49 +0000 (08:25 -0500)]
nitx: remove dependency on GNU readline
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 14 Feb 2018 16:11:07 +0000 (11:11 -0500)]
nitx: exit on EOF
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>