Alexis Laferrière [Tue, 9 Aug 2016 14:18:33 +0000 (10:18 -0400)]
calculator: add scientific variant fdroid metadata
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 11 Aug 2016 17:42:56 +0000 (13:42 -0400)]
lib/core: add `Path::/`
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Thu, 11 Aug 2016 12:45:20 +0000 (08:45 -0400)]
serialization: better doc for `Deserializer`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 11 Aug 2016 11:38:16 +0000 (07:38 -0400)]
json::serialization: intro `attributes_path` as support to `class_name_heuristic`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Thu, 11 Aug 2016 01:53:50 +0000 (21:53 -0400)]
Merge: nitweb: use pop_config
Nitweb use popconfig
No changes on the output.
Pull-Request: #2247
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 11 Aug 2016 01:53:18 +0000 (21:53 -0400)]
Merge: nitcorn: support the special address 0.0.0.0
This PR automates assigning virtual hosts on `0.0.0.0` as the `default_virtual_host`, a fallback for all request not intercepted by other virtual hosts.
It is an imperfect temporary solution as the virtual host on 0.0.0.0:80 may receive requests from other ports, and there can be only one functional virtual host on all interfaces. A better solution would involve rewriting `ConnectionListener::bind_to` and splitting it up in many services to keep the address and socket associated to a virtual host.
Pull-Request: #2250
Reviewed-by: Jean-Philippe Caissy <jpcaissy@piji.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 11 Aug 2016 00:52:56 +0000 (20:52 -0400)]
nitcc: lexer can produce a single token with `next_token`
Signed-off-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Wed, 10 Aug 2016 19:42:21 +0000 (15:42 -0400)]
nitweb: update tests
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 9 Aug 2016 01:49:55 +0000 (21:49 -0400)]
nitweb: use config file
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 2 Aug 2016 18:08:33 +0000 (14:08 -0400)]
nitweb: factorize catalog building
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 20 Jul 2016 19:41:17 +0000 (15:41 -0400)]
nitweb: factorize APIRouter
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 2 Aug 2016 03:25:38 +0000 (23:25 -0400)]
nitweb: fix typo in help message
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexis Laferrière [Sun, 19 Jun 2016 13:08:31 +0000 (09:08 -0400)]
nitcorn: update address used and style of main doc example
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jun 2016 13:04:05 +0000 (09:04 -0400)]
nitcorn: register 0.0.0.0 addresses as default_virtual_host
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 19 Jun 2016 12:58:18 +0000 (08:58 -0400)]
nitcorn: default_virtual_host should be writable
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 10 Aug 2016 13:44:15 +0000 (09:44 -0400)]
docker: hotfix image name
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 23:46:26 +0000 (19:46 -0400)]
Merge: new class MErrorType to handle buggy types
This is a small cleanup of some part of the code of the model.
The main improvement is the addition of a `MErrorType` class and two somewhat related services `MType::is_ok` and `MType::is_legal_in`.
Beside a better model and better services, this changeset clean the quickfix introduced in RTA (see #2245 )
There should be no change in the overall performance.
Pull-Request: #2248
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 9 Aug 2016 23:46:24 +0000 (19:46 -0400)]
Merge: docker: move the test part in another Dockerfile
We have a lot of timeout with a big Dockerfile
Pull-Request: #2249
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Tue, 9 Aug 2016 18:20:17 +0000 (14:20 -0400)]
docker: move the test part in another Dockerfile
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 16:43:06 +0000 (12:43 -0400)]
Merge: Text API
This PR aims to make the `Text` superclass more usable.
Some methods that were only present in `String` have been moved to `Text`, where they keep their copy semantics.
This allows any client to concatenate or multiply any `Text` object.
Also, some convenience methods have been added to `Buffer`, like `insert_at` or `remove_at`.
Note that these methods ~~can~~ **will** be slow since they modify everything in-place and cause shifting the contents of a `Buffer`.
Also, the `RopeBuffer` experimental class was removed from lib since it is not faster than a regular `FlatBuffer` and added extra burden when making changes to the `Text` block.
Pull-Request: #2223
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 15:19:21 +0000 (11:19 -0400)]
rta: drop local `is_valid_type` and use `is_legal_in` from `model`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 15:17:53 +0000 (11:17 -0400)]
model: add `MType::is_legal_in` to check the legality of a given complex type
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 15:16:08 +0000 (11:16 -0400)]
model: returns more MErrorType instead of aborting
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 15:15:21 +0000 (11:15 -0400)]
model: add MType::is_ok to check MErrorType in depth
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 15:13:28 +0000 (11:13 -0400)]
model: new class MErrorType as using MBottomType was abuse
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 01:18:27 +0000 (21:18 -0400)]
Merge: Faster lookup
This series improves the lookup strategies:
* special fast track for the virtual type SELF
* choose to iterate on the mclassdefs instead of the mpropdefs if they are less numerous.
This mainly limit the degenerative cases that where discovered while investigating the slowdown of #2223
with nitc/nitc/nitc:
before: 0m7.168s
after: 0m6.232s
with nitpick ../contrib:
before: 0m20.928s
after: 0m19.432s
Pull-Request: #2245
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Tue, 9 Aug 2016 01:17:58 +0000 (21:17 -0400)]
Merge: popcorn: enhance ConsoleLog
Add some logger capabilities to ConsoleLog so it can be shared with the rest of the popcorn app as a classic logger.
Pull-Request: #2244
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 01:17:55 +0000 (21:17 -0400)]
Merge: Popcorn auth
## Authentification handlers.
For now, only Github OAuth is provided.
### Github
See https://developer.github.com/v3/oauth/.
This module provide 4 base classes that can be used to implement a Github
OAuth handshake.
~~~nit
import popcorn
import popcorn::pop_auth
var client_id = "github client id"
var client_secret = "github client secret"
var app = new App
app.use("/login", new GithubLogin(client_id))
app.use("/oauth", new GithubOAuthCallBack(client_id, client_secret))
app.use("/logout", new GithubLogout)
app.listen("localhost", 3000)
~~~
Optionaly, you can use the `GithubUser` handler to provide access to the
Github user stored in session:
~~~nit
app.use("/api/user", new GithubUser)
~~~
Pull-Request: #2238
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 9 Aug 2016 00:44:00 +0000 (20:44 -0400)]
rta: fast fix to avoid resolving illegal types.
This requires a more in-depth work to improve the model.
Another improvement can also to teach RTA the context of object mechanism
so that only legal receivers are attempted.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:24:05 +0000 (18:24 -0400)]
Merge: lib/github: introduce GithubWallet
## Github OAuth tokens management
When using batch mode with the `github` API, we can rapidly reach the rate
limit allowed by Github.
One solution consists in using a wallet of tokens so we can rely on more than
one token and switch them when one become exhausted.
### Using the Github wallet to check tokens
One functionality of the wallet is to check the validity of a token against
the API. `check_token` will return false if a token is invalid or exhausted.
~~~nit
var wallet = new GithubWallet
assert not wallet.check_token("this is a bad token")
~~~
### Storing tokens
The wallet can also be used to store tokens and check all of them.
~~~nit
wallet = new GithubWallet
wallet.add "some token"
wallet.add "some other token"
~~~
or
~~~nit
wallet = new GithubWallet.from_tokens(["token 1", "token 2"])
~~~
The `show_status` method can be used to display a summary of the validity of
each token in the wallet.
~~~nit
wallet.show_status
~~~
Will display something like this:
~~~raw
Wallet (2 tokens):
* [OK] token 1
* [KO] token 2
~~~
### Using the wallet to obtain a Github API client
Using the wallet you can cycle through tokens and obtain a new Github API client
instance with a fresh rate limit.
~~~nit
wallet = new GithubWallet.from_tokens(["token 1", "token 2"])
var api = wallet.api
~~~
The wallet will automatically cycle through the registered tokens to find one
that works.
To avoid infinite loop, if not valid token is found after all of them was tried,
the wallet returns an client based on the last tried token.
Pull-Request: #2243
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:24:03 +0000 (18:24 -0400)]
Merge: gamnit: intro pinch to zoom gesture for Android
Intro a service to manipulate the perspective cameras with two fingers gestures: move the camera and the classic pinch to zoom.
This feature mainly targets the `flat` API. It should also somewhat work with `depth`, even when the camera looks around, but the fingers won't fit precisely with a world object/layer.
Pull-Request: #2242
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:23:52 +0000 (18:23 -0400)]
Merge: Popcorn repos
## Repositories for data management.
Repositories are used to apply persistence on instances (or **documents**).
Using repositories one can store and retrieve instance in a clean and maintenable
way.
This module provides the base interface `Repository` that defines the persistence
services available in all kind of repos.
`JsonRepository` factorizes all repositories dedicated to Json data or objects
serializable to Json.
`MongoRepository` is provided as a concrete example of repository.
It implements all the services from `Repository` using a Mongo database as backend.
Repositories can be used in Popcorn app to manage your data persistence.
Here an example with a book management app:
~~~nit
# First we declare the `Book` class. It has to be serializable so it can be used
# within a `Repository`.
import popcorn
import popcorn::pop_repos
# Serializable book representation.
class Book
serialize
super Jsonable
# Book uniq ID
var id: String = (new MongoObjectId).id is serialize_as "_id"
# Book title
var title: String
# ... Other fields
redef fun to_s do return title
redef fun ==(o) do return o isa SELF and id == o.id
redef fun hash do return id.hash
redef fun to_json do return serialize_to_json
end
# We then need to subclass the `MongoRepository` to provide Book specific services.
# Book repository for Mongo
class BookRepo
super MongoRepository[Book]
# Find books by title
fun find_by_title(title: String): Array[Book] do
var q = new JsonObject
q["title"] = title
return find_all(q)
end
end
# The repository can be used in a Handler to manage book in a REST API.
class BookHandler
super Handler
var repo: BookRepo
# Return a json array of all books
#
# If the get parameters `title` is provided, returns a json array of books
# matching the `title`.
redef fun get(req, res) do
var title = req.string_arg("title")
if title == null then
res.json new JsonArray.from(repo.find_all)
else
res.json new JsonArray.from(repo.find_by_title(title))
end
end
# Insert a new Book
redef fun post(req, res) do
var title = req.string_arg("title")
if title == null then
res.error 400
return
end
var book = new Book(title)
repo.save book
res.json book
end
end
# Let's wrap it all together in a Popcorn app:
# Init database
var mongo = new MongoClient("mongodb://localhost:27017/")
var db = mongo.database("tests_app_{100000.rand}")
var coll = db.collection("books")
# Init app
var app = new App
var repo = new BookRepo(coll)
app.use("/books", new BookHandler(repo))
app.listen("localhost", 3000)
~~~
Pull-Request: #2241
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:23:50 +0000 (18:23 -0400)]
Merge: Popcorn valid
## Quick and easy validation framework for Json inputs
Validators can be used in Popcorn apps to valid your json inputs before
data processing and persistence.
Here an example with a Book management app. We use an ObjectValidator to validate
the books passed to the API in the `POST /books` handler.
~~~nit
import popcorn
import serialization
# Serializable book representation.
class Book
super Jsonable
# Book ISBN
var isbn: String
# Book title
var title: String
# Book image (optional)
var img: nullable String
# Book price
var price: Float
end
class BookValidator
super ObjectValidator
redef init do
add new ISBNField("isbn")
add new StringField("title", min_size=1, max_size=255)
add new StringField("img", required=false)
add new FloatField("price", min=0.0, max=999.0)
end
end
class BookHandler
super Handler
# Insert a new Book
redef fun post(req, res) do
var validator = new BookValidator
if not validator.validate(req.body) then
res.json_error(validator.validation, 400)
return
end
# TODO data persistence
end
end
~~~
Pull-Request: #2240
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:23:47 +0000 (18:23 -0400)]
Merge: lib/popcorn: introduce `pop_config` module
## Configuration file and options for Popcorn apps
`pop_config` provide a configuration framework for Popcorn apps based on ini
files.
By default `AppConfig` provides `app.host` and `app.port` keys, it's all we
need to start an app:
~~~nit
import popcorn
import popcorn::pop_config
# Parse app options
var opts = new AppOptions.from_args(args)
# Build config from options
var config = new AppConfig.from_options(opts)
# Use options
var app = new App
app.listen(config.app_host, config.app_port)
~~~
For more advanced uses, `AppConfig` and `AppOptions` can be specialized to
offer additional config options:
~~~nit
import popcorn
import popcorn::pop_config
class MyConfig
super AppConfig
# My secret code I don't want to share in my source repository
var secret: String = value_or_default("secret", "my-secret")
redef init from_options(options) do
super
if options isa MyOptions then
var secret = options.opt_secret.value
if secret != null then self["secret"] = secret
end
end
end
class MyOptions
super AppOptions
var opt_secret = new OptionString("My secret string", "--secret")
redef init do
super
add_option opt_secret
end
end
class SecretHandler
super Handler
# Config to use to access `secret`
var config: MyConfig
redef fun get(req, res) do
res.send config.secret
end
end
var opts = new MyOptions.from_args(args)
var config = new MyConfig.from_options(opts)
var app = new App
app.use("/secret", new SecretHandler(config))
app.listen(config.app_host, config.app_port)
~~~
Pull-Request: #2239
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:23:42 +0000 (18:23 -0400)]
Merge: Serialization fixes and hardening
Improve the serialization services on multiple points:
* Fix JSON serialization of `DefaultMap` by writing its attributes. (Not only the "special" length, keys and values)
* Remove type casts and the like that would crash the program on invalid format of collections and maps, raise errors instead and return an empty instance.
* Improve (from horrible to bad) the type name used in deserialization errors when the type of an attribute is not in the AST. (This is pretty much the best we can do without moving the serialization phase after the model has been built.)
* Fix a test which failed on silent errors, and print errors so it doesn't happen again. Note that the errors with nitce are expected as it doesn't have the same `class_name` than the other engines.
* Update nitserial to silence `property-conflict` warnings in the generated module. This effectively hides the conflicts between the JSON and binary serialization because all conflicts are on generic types.
Pull-Request: #2234
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 22:23:40 +0000 (18:23 -0400)]
Merge: `mendel_metrics`: Fix documentation
Some minor fixes for the documentation of the `mendel_metrics` module.
Pull-Request: #2230
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Mon, 8 Aug 2016 20:19:27 +0000 (16:19 -0400)]
tests: update sav of `test_binary_deserialization`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexandre Terrasa [Mon, 8 Aug 2016 19:45:18 +0000 (15:45 -0400)]
lib/popcorn: introduce Github Auth handlers
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 2 Aug 2016 17:39:28 +0000 (13:39 -0400)]
github_api: load user from access_token
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 8 Aug 2016 19:26:45 +0000 (15:26 -0400)]
lib/popcorn: introduce `pop_config` module
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Mon, 8 Aug 2016 17:39:00 +0000 (13:39 -0400)]
model: MVirtualType fast resolution for the special type `SELF`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 17:37:18 +0000 (13:37 -0400)]
model: lookup_definitions gains an *iterate the classdefs* strategy
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 17:35:38 +0000 (13:35 -0400)]
model: MClassDef register property definitions by its associated property
Signed-off-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Mon, 8 Aug 2016 19:11:07 +0000 (15:11 -0400)]
popcorn: enhance ConsoleLog
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 8 Aug 2016 19:08:28 +0000 (15:08 -0400)]
lib/github: introduce GithubWallet
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Fri, 5 Aug 2016 17:56:13 +0000 (13:56 -0400)]
lib/popcorn: introduce Repository concept
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Mon, 8 Aug 2016 16:44:57 +0000 (12:44 -0400)]
lib/mongodb: allow new MongoObjectId instances
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Mon, 8 Aug 2016 14:35:10 +0000 (10:35 -0400)]
Merge: mongodb: wrap `Collection::aggregate` function
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2237
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 14:35:08 +0000 (10:35 -0400)]
Merge: lib/popcorn: generalize colors for status codes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2236
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 14:35:03 +0000 (10:35 -0400)]
Merge: modelize_class: Force `Object` to be an interface
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Pull-Request: #2235
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 14:35:00 +0000 (10:35 -0400)]
Merge: modelize_class: Remove an unnecessary pre-condition
`build_classes` calls itself recursively on imported modules. So, there is no point to specify that imported modules must be processed first.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Pull-Request: #2233
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 8 Aug 2016 14:34:56 +0000 (10:34 -0400)]
Merge: modelize_class: Remove a dead check
Dead at aa64312 (PR #2047).
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Pull-Request: #2232
Reviewed-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Sun, 7 Aug 2016 16:41:47 +0000 (12:41 -0400)]
gamnit: flat imports android_two_fingers_motion with android
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 7 Aug 2016 13:59:15 +0000 (09:59 -0400)]
gamnit: intro two fingers motion service on EulerCamera
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexandre Terrasa [Fri, 5 Aug 2016 19:30:56 +0000 (15:30 -0400)]
lib/popcorn: generalize colors for status codes
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 4 Aug 2016 04:53:22 +0000 (00:53 -0400)]
lib/popcorn: introduce Validation concept
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 4 Aug 2016 04:53:54 +0000 (00:53 -0400)]
lib/popcorn: add `json_error` to return a Json formatted error
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean-Christophe Beaupré [Thu, 4 Aug 2016 16:39:53 +0000 (12:39 -0400)]
modelize_class: Do not crash if `Pointer` is not defined
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean-Christophe Beaupré [Thu, 4 Aug 2016 16:38:53 +0000 (12:38 -0400)]
modelize_class: Force `Object` to be an interface
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Alexis Laferrière [Thu, 4 Aug 2016 16:33:55 +0000 (12:33 -0400)]
json::serialization: report duplicated keys
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean-Christophe Beaupré [Thu, 4 Aug 2016 16:32:56 +0000 (12:32 -0400)]
Add a test for the class kind of `Object`
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Alexis Laferrière [Thu, 4 Aug 2016 14:40:05 +0000 (10:40 -0400)]
tests: report deserialization errors
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 14:39:52 +0000 (10:39 -0400)]
tests: fix deserialization test on pretty json with generics
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:44:04 +0000 (09:44 -0400)]
nitserial: silence property-conflict warning in generated module
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:43:29 +0000 (09:43 -0400)]
lib/gen_nit: support writing annotations of the module declaration
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 14:21:08 +0000 (10:21 -0400)]
json::serialization: check format and consistency of Map at deserialization
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 14:20:42 +0000 (10:20 -0400)]
json::serialization: don't crash on deserializing malformed simple collections
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:41:03 +0000 (09:41 -0400)]
json::serialization: fix indentation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:38:49 +0000 (09:38 -0400)]
json::serialization: fix serializing extra attributes of collections and maps
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:37:53 +0000 (09:37 -0400)]
json::serialization: refactor some duplicated code
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 14:53:37 +0000 (10:53 -0400)]
frontend: use a prettier "Unknown type" when the type is not in the AST
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 14:22:34 +0000 (10:22 -0400)]
serialization: AttributeTypeError doesn't need the message attribute, fix TODO
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 4 Aug 2016 13:45:11 +0000 (09:45 -0400)]
frontend: don't type check values for attributes typed with `nullable Object`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Wed, 3 Aug 2016 16:38:46 +0000 (12:38 -0400)]
Merge: app.nit: improve apps life-cycle
Modify the _app.nit_ life-cycle callbacks to add `on_restart`, and to remove `on_start` and `on_destroy`. `on_restart` is called when the app goes comes back from a `on_stop`. `on_start` duplicated other callbacks (`on_create` and the new `on_restart`), plus it didn't have a direct equivalent in iOS. `on_destroy` also didn't have an iOS equivalent. These changes simplify the life-cycle and use only callbacks existing on both platforms.
This PR also improves the documentation of the _app.nit_ life-cycle with a nice little graph and references to the platform specific triggers.
Pull-Request: #2229
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Jean Privat [Wed, 3 Aug 2016 16:38:43 +0000 (12:38 -0400)]
Merge: app.nit: Intro the `app_files` annotation, and use it in calculator
Intro `app_files`, an annotation to specify where to find more Android and iOS specific files. This effectively associates resources to a specific Nit module. It can be used to have different icons per branding, or to package graphical assets with a module from the lib.
It is used in the calculator to assign a different icon to the scientific calculator variant.
Pull-Request: #2228
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Jean Privat [Wed, 3 Aug 2016 16:38:33 +0000 (12:38 -0400)]
Merge: Android: import the R class
The R class is generated by the Android toolchain and acts as a static way to identify resources in Java code. The ID of each values from the `android/res` folder is sorted in a category and accessible through a static field. An example of a generated R class is shown at the bottom of this description.
This PR import the R class in all Java classes generated from the Java FFI. This creates a similar effect as having the R class in the same package. Previously, the user could not reliably import the R class manually as the package name changes between the debug and release version.
~~~
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package net.xymus.benitlux_debug;
public final class R {
public static final class attr {
}
public static final class color {
public static final int item_background=0x7f050000;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final int icon=0x7f020001;
public static final int notif=0x7f020002;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
}
}
~~~
Pull-Request: #2227
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Jean Privat [Wed, 3 Aug 2016 16:38:26 +0000 (12:38 -0400)]
Merge: nitweb: show metrics
This PR introduce the metrics displaying in nitweb.
For now, only classes and modules metrics are shown (mclass_metrics.nit, mmodules_metrics.nit, inheritance_metrics.nit).
Some examples (may be long to load on my little server):
* [core::Array](http://nitweb.moz-code.org/doc/core::Array)
* [core::array](http://nitweb.moz-code.org/doc/core::array)
* [core>collection>](http://nitweb.moz-code.org/doc/core%3Ecollection%3E)
* [core](http://nitweb.moz-code.org/doc/core)
Pull-Request: #2219
Reviewed-by: Jean Privat <jean@pryen.org>
Jean-Christophe Beaupré [Tue, 2 Aug 2016 17:32:15 +0000 (13:32 -0400)]
modelize_class: Remove a dead check
Dead at
aa6431294837f7a4734f8b73c2559404b416c924 (PR #2047).
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean-Christophe Beaupré [Tue, 2 Aug 2016 19:49:17 +0000 (15:49 -0400)]
mendel_metrics: Fix the bibliographical reference
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean-Christophe Beaupré [Wed, 13 Jul 2016 16:26:30 +0000 (12:26 -0400)]
mendel_metrics: Fix a spelling mistake
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Jean-Christophe Beaupré [Tue, 2 Aug 2016 18:09:49 +0000 (14:09 -0400)]
modelize_class: Remove an unnecessary pre-condition
`build_classes` calls itself recursively on imported modules. So, there is
no point to specify that imported modules must be processed first.
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Alexis Laferrière [Fri, 29 Jul 2016 18:38:38 +0000 (14:38 -0400)]
linux: update lifecycle
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 29 Jul 2016 15:49:24 +0000 (11:49 -0400)]
app.nit: document platform specific triggers for each app.nit callbacks
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 29 Jul 2016 13:18:36 +0000 (09:18 -0400)]
app.nit: update README and add graph image
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 28 Jul 2016 20:14:04 +0000 (16:14 -0400)]
lib & contrib: remove references to on_start and on_destroy
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 29 Jul 2016 12:59:29 +0000 (08:59 -0400)]
android: call on_restart
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 28 Jul 2016 20:14:39 +0000 (16:14 -0400)]
lib/ios: update lifecycle
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 29 Jul 2016 12:55:00 +0000 (08:55 -0400)]
app.nit: intro `on_restart`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 28 Jul 2016 20:13:23 +0000 (16:13 -0400)]
app.nit & android: move on_create & on_destroy to Android only
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 17:12:07 +0000 (13:12 -0400)]
benitlux: fix typo in `ItemView::set_background`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 13:37:27 +0000 (09:37 -0400)]
calculator: separate Android variants between the simple calc and the sci one
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 13:29:28 +0000 (09:29 -0400)]
calculator: have a different icon and app name for the scientific variant
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 13:36:11 +0000 (09:36 -0400)]
calculator: shorter name and bump up the version number
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 13:08:50 +0000 (09:08 -0400)]
calculator: name icon rules to real files
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 13:07:42 +0000 (09:07 -0400)]
calculator: move `scientific_calculator` to its own folder `scientific`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 03:22:20 +0000 (23:22 -0400)]
iOS: use `app_files`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 03:09:47 +0000 (23:09 -0400)]
Android: use `app_files` to find android specific files
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 01:51:59 +0000 (21:51 -0400)]
Android: move up assets and resources logic
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 01:53:29 +0000 (21:53 -0400)]
Android & iOS: collect the arguments from the `app_files` annotation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 22 Jul 2016 01:52:47 +0000 (21:52 -0400)]
lib: intro and doc the `app_files` annotation
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>