nit.git
6 years agonitc & niti: move the duplicated pkg-config checks to the pkgconfig module
Alexis Laferrière [Tue, 23 Jan 2018 18:48:32 +0000 (13:48 -0500)]
nitc & niti: move the duplicated pkg-config checks to the pkgconfig module

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agonitc: document the phase detecting the annots `platform` and `pkgconfig`
Alexis Laferrière [Tue, 23 Jan 2018 14:04:04 +0000 (09:04 -0500)]
nitc: document the phase detecting the annots `platform` and `pkgconfig`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: location: fix located_in behavior
Jean Privat [Fri, 19 Jan 2018 18:09:08 +0000 (13:09 -0500)]
Merge: location: fix located_in behavior

Before this PR, asking if `1,12--1,12` was in `1,1--2,1` returned `false`.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2606

6 years agoMerge: Gamnit: rewrite Android lifecycle support
Jean Privat [Fri, 19 Jan 2018 18:09:07 +0000 (13:09 -0500)]
Merge: Gamnit: rewrite Android lifecycle support

Rewrite much of the Android support to better deal with system state changes. This includes handling out of order lifecycle messages, temporarily invalid OpenGL display surfaces, and recreating the OpenGL context when it is released by the system.

In practice, this PR recreates in `gamnit::gamnit_android` a better version than what is in `android::game`. The old `android::game` could probably be removed with `mnit` and a small clean up.

As a bonus:
* Into portable* services to lock the device orientation. (The iOS variant will be in another PR when #2605 is merged.)
* Ask for 4x antialiasing, it should be available on all target platforms.
* Compile Android apps using gcc, it appears to compile a more stable GC. We can probably tweak a few defines to use clang instead.
* Fix numeric version numbers using the local time, causing surprises when compiled in the cloud.

Pull-Request: #2607

6 years agogamnit: import gamnit_android from android19 for a clear linearisation
Alexis Laferrière [Thu, 18 Jan 2018 00:33:44 +0000 (19:33 -0500)]
gamnit: import gamnit_android from android19 for a clear linearisation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoasteronits, action_nitro & model_viewer: use gamnit::landscape
Alexis Laferrière [Wed, 20 Dec 2017 13:07:58 +0000 (08:07 -0500)]
asteronits, action_nitro & model_viewer: use gamnit::landscape

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: move landscape & portrait from the android package to gamnit
Alexis Laferrière [Fri, 15 Dec 2017 19:54:19 +0000 (14:54 -0500)]
gamnit: move landscape & portrait from the android package to gamnit

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agonitc: use GMT as numeric version instead of local time
Alexis Laferrière [Fri, 29 Dec 2017 17:43:44 +0000 (12:43 -0500)]
nitc: use GMT as numeric version instead of local time

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: request 4x antialiasing
Alexis Laferrière [Wed, 8 Nov 2017 16:59:43 +0000 (11:59 -0500)]
gamnit: request 4x antialiasing

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: rewrite android support
Alexis Laferrière [Tue, 3 Oct 2017 20:15:52 +0000 (16:15 -0400)]
gamnit: rewrite android support

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: differentiate create_display and recreate_gamnit from create_gamnit
Alexis Laferrière [Fri, 3 Nov 2017 18:49:28 +0000 (14:49 -0400)]
gamnit: differentiate create_display and recreate_gamnit from create_gamnit

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: add poll_looper_pause
Alexis Laferrière [Sun, 15 Oct 2017 02:18:07 +0000 (22:18 -0400)]
android: add poll_looper_pause

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: use the gcc toolchain
Alexis Laferrière [Sun, 12 Nov 2017 22:53:25 +0000 (17:53 -0500)]
android: use the gcc toolchain

At this point, using the GCC toolchain compiles a more stable GC.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agolocation: fix located_in behavior
Alexandre Terrasa [Mon, 15 Jan 2018 20:38:03 +0000 (15:38 -0500)]
location: fix located_in behavior

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoMerge: niti: fix constructors with an empty return
Jean Privat [Sat, 13 Jan 2018 16:13:48 +0000 (11:13 -0500)]
Merge: niti: fix constructors with an empty return

fixes #2546

Pull-Request: #2596
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: exec: display system error after failed fork
Jean Privat [Sat, 13 Jan 2018 16:13:47 +0000 (11:13 -0500)]
Merge: exec: display system error after failed fork

This PR modifies `basic_exec_execute` to add a call to `perror` to display the error message before exiting when a fork fails.

Pull-Request: #2603

6 years agotests: remove fixed *fixme* files for niti/constructor
Jean Privat [Fri, 12 Jan 2018 13:51:28 +0000 (08:51 -0500)]
tests: remove fixed *fixme* files for niti/constructor

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agoMerge: core: add `Sequence::get_or_default` and `get_or_null`
Jean Privat [Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)]
Merge: core: add `Sequence::get_or_default` and `get_or_null`

I though these existed. They do but only for `Map`s.

I just wanted to get an optional commande line argument without having to do an if.

~~~nit
# get the 2th command line argument, or else get null
var arg2 = args.get_nor_null(1)
~~~

I'm not fan of the names, but at least they are. If someone have better. Initially, I named it `try`, like `var arg2 = args.try(1)`.

Pull-Request: #2594

6 years agoMerge: benches: add a simple microbenches for nit try/catch
Jean Privat [Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)]
Merge: benches: add a simple microbenches for nit try/catch

It's just the program, not the bench scripts. Maybe also compare with other languages try/catch

Pull-Request: #2595
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

6 years agoMerge: gamnit: bug fixes, updated doc and prepare iOS support
Jean Privat [Fri, 12 Jan 2018 13:34:37 +0000 (08:34 -0500)]
Merge: gamnit: bug fixes, updated doc and prepare iOS support

This PR brings miscellaneous improvements to the `gamnit` graphics framework, see each commit description for more details.

Pull-Request: #2597
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>

6 years agoMerge: Android: fix issues in the audio support
Jean Privat [Fri, 12 Jan 2018 13:34:36 +0000 (08:34 -0500)]
Merge: Android: fix issues in the audio support

Refactor the loading of sounds and music to use the same logic and order, and to fix trying to load invalid resource ids (the errors on 0x00000000). Update the documentation to the currently recommended usage. And close the file descriptors after use/dup.

Pull-Request: #2598

6 years agogamnit: fix parsing .obj models without an explicit object declaration
Alexis Laferrière [Fri, 22 Dec 2017 00:14:02 +0000 (19:14 -0500)]
gamnit: fix parsing .obj models without an explicit object declaration

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agodocker: add zipalign to support compiling Android apps in release mode
Alexis Laferrière [Sat, 9 Dec 2017 20:07:50 +0000 (15:07 -0500)]
docker: add zipalign to support compiling Android apps in release mode

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: print gl_MAX_TEXTURE_SIZE with other driver data
Alexis Laferrière [Sat, 16 Dec 2017 14:56:15 +0000 (09:56 -0500)]
gamnit: print gl_MAX_TEXTURE_SIZE with other driver data

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: fix draw order of the DPad background
Alexis Laferrière [Tue, 12 Dec 2017 04:20:56 +0000 (23:20 -0500)]
gamnit: fix draw order of the DPad background

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: fix doc of `ModelAsset` to represent the current API
Alexis Laferrière [Sun, 17 Dec 2017 15:21:34 +0000 (10:21 -0500)]
gamnit: fix doc of `ModelAsset` to represent the current API

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoexec: display system error after failed fork
Alexandre Terrasa [Thu, 21 Dec 2017 19:17:52 +0000 (14:17 -0500)]
exec: display system error after failed fork

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agogamnit: lapse clock on resume, so `update` ignores the time in the background
Alexis Laferrière [Mon, 4 Dec 2017 18:06:08 +0000 (13:06 -0500)]
gamnit: lapse clock on resume, so `update` ignores the time in the background

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: set resolution at 1080p for splash screens (as the doc says)
Alexis Laferrière [Tue, 17 Oct 2017 00:24:46 +0000 (20:24 -0400)]
gamnit: set resolution at 1080p for splash screens (as the doc says)

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: don't delete uninitialized programs
Alexis Laferrière [Wed, 29 Nov 2017 19:06:11 +0000 (14:06 -0500)]
gamnit: don't delete uninitialized programs

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoglesv2: check for null pointers in glGetString
Alexis Laferrière [Tue, 26 Sep 2017 19:27:07 +0000 (15:27 -0400)]
glesv2: check for null pointers in glGetString

glGetString may return NULL pointers when OpenGL has not been correctly
initialized. This assert makes such errors easier to debug on mobile
devices when there's no stacktrace.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoniti: fix constructors with an empty return
Jean Privat [Wed, 20 Dec 2017 14:20:23 +0000 (09:20 -0500)]
niti: fix constructors with an empty return

fixes #2546

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agobenches: add a simple microbenches for nit try/catch
Jean Privat [Mon, 4 Dec 2017 15:36:16 +0000 (10:36 -0500)]
benches: add a simple microbenches for nit try/catch

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agocore: add `Sequence::get_or_default` and `get_or_null`
Jean Privat [Mon, 4 Dec 2017 13:59:27 +0000 (08:59 -0500)]
core: add `Sequence::get_or_default` and `get_or_null`

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agoMerge: nitx: use doc commands
Jean Privat [Tue, 19 Dec 2017 15:17:37 +0000 (10:17 -0500)]
Merge: nitx: use doc commands

Three things in this PR:
* `nitx` now uses doc-commands (and related cleaning), bye bye the heavy `DocModel` with pre built `DocPages`
* More tests for `nitx`
* Move `nitx` to the `doc` tools suite, the group is now known as `doc::term`

Pull-Request: #2591
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agoMerge: nitweb: use doc-commands
Jean Privat [Tue, 19 Dec 2017 15:17:35 +0000 (10:17 -0500)]
Merge: nitweb: use doc-commands

Migrate nitweb to the doc-commands system.

Changes:
* moved the group to `doc::api`
* use doc-commands (backend and frontend changes)
* limited the size of produced json at the maximum
* API accepts "?pretty" parameter

Pull-Request: #2592
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agocore: fix README for new doc-commands names
Alexandre Terrasa [Tue, 28 Nov 2017 18:28:18 +0000 (13:28 -0500)]
core: fix README for new doc-commands names

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel: move model_json to doc/templates
Alexandre Terrasa [Fri, 10 Nov 2017 20:47:03 +0000 (15:47 -0500)]
model: move model_json to doc/templates

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel/json: fix model json tests after update
Alexandre Terrasa [Wed, 25 Oct 2017 19:31:08 +0000 (15:31 -0400)]
model/json: fix model json tests after update

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agodoc/commands: fix commands json tests after update
Alexandre Terrasa [Wed, 25 Oct 2017 19:30:55 +0000 (15:30 -0400)]
doc/commands: fix commands json tests after update

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitweb: migrate frontend to new json/commands
Alexandre Terrasa [Wed, 25 Oct 2017 19:03:22 +0000 (15:03 -0400)]
nitweb: migrate frontend to new json/commands

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agodoc/api: migrate api to new doc-commands
Alexandre Terrasa [Tue, 28 Nov 2017 18:30:05 +0000 (13:30 -0500)]
doc/api: migrate api to new doc-commands

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitx: use AnsiHighlightVisitor
Alexandre Terrasa [Fri, 8 Dec 2017 20:30:43 +0000 (15:30 -0500)]
nitx: use AnsiHighlightVisitor

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoshare/man: update manpage for the nitx --catalog option
Alexandre Terrasa [Fri, 8 Dec 2017 19:54:55 +0000 (14:54 -0500)]
share/man: update manpage for the nitx --catalog option

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitx: update bin tests
Alexandre Terrasa [Tue, 14 Nov 2017 22:52:46 +0000 (17:52 -0500)]
nitx: update bin tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitx: add command tests
Alexandre Terrasa [Thu, 26 Oct 2017 00:01:49 +0000 (20:01 -0400)]
nitx: add command tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoandroid: update example in audio
Alexis Laferrière [Wed, 18 Oct 2017 19:35:45 +0000 (15:35 -0400)]
android: update example in audio

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: close file descriptors of sound & music after use
Alexis Laferrière [Sat, 16 Dec 2017 17:10:34 +0000 (12:10 -0500)]
android: close file descriptors of sound & music after use

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: refactor music/sounds and fix trying to use invalid music resource
Alexis Laferrière [Wed, 18 Oct 2017 15:04:56 +0000 (11:04 -0400)]
android: refactor music/sounds and fix trying to use invalid music resource

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agonitx: nitx use doc commands
Alexandre Terrasa [Thu, 26 Oct 2017 00:01:31 +0000 (20:01 -0400)]
nitx: nitx use doc commands

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agodoc/commands: parser stores commands usage and help
Alexandre Terrasa [Tue, 7 Nov 2017 19:24:42 +0000 (14:24 -0500)]
doc/commands: parser stores commands usage and help

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel/json: simplify the basic rendering at a maximum level
Alexandre Terrasa [Wed, 25 Oct 2017 19:01:27 +0000 (15:01 -0400)]
model/json: simplify the basic rendering at a maximum level

No more nested objects and cross-references.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitweb: move `web` group to `doc::api`
Alexandre Terrasa [Tue, 28 Nov 2017 18:12:15 +0000 (13:12 -0500)]
nitweb: move `web` group to `doc::api`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel: fix mdoc_or_fallback for nullables types
Alexandre Terrasa [Wed, 25 Oct 2017 19:00:28 +0000 (15:00 -0400)]
model: fix mdoc_or_fallback for nullables types

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agonitweb: allows client to precise ?pretty in request args
Alexandre Terrasa [Thu, 17 Aug 2017 20:32:06 +0000 (16:32 -0400)]
nitweb: allows client to precise ?pretty in request args

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agolib/popcorn: to_json accept serialization parameters
Alexandre Terrasa [Thu, 17 Aug 2017 20:33:33 +0000 (16:33 -0400)]
lib/popcorn: to_json accept serialization parameters

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoMerge: annotations: introduce `example` annotation
Jean Privat [Mon, 4 Dec 2017 14:07:40 +0000 (09:07 -0500)]
Merge: annotations: introduce `example` annotation

## Motivations

When looking at the nit libraries, it's not rare to find external files used only to store examples that cannot be expressed as docunit.

The `example` annotation aims at tag pieces of code that may be considered as examples and thus be:
1. ignored be the compilation tools
2. used by documentation tools (and testing tools)

## Why a new annotation?

Rather than the `examples/` folder convention?

1. Examples can now be included directly in the module code if needed
2. Makes it easier to separate real code example from helper code and example tests
3. More flexibility in project organization and namming
4. To be coherent with the `test` annotation

## How to use it?

Simply tag the MEntity with `example`:

~~~nit
module my_example_module is example
~~~

Can also be applied on classes and methods:

~~~nit
module my_module # is not example

# Abstract class A, we should provide an example of subclass...
# So let's see `ExampleA`.
abstract class A
end

# This class provides an example of how to sublass A.
class ExampleA is example
   super A
end

class C
    # This method provides an example of how to instantiate `A` sublcasses
    fun example_init_a is example do
        var a: A = new ExampleA
    end
end
~~~

## Incoming work

This PR only introduces the annotation and applies it to the existing source code.

Next PR will make tools like nitweb, nitdoc and nitx use it (via commands #2580).

Pull-Request: #2581
Reviewed-by: Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agolib/ai: fix raw code in now tested docunit for puzzle test module
Alexandre Terrasa [Fri, 1 Dec 2017 16:39:38 +0000 (11:39 -0500)]
lib/ai: fix raw code in now tested docunit for puzzle test module

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for model json
Alexandre Terrasa [Thu, 30 Nov 2017 16:32:19 +0000 (11:32 -0500)]
tests: fix tests for model json

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoMerge: highlight with ansi color (for console)
Jean Privat [Thu, 30 Nov 2017 01:50:40 +0000 (20:50 -0500)]
Merge: highlight with ansi color (for console)

Because the nit interactive interpreter and nitx might want it

![capture du 2017-11-29 14-05-07](https://user-images.githubusercontent.com/135828/33395803-abb12fdc-d514-11e7-9921-75a3a1ec00bb.png)

This provides a new `AnsiHighlightVisitor` than can do stuff

Note: colors are currently hard-coded and only comments, keywords, classnames and literals are highlighted. However, since this reuse the full highlighting infrastructure, a lot of semantic things can be added.

Pull-Request: #2593

6 years agonitlight: update manpage
Jean Privat [Thu, 30 Nov 2017 00:51:05 +0000 (19:51 -0500)]
nitlight: update manpage

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agonitlight: add --txt for text-based highlighting
Jean Privat [Wed, 29 Nov 2017 18:48:57 +0000 (13:48 -0500)]
nitlight: add --txt for text-based highlighting

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agohighlight: extract HTML stuff from highlight into htmlight
Jean Privat [Wed, 29 Nov 2017 18:48:16 +0000 (13:48 -0500)]
highlight: extract HTML stuff from highlight into htmlight

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agohighlight: remove useless `self` parameter (some crazy previous refactor?)
Jean Privat [Wed, 29 Nov 2017 19:28:19 +0000 (14:28 -0500)]
highlight: remove useless `self` parameter (some crazy previous refactor?)

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agohighlight: move hightlightcode inside HighlightVisitor
Jean Privat [Wed, 29 Nov 2017 19:27:40 +0000 (14:27 -0500)]
highlight: move hightlightcode inside HighlightVisitor

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agohighlight: rename enter_visit and htmlize (and fix spell of hightlight)
Jean Privat [Wed, 29 Nov 2017 18:44:16 +0000 (13:44 -0500)]
highlight: rename enter_visit and htmlize (and fix spell of hightlight)

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agoMerge: gamnit: new services and a lot of bug fixes and performance improvements
Jean Privat [Wed, 29 Nov 2017 15:40:53 +0000 (10:40 -0500)]
Merge: gamnit: new services and a lot of bug fixes and performance improvements

This PR groups small fixes to gamnit and related packages. It is a general cleanup in preparation for optimizations to the gamnit depth 3D API.

Intro a few new services:
* `ParticleSystem::clear` to remove all live particles.
* `CustomTexture` can be modified and reloaded in GPU memory after the first call to `load`.
* Don't apply dynamic resolution to UI sprites as they are usually lightweight and any change in resolution is easily noticable.

Optimizations:
* Matrix creation and manipulation, in both gamnit and the matrix package.
* Free pixel data from both Nit and Java memory after loading them from the assets folder into the GPU memory.
* Avoids using mallocs in `realtime` services.

Fixes:
* Fix the left and right anchors of the `UICamera`.
* Fix a constant used to ask for antialiasing in the `egl` package.
* Avoid long attribute names in Blinn-Phong shader in case their name is truncated or the attribute is optimized out.
* Fix pointer to the parent GPU texture name in subtextures.
* Improve a few API doc.

Pull-Request: #2586
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agoMerge: android: adaptive icons, free memory on demand and use same package in debug...
Jean Privat [Wed, 29 Nov 2017 15:40:51 +0000 (10:40 -0500)]
Merge: android: adaptive icons, free memory on demand and use same package in debug mode

This PR extends the new Android compilation toolchain:

* Add support for adaptive icons from Android 8 Oreo (and the older `roundIcon`), see https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html. It should detect the icons structure generated by Android Studio 3.

* Tweak the GC compilation options to make it more stable and support releasing memory when the Android system sends the `onLowMemory` message.

* Don't change the app name and package/namespace when compiling in debug mode. While this allowed to easily install both the release and the debug version of the same app on a device, it could be unexpected and it was not compatible with some Google services linked to a precise package name. The old behavior can be reproduced in standard Nit code by using a debug variant like so:
  ~~~
  module asteronits_debug is
      app_name "Asteronits debug"
      app_namespace "org.nitlanguage.asteronits_debug"
  end

  import asteronits
  ~~~

Pull-Request: #2589

6 years agoMerge: tests: force a utf8 locale because gradle don't like pure ascii
Jean Privat [Wed, 29 Nov 2017 15:40:49 +0000 (10:40 -0500)]
Merge: tests: force a utf8 locale because gradle don't like pure ascii

this should fix the CI tests when people with international names make PR.

ref: https://github.com/gradle/gradle/issues/3117

Pull-Request: #2590

6 years agotests: update some sav because uft8 locale
Jean Privat [Wed, 29 Nov 2017 13:52:31 +0000 (08:52 -0500)]
tests: update some sav because uft8 locale

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agotests: force a utf8 locale because gradle don't like pure ascii
Jean Privat [Tue, 28 Nov 2017 15:49:10 +0000 (10:49 -0500)]
tests: force a utf8 locale because gradle don't like pure ascii

this should fix the CI tests when people with international names make PR.

Signed-off-by: Jean Privat <jean@pryen.org>

6 years agotests: fix tests for sort_perf
Alexandre Terrasa [Thu, 23 Nov 2017 16:01:30 +0000 (11:01 -0500)]
tests: fix tests for sort_perf

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for neo
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:40 +0000 (19:35 -0500)]
tests: fix tests for neo

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for nitls
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:36 +0000 (19:35 -0500)]
tests: fix tests for nitls

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for nitdoc
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:30 +0000 (19:35 -0500)]
tests: fix tests for nitdoc

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for nitsmells
Alexandre Terrasa [Wed, 22 Nov 2017 00:35:22 +0000 (19:35 -0500)]
tests: fix tests for nitsmells

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for nitcatalog
Alexandre Terrasa [Wed, 22 Nov 2017 00:29:52 +0000 (19:29 -0500)]
tests: fix tests for nitcatalog

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for nit index
Alexandre Terrasa [Tue, 21 Nov 2017 22:18:18 +0000 (17:18 -0500)]
tests: fix tests for nit index

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix test loader
Alexandre Terrasa [Tue, 21 Nov 2017 22:14:57 +0000 (17:14 -0500)]
tests: fix test loader

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agotests: fix tests for doc commands
Alexandre Terrasa [Tue, 21 Nov 2017 22:10:17 +0000 (17:10 -0500)]
tests: fix tests for doc commands

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoexamples: annotate examples
Alexandre Terrasa [Tue, 26 Sep 2017 23:23:08 +0000 (19:23 -0400)]
examples: annotate examples

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agofrontend: add `is example` test
Alexandre Terrasa [Tue, 21 Nov 2017 18:17:36 +0000 (13:17 -0500)]
frontend: add `is example` test

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel: filter examples from views
Alexandre Terrasa [Wed, 27 Sep 2017 00:02:07 +0000 (20:02 -0400)]
model: filter examples from views

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agofrontend: parse examples annotations
Alexandre Terrasa [Tue, 26 Sep 2017 22:48:09 +0000 (18:48 -0400)]
frontend: parse examples annotations

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agomodel: introduce examples flags
Alexandre Terrasa [Tue, 26 Sep 2017 22:43:32 +0000 (18:43 -0400)]
model: introduce examples flags

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agofrontend: move annotations to check_annotation
Alexandre Terrasa [Tue, 21 Nov 2017 16:39:09 +0000 (11:39 -0500)]
frontend: move annotations to check_annotation

So all core lib can use it.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

6 years agoandroid: kindly ask the GC to do its thing when the OS is low on memory
Alexis Laferrière [Wed, 1 Nov 2017 15:14:12 +0000 (11:14 -0400)]
android: kindly ask the GC to do its thing when the OS is low on memory

bdwgc will try to release some of its memory if compiled with -DUSE_MUNMAP.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: tweak the GC compilation flags
Alexis Laferrière [Sun, 12 Nov 2017 22:54:02 +0000 (17:54 -0500)]
android: tweak the GC compilation flags

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: don't change metadata in debug mode
Alexis Laferrière [Fri, 10 Nov 2017 15:30:23 +0000 (10:30 -0500)]
android: don't change metadata in debug mode

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoandroid: accept adaptive icons and other previous icon formats
Alexis Laferrière [Wed, 15 Nov 2017 16:08:44 +0000 (11:08 -0500)]
android: accept adaptive icons and other previous icon formats

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoperf analysis: customize float precision in reports
Alexis Laferrière [Tue, 14 Nov 2017 16:47:50 +0000 (11:47 -0500)]
perf analysis: customize float precision in reports

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agorealtime: avoid unnecessary mallocs
Alexis Laferrière [Tue, 14 Nov 2017 15:47:25 +0000 (10:47 -0500)]
realtime: avoid unnecessary mallocs

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agorealtime: make native services private
Alexis Laferrière [Tue, 14 Nov 2017 15:46:58 +0000 (10:46 -0500)]
realtime: make native services private

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: don't apply dynamic resolution to UI sprites
Alexis Laferrière [Tue, 21 Nov 2017 19:24:59 +0000 (14:24 -0500)]
gamnit: don't apply dynamic resolution to UI sprites

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: dynamic_resolution_ratio should be writable
Alexis Laferrière [Wed, 8 Nov 2017 16:58:38 +0000 (11:58 -0500)]
gamnit: dynamic_resolution_ratio should be writable

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agogamnit: free images pixel data from RAM after loading it in GPU memory
Alexis Laferrière [Tue, 14 Nov 2017 04:27:45 +0000 (23:27 -0500)]
gamnit: free images pixel data from RAM after loading it in GPU memory

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

6 years agoMerge: nitin FFI seems to work
Jean Privat [Mon, 27 Nov 2017 15:02:56 +0000 (10:02 -0500)]
Merge: nitin FFI seems to work

This adds the bad triple-quoted string and bad extern in the lexer to enable continuing in nitin.
Now FFI seems to work.

~~~raw
-->fun hello `{
...puts("Hello, world");
...`}
-->hello
Hello, world
~~~

Pull-Request: #2587

6 years agoMerge: android: update compiler to use the "new" toolchain
Jean Privat [Mon, 27 Nov 2017 15:02:55 +0000 (10:02 -0500)]
Merge: android: update compiler to use the "new" toolchain

Update the Android support in the compiler to use of the new official Android toolchain based on gradle and CMake, it replaces the old toolchain based on ndk-build and Android.mk files. The use of the new toolchain makes it easier to connect with libraries, it follow the current examples, it is a bit faster to compile, it automatically downloads the SDK files for the target platforms and it has a decent quiet compilation mode!

The new toolchain brings the following changes to the generate Android projects:
* It adds a new project layer above the app layer, this results in moving most of the generated code down in the `app/src/main` folder.
* It moves some settings (API levels, etc.) out of AndroidManifest.xml to a `build.gradle`.
* It replaces the makefiles Android.mk by CMakeLists.txt.

I took advantage of these changes to bring back the GC support for Nit on Android. The new toolchain executes the standard libgc/bdwgc CMakeLists.txt with only small modifications (based on the Unity fork) and the GC works as expected on Android (with thread support). Having a working GC required tweaking some existing Nit code that did not take into account a functioning GC in order to correctly pin references to Nit objects from Java.

I've also updated the full Docker image to support the new toolchain.

Note that the new Android toolchain supports only 64 bits host platforms with Java 8 JDK.

Future work:
* Support more ABIs, incl. arm64 and x86_64, they should be activated only when targetting their minimum supported platform.
* Compile libunwind with its CMakeLists.txt.
* Support adding extra lines to the gradle files, or accept full gradle files from clients.

Pull-Request: #2575
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agoMerge: src/doc: Introduce doc commands
Jean Privat [Fri, 24 Nov 2017 00:16:07 +0000 (19:16 -0500)]
Merge: src/doc: Introduce doc commands

There is 3 doc related tools:
* nitdoc
* nitweb
* nitx

Each tool currently uses an ad-hoc way to explore the model, retrieve and present the results.

This PR aims at unifying the process between all the documentation tools by providing a unique API to explore model and entities.

A `DocCommand` represents a query to perform on the model.
Since a command can be used by a wide variety of clients, initialization of DocCommands works in two steps.

First, you pass the data you already have to the command at init:
~~~nit
# var c1 = new CmdEntity(view, mentity_name = "Array")
# var c2 = new CmdEntity(view, mentity = my_entity)
~~~

Then, you call `init_command` to initialize the missing field from the stub data:
~~~nit
var r1 = c1.init_command
assert c1.mentity != null
assert r1 isa CmdSuccess

var r2 = c2.init_command
assert c2.mentity_name != null
assert r2 isa CmdSuccess
~~~

There is a variety of commands that can be used to fulfill the tool objectives:
* `commands_model`: commands related to model and entities
* `commands_catalog`: commands related to catalog and statistics
* `commands_graph`: commands related to visual representations
* `commands_usage`: commands related to classes and methods usage
* `commands_docdown`: commands related to MDoc parsing and markdown features

To make the integration with tools easier some features are added in:
* `commands_parser`: parse commands from string such as `graph: array | pdepth: 1`
* `commands_http`: initialize commands options from HTTP requests

Rendering options:
* `commands_json`: render the command results as JSON
* `commands_html`: render the command results as HTML

A lot of examples can be found in the test modules.

Pull-Request: #2580
Reviewed-by: Jean Privat <jean@pryen.org>

6 years agonitin: add FFI example in the README
Jean Privat [Thu, 23 Nov 2017 20:45:09 +0000 (15:45 -0500)]
nitin: add FFI example in the README

Signed-off-by: Jean Privat <jean@pryen.org>