Alexandre Terrasa [Sun, 14 Jul 2019 16:55:45 +0000 (12:55 -0400)]
doc: Rename `synopsys` into `synopsis`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Wed, 3 Jul 2019 18:50:57 +0000 (14:50 -0400)]
Merge: nitrpg: Move `nitrpg` to its own repository
`nitrpg` is broken since a long time. I think https:/api.github.com actually changed twice since it broke. I don't plan on killing it yet but I moved it to its own repository until I worked again on it (or never).
See https://github.com/Morriar/nitrpg.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Pull-Request: #2755
Jean Privat [Wed, 3 Jul 2019 18:50:53 +0000 (14:50 -0400)]
Merge: Mock Github API tests
This PR adds a mock to GithubAPI so we can avoid sending requests to the API on CI.
For each API call we save the actual Github response body from the API and reuse it during the tests.
The attribute `update_responses_cache` can be set to `true` so the cache files are updated from the API when `nitunit` is called.
Pull-Request: #2753
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 3 Jul 2019 18:50:48 +0000 (14:50 -0400)]
Merge: Follow the INI specification
This version follows more closely the INI specification (https://en.wikipedia.org/wiki/INI_file) and adds some improvements to the API.
Spec changes:
* Allow `#` and `;` for comments
* No more sections nesting as by the spec (which actually change nothing see below)
API changes:
* Renaming `ConfigTree` -> `IniFile` (as it's no more a "tree")
* No more coupling with a file path, use utility methods `load_string`, `load_file`, `write_to` instead
* Ability to iterate keys, values, sections and section content
* Ability to create `IniSection` by hand
* `IniFile` and `IniSection` implements `Map[String, nullable String]`
The biggest change is that sub-sections are now flattened.
Before, with the following ini:
~~~ini
[section1]
key1=value1
[section1.section2]
key2=value2
~~~
You would get this hierarchy:
~~~
section1
| key1=value1
`- section2
`- key2=value2
~~~
Now you get:
~~~
section1
`- key1=value1
section1.section2
`- key2=value2
~~~
Two independent (unnested) sections, one called `section1` and the other called `section1.section2`.
This actually change nothing if the client was using the `[]` operator with the `.` notation as:
~~~
ini["section1.section2.key2"] # still returns `value2`
~~~
Documentation and specification from the README:
# `ini` - Read and write INI configuration files
[INI files](https://en.wikipedia.org/wiki/INI_file) are simple text files with
a basic structure composed of sections, properties and values used to store
configuration parameters.
Here's an example from the `package.ini` of this package:
~~~nit
import ini
var package_ini = """
[package]
name=ini
desc=Read and write INI configuration files.
[upstream]
git=https://github.com/nitlang/nit.git
git.directory=lib/ini/
"""
~~~
## Basic usage
`IniFile` is used to parse INI strings and access their content:
~~~nit
var ini = new IniFile.from_string(package_ini)
assert ini["package.name"] == "ini"
assert ini["upstream.git.directory"] == "lib/ini/"
assert ini["unknown.unknown"] == null
~~~
`IniFile` can also load INI configuration from a file:
~~~nit
package_ini.write_to_file("my_package.ini")
ini = new IniFile.from_file("my_package.ini")
assert ini["package.name"] == "ini"
assert ini["upstream.git.directory"] == "lib/ini/"
"my_package.ini".to_path.delete
~~~
INI content can be added or edited through the `IniFile` API then written to
a stream or a file.
~~~nit
ini["package.name"] = "new name"
ini["upstream.git.directory"] = "/dev/null"
ini["section.key"] = "value"
var stream = new StringWriter
ini.write_to(stream)
assert stream.to_s == """
[package]
name=new name
desc=Read and write INI configuration files.
[upstream]
git=https://github.com/nitlang/nit.git
git.directory=/dev/null
[section]
key=value
"""
~~~
## INI content
### Properties
Properties are the basic element of the INI format.
Every property correspond to a *key* associated to a *value* thanks to the equal (`=`) sign.
~~~nit
ini = new IniFile.from_string("""
key1=value1
key2=value2
""")
assert ini["key1"] == "value1"
assert ini["key2"] == "value2"
assert ini.length == 2
~~~
Accessing an unknown property returns `null`:
~~~nit
assert ini["unknown"] == null
~~~
Properties can be iterated over:
~~~nit
var i = 1
for key, value in ini do
assert key == "key{i}"
assert value == "value{i}"
i += 1
end
~~~
Property keys cannot contain the character `=`.
Values can contain any character.
Spaces are trimmed.
~~~nit
ini = new IniFile.from_string("""
prop=erty1=value1
property2 = value2
property3=value3 ; with semicolon
""")
assert ini[";property1"] == null
assert ini["prop=erty1"] == null
assert ini["prop"] == "erty1=value1"
assert ini["property2"] == "value2"
assert ini[" property2 "] == "value2"
assert ini["property3"] == "value3 ; with semicolon"
~~~
Both keys and values are case sensitive.
~~~nit
ini = new IniFile.from_string("""
Property1=value1
property2=Value2
""")
assert ini["property1"] == null
assert ini["Property1"] == "value1"
assert ini["property2"] != "value2"
assert ini["property2"] == "Value2"
~~~
### Sections
Properties may be grouped into arbitrary sections.
The section name appears on a line by itself between square brackets (`[` and `]`).
All keys after the section declaration are associated with that section.
The is no explicit "end of section" delimiter; sections end at the next section
declaration or the end of the file.
Sections cannot be nested.
~~~nit
var content = """
key1=value1
key2=value2
[section1]
key1=value3
key2=value4
[section2]
key1=value5
"""
ini = new IniFile.from_string(content)
assert ini["key1"] == "value1"
assert ini["unknown"] == null
assert ini["section1.key1"] == "value3"
assert ini["section1.unknown"] == null
assert ini["section2.key1"] == "value5"
~~~
Sections can be iterated over:
~~~nit
i = 1
for section in ini.sections do
assert section.name == "section{i}"
assert section["key1"].has_prefix("value")
i += 1
end
~~~
When iterating over a file properties, only properties at root are returned.
`flatten` can be used to iterate over all properties including the one from
sections.
~~~nit
assert ini.join(", ", ": ") == "key1: value1, key2: value2"
assert ini.flatten.join(", ", ": ") ==
"key1: value1, key2: value2, section1.key1: value3, section1.key2: value4, section2.key1: value5"
i = 0
for key, value in ini do
i += 1
assert key == "key{i}" and value == "value{i}"
end
assert i == 2
~~~
Sections name may contain any character including brackets (`[` and `]`).
Spaces are trimmed.
~~~nit
ini = new IniFile.from_string("""
[[section1]]
key=value1
[ section 2 ]
key=value2
[section1.section3]
key=value3
""")
assert ini.sections.length == 3
assert ini["[section1].key"] == "value1"
assert ini["section 2.key"] == "value2"
assert ini["section1.section3.key"] == "value3"
assert ini.sections.last.name == "section1.section3"
~~~
The dot `.` notation is used to create new sections with `[]=`.
Unknown sections will be created on the fly.
~~~nit
ini = new IniFile
ini["key"] = "value1"
ini["section1.key"] = "value2"
ini["section2.key"] = "value3"
stream = new StringWriter
ini.write_to(stream)
assert stream.to_s == """
key=value1
[section1]
key=value2
[section2]
key=value3
"""
~~~
Sections can also be created manually:
~~~nit
ini = new IniFile
ini["key"] = "value1"
var section = new IniSection("section1")
section["key"] = "value2"
ini.sections.add section
stream = new StringWriter
ini.write_to(stream)
assert stream.to_s == """
key=value1
[section1]
key=value2
"""
~~~
### Comments
Comments are indicated by semicolon (`;`) or a number sign (`#`) at the begining
of the line. Commented lines are ignored as well as empty lines.
~~~nit
ini = new IniFile.from_string("""
; This is a comment.
; property1=value1
# This is another comment.
# property2=value2
""")
assert ini.is_empty
~~~
### Unicode support
INI files support Unicode:
~~~nit
ini = new IniFile.from_string("""
property❤=héhé
""")
assert ini["property❤"] == "héhé"
~~~
Pull-Request: #2752
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 3 Jul 2019 18:50:43 +0000 (14:50 -0400)]
Merge: Introduce `Logger`, a simple yet powerful logging system
# A simple logger for Nit
## Basic Usage
Create a new `Logger` with a severity level threshold set to `warn_level`:
~~~nit
var logger = new Logger(warn_level)
~~~
Messages with a severity equal or higher than `warn_level` will be displayed:
~~~nit
logger.error "Displays an error."
logger.warn "Displays a warning."
~~~
Messages with a lower severity are silenced:
~~~nit
logger.info "Displays nothing."
~~~
`FileLogger` can be used to output the messages into a file:
~~~nit
var log_file = "my.log"
logger = new FileLogger(warn_level, log_file, append = false)
logger.error("An error")
logger.info("Some info")
logger.close
assert log_file.to_path.read_all == "An error\n"
log_file.to_path.delete
~~~
## Severity levels
Each message is associated with a level that indicate its severity.
Only messages with a severity equal to or higher than the logger `level`
threshold will be displayed.
Severity levels from the most severe to the least severe:
* `unknown_level`: An unknown message that should always be outputted.
* `fatal_level`: An unhandleable error that results in a program crash.
* `error_level`: A handleable error condition.
* `warn_level`: A warning.
* `info_level`: Generic (useful) information about system operation.
* `debug_level`: Low-level information for developpers.
## Formatting messages
You can create custom formatters by implementing the `Formatter` interface.
~~~nit
class MyFormatter
super Formatter
redef fun format(level, message) do
if level < warn_level then return message
return "!!!{message}!!!"
end
end
~~~
See `DefaultFormatter` for a more advanced implementation example.
Each Logger can be given a default formatter used to format the every messages
before outputting them:
~~~nit
var formatter = new MyFormatter
var stderr = new StringWriter
var logger = new Logger(warn_level, stderr, formatter)
logger.warn("This is a warning.")
assert stderr.to_s.trim.split("\n").last == "!!!This is a warning.!!!"
~~~
Optionally, a `Formatter` can be given to replace the `default_formatter`
used by default:
~~~nit
# Create a formatter with no default decorator
logger = new Logger(warn_level, stderr, null)
# Display a message without any formatter
logger.warn("This is a warning.")
assert stderr.to_s.trim.split("\n").last == "This is a warning."
# Display a message with a custom formatter
logger.warn("This is a warning.", formatter)
assert stderr.to_s.trim.split("\n").last == "!!!This is a warning.!!!"
~~~
Pull-Request: #2751
Reviewed-by: Jean Privat <jean@pryen.org>
Alexandre Terrasa [Wed, 19 Jun 2019 02:46:24 +0000 (22:46 -0400)]
github: Switch GithubAPI examples to `nitish`
Since it's now covered by the mock.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 19 Jun 2019 02:39:58 +0000 (22:39 -0400)]
github: Fix `GithubAPI::load_repo_branches`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Wed, 19 Jun 2019 03:50:32 +0000 (23:50 -0400)]
github: Add mock api testing
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Thu, 20 Jun 2019 23:31:41 +0000 (19:31 -0400)]
nitrpg: Move `nitrpg` to its own repository
See https://github.com/Morriar/nitrpg.
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:58:09 +0000 (14:58 -0400)]
nitpm: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:57:51 +0000 (14:57 -0400)]
nitpackage: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:56:19 +0000 (14:56 -0400)]
loader: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:56:09 +0000 (14:56 -0400)]
doc: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:55:56 +0000 (14:55 -0400)]
nitiwiki: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Thu, 20 Jun 2019 15:19:53 +0000 (11:19 -0400)]
docker-ci: ajoute libicu-dev
Alexandre Terrasa [Sat, 15 Jun 2019 18:55:35 +0000 (14:55 -0400)]
config: Update to new INI api
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:55:19 +0000 (14:55 -0400)]
ini: Update `package.ini` file
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 18:54:54 +0000 (14:54 -0400)]
ini: Add a README with tests from the spec
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Tue, 18 Jun 2019 23:13:01 +0000 (19:13 -0400)]
ini: Rewrite lib so it follows the INI spec
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 01:39:40 +0000 (21:39 -0400)]
nitweb: Adapt server to new `pop_logging` interface
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 01:39:18 +0000 (21:39 -0400)]
github: Adapt Github loader to new `pop_logging` interface
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 01:38:46 +0000 (21:38 -0400)]
popcorn: Remove useless dependency between `pop_tracker` and `pop_logging`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 01:37:55 +0000 (21:37 -0400)]
popcorn: Use `logger`
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Alexandre Terrasa [Sat, 15 Jun 2019 01:01:26 +0000 (21:01 -0400)]
Introduce `logger`, a simple logging utility for Nit
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Jean Privat [Thu, 13 Jun 2019 14:14:24 +0000 (10:14 -0400)]
Merge: Some more small improvements on gitlab-ci
Pull-Request: #2744
Jean Privat [Fri, 7 Jun 2019 17:16:31 +0000 (13:16 -0400)]
Merge: concurrent_collections: Add implementation of has method
Adding the implementation of the has method to call the has on the `real_collection`
Pull-Request: #2748
Jean Privat [Fri, 7 Jun 2019 17:16:29 +0000 (13:16 -0400)]
Merge: lib/core/bytes: Add a redef of has method
Adding the redef of the `has` method to take care of the negative numbers
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Pull-Request: #2749
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 7 Jun 2019 17:16:26 +0000 (13:16 -0400)]
Merge: Fix LineIterator
The logic behind LineIteraor (and the contracts of the iterators methods) was broken because of a bad management of the cache.
Instead of solving it locally, this PR introduces a simple CacheIterator abstract class with the correct behavior and simplify LineIteraor by using it.
Pull-Request: #2750
Jean Privat [Thu, 30 May 2019 15:00:58 +0000 (11:00 -0400)]
tests: add test_file_read3 for LineIterator
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 30 May 2019 14:51:55 +0000 (10:51 -0400)]
lib/core/stream: LineIterator use CachedIterator
The logic behind `is_ok` was broken and caused inconsitent results.
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 30 May 2019 14:45:06 +0000 (10:45 -0400)]
lib/core/collection: add `CachedIterator` to factorize the logic of iterators with a cache
Signed-off-by: Jean Privat <jean@pryen.org>
Florian Deljarry [Tue, 28 May 2019 16:03:12 +0000 (12:03 -0400)]
lib/core/bytes: Adding a redef of has method
Adding the redef of the `has` method to take care of the negative numbers
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Florian Deljarry [Mon, 27 May 2019 16:03:01 +0000 (12:03 -0400)]
concurrent_collections: Adding implementation of has method
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Jean Privat [Thu, 9 May 2019 15:10:28 +0000 (11:10 -0400)]
Merge: astbuilder: Adding new nodes makers(assert, method, or, and,...)
Adding new nodes creation services.
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Pull-Request: #2745
Reviewed-by: Jean Privat <jean@pryen.org>
Florian Deljarry [Fri, 12 Apr 2019 21:28:52 +0000 (17:28 -0400)]
astbuilder: Adding new nodes makers(assert, method, or, and,...)
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Jean Privat [Fri, 1 Mar 2019 12:56:46 +0000 (07:56 -0500)]
nitunit: do not write empty testsuites in the xml file
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 02:19:01 +0000 (21:19 -0500)]
tests.sh: run junit2html to render xml files
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 02:16:33 +0000 (21:16 -0500)]
gitlab-ci: add nitmetrics job
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 02:16:15 +0000 (21:16 -0500)]
gitlab-ci: add valgrind job
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 00:08:49 +0000 (19:08 -0500)]
Merge: CI: macOS jobs for Gitlab CI
Add 3 CI jobs for macOS, equivalent to `build_tools`, `test_some` and `test_full_nitcs`. They are executed by a shell executor on a macOS host, Nit Gitlab repos should have a such a runner with the tag `macos`. The new jobs are similar enough to the GNU/Linux versions that they can share the same script.
This PR also fixes 3 problems with macOS portability:
* Workaround for the error with kqueue on libevent and nitcorn clients.
* Set `sed -E` explicitly in `check_manpages.sh` for portability with macOS.
* Download bdwgc in the CI docker image, to prevent `test_full_nitcs_macos` to fail on `hello_ios` because it downloads bdwgc at compilation and prints to the test output. This will require regenerating the official Docker image.
Pull-Request: #2743
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 00:08:47 +0000 (19:08 -0500)]
Merge: ci: nitlang/nit-ci docker image runs in UTF8
Or else gradle fails with an exception
Pull-Request: #2742
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 1 Mar 2019 00:08:46 +0000 (19:08 -0500)]
Merge: Moving the astvalidation module in astbuilder
The astvalidation module has been moved into the astbuilder, as both are always used together.
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Pull-Request: #2741
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 1 Mar 2019 00:08:44 +0000 (19:08 -0500)]
Merge: Java FFI: use class NitObject for references to Nit objects from Java
This PR improves the type safety of the Java FFI and fixes a bug with pointers to Nit objects at the same time.
* The main change is the introduction of the Java class `NitObject` used as a general type for Nit objects referenced from Java code. It replaces the use of a simple `int` holding the pointer value, which was the source of the Java FFI bug.
* Change internal pointers to Nit object to use the Java primitive types `long` instead of `int`, addressing to the same pointer bug. Only low-level services should still use `long` this way, in this case it is the support for Android that relies mostly on the FFI with C.
* Change the annotation `extra_java_files` to accept the full name of Java classes (package + class) instead of the path to the Java source file. The compile still looks for the file in the same directory as the Nit module.
* Clear up the documentation of the class `ExternFile` for `filename` to be relative to the compilation folder. This required updating previous usages.
Pull-Request: #2740
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 28 Feb 2019 13:51:24 +0000 (08:51 -0500)]
ci: nitlang/nit-ci docker image runs in UTF8
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Thu, 28 Feb 2019 17:41:57 +0000 (12:41 -0500)]
ci: pre download bdwgc before launching the tests
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 28 Feb 2019 14:04:48 +0000 (09:04 -0500)]
misc/check_manpages.sh: add -E option to sed for for macOS compat.
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Thu, 28 Feb 2019 00:50:12 +0000 (19:50 -0500)]
tests: workaround for 'broken kqueue' error on macOS
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Wed, 27 Feb 2019 19:09:40 +0000 (14:09 -0500)]
ci: tests for macOS on Gitlab CI
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Florian Deljarry [Wed, 27 Feb 2019 16:31:02 +0000 (11:31 -0500)]
Moving the astvalidation module in astbuilder
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>
Alexis Laferrière [Wed, 27 Feb 2019 16:19:52 +0000 (11:19 -0500)]
Java FFI: Makefile adds the compilation dir to the Java CLASSPATH
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 26 Feb 2019 17:52:14 +0000 (12:52 -0500)]
tests: test Java on the new Gitlab CI setup
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 26 Feb 2019 19:46:52 +0000 (14:46 -0500)]
android: NitActivity and NitService use long to hold pointers
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 19 Feb 2019 13:13:17 +0000 (08:13 -0500)]
android & benitlux: use NitObject in clients
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sun, 17 Feb 2019 18:11:17 +0000 (13:11 -0500)]
Java FFI: intro NitObject for references to Nit objects from Java
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 26 Feb 2019 15:28:13 +0000 (10:28 -0500)]
Java FFI: extra_java_file annotation use full Java class name
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 26 Feb 2019 15:18:03 +0000 (10:18 -0500)]
Java FFI: fix a few warnings and improve doc
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Tue, 26 Feb 2019 15:17:01 +0000 (10:17 -0500)]
FFI: ExternFile::filename should be relative to the nit-compile dir
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Fri, 22 Feb 2019 19:38:03 +0000 (14:38 -0500)]
Merge: Ci more
some fix up and improvements on gitlab-ci
Pull-Request: #2738
Jean Privat [Fri, 22 Feb 2019 04:19:24 +0000 (23:19 -0500)]
ci-gitlab: contrib android-release (but not signed)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Feb 2019 04:16:26 +0000 (23:16 -0500)]
gitlab-ci: remove remaining allow_failure
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Fri, 22 Feb 2019 04:14:40 +0000 (23:14 -0500)]
ci: do not run nitc with `--colors-are-symbols`: it seems broken
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 15:51:40 +0000 (10:51 -0500)]
gitlab-ci: inject key for github.oauthtoken
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 15:51:12 +0000 (10:51 -0500)]
gitlab-ci: do not test in `build_tools`
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 01:10:47 +0000 (20:10 -0500)]
ci: dont fail on empty check_signedoff_list
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Thu, 21 Feb 2019 23:38:28 +0000 (18:38 -0500)]
Merge: Ci: move services to specific hostnames
Testing nit with various services is a PITA.
The previous solution was to test them on localhost and requires that the services are available and configured on each test node (it is not always as easy as it seems).
Another problem with `localhost` is that testing within docker is complex as running multiple services in a single container is discouraged.
Here, we propose to simply move the service from localhost to specific hostnames.
This is to be the current "good" practice and is supported out-of-the-box bu various CI infrastructure including gitlab-ci.
Pull-Request: #2737
Jean Privat [Thu, 21 Feb 2019 23:38:03 +0000 (18:38 -0500)]
Merge: gitlab-ci: add android
Add android test and build to gitlab-ci. This also fixes some issues.
Note: the version of the android tools are not the most recent. Trying to update the android toolchain to a more modern one should be done in another PR.
Prof of concept: https://gitlab.com/nit/nit-ci/-/jobs/
164255403/artifacts/browse/apk/
Pull-Request: #2736
Jean Privat [Thu, 21 Feb 2019 23:38:01 +0000 (18:38 -0500)]
Merge: curl: fix concurrent requests and intro shortcut services for scripts
This PR brings 2 main changes:
* The handle to a Curl request is now kept by the `CurlRequest` instances, instead of being shared by all requests. This makes it possible to execute concurrent HTTP requests.
* Intro two new services on `Text` to execute simple HTTP requests. While these new services are useful to simple scripts, if more control is needed you should still use `CurlHTTPRequest`.
`Text::http_get` makes a GET request and returns the response body.
`Text::http_download` makes a GET request and saves the response body to a file.
Pull-Request: #2731
Reviewed-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 15:44:40 +0000 (10:44 -0500)]
docker/ci: need netcat and killall for some test scripts
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 15:44:12 +0000 (10:44 -0500)]
docker/ci: do not need postgresql server
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 13:45:19 +0000 (08:45 -0500)]
ci: propose a docker-compose to handle services tests locally
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 03:39:10 +0000 (22:39 -0500)]
gitlab-ci: enable neo4j
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 03:17:40 +0000 (22:17 -0500)]
gitlab-ci: enable postgres
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 02:41:42 +0000 (21:41 -0500)]
gitlab-ci: add mongo as service
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 02:39:57 +0000 (21:39 -0500)]
gitlab-ci: enable mongo
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 02:39:33 +0000 (21:39 -0500)]
mongo: use `mongo` instead of `localhost` by default
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 00:42:36 +0000 (19:42 -0500)]
gitlab-ci: contrib android
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 20:30:35 +0000 (15:30 -0500)]
gitlab-ci: add .gradle to the cache
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 20:17:42 +0000 (15:17 -0500)]
gitlab-ci: don't abort if grep select nothing
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 19:59:34 +0000 (14:59 -0500)]
gitlab_ci: basic test for android
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 21:02:24 +0000 (16:02 -0500)]
antroid/README.md: add raw (for nitunit)
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 19:59:17 +0000 (14:59 -0500)]
gitlab_ci: unblacklist android
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Wed, 20 Feb 2019 01:29:36 +0000 (20:29 -0500)]
docker/nit-ci: add imagemagick
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 19:56:16 +0000 (14:56 -0500)]
docker/ci: install android sdk&ndk
Note: android-ndk is downloaded in the google archive
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Tue, 19 Feb 2019 19:55:19 +0000 (14:55 -0500)]
android-bdwgc: remove --depth=1 to avoid missing commits
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 16:26:57 +0000 (11:26 -0500)]
Merge: tests.sh: special case when running in gitlab_ci
When run is a containerized environment, some tests may behave differently.
This prepares some special cases for them.
Cf #2732
Pull-Request: #2735
Jean Privat [Mon, 18 Feb 2019 16:26:54 +0000 (11:26 -0500)]
Merge: lib&contrib: add some raw and nitish in READMEs
nitunit in jenkins did not test READMEs (cf #2313)
In order to test them, first fix them!
Pull-Request: #2734
Jean Privat [Mon, 18 Feb 2019 16:26:50 +0000 (11:26 -0500)]
Merge: tests/base_autocast: workaround a gcc bug
Versions of gcc between bellow 6.4.1 and 7.3.1 failed to compile
correctly the generated C.
So this changes the Nit, so the C can be compiled with buggy gcc versions.
Cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85244 for details
Pull-Request: #2733
Jean Privat [Mon, 18 Feb 2019 16:26:44 +0000 (11:26 -0500)]
Merge: docker: add image for continuous integration (without nit)
This prepares a new image that we will use for continuous integration.
Basically, it is a lot of stuff required by tests, libs and contribs of nit, but without nit
Pull-Request: #2732
Jean Privat [Mon, 18 Feb 2019 16:25:11 +0000 (11:25 -0500)]
Merge: Makefile: fix make clean
make clean errors out without cleaning everything. Fixes the make file to use rm -f when appropriate and -cmd otherwise.
Added cleaned message at the end to show it completed successfully (otherwise it ends in what can seem like an error message at first glance).
Signed-off-by: Hugo Leblanc <dullin@hololink.org>
Pull-Request: #2730
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 18 Feb 2019 16:25:04 +0000 (11:25 -0500)]
Merge: lib/core: handling of plus (+) sign when using to_i with Text objects
While doing the Advent of Code 2018 in Nit, I encountered a file with numbers prefaced with a plus (+) sign. The to_i of Text wasn't able to handle that kind of input so I added it.
The PR add handling of prefacing + signs with the current - sign implementation. Also added the same logic to is_int so that assert can work. Added new tests in the documentation to show normal usage.
Signed-off-by: Hugo Leblanc <dullin@hololink.org>
Pull-Request: #2729
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Jean Privat [Mon, 18 Feb 2019 15:56:02 +0000 (10:56 -0500)]
lib: add some nitish to avoid service configuration issues
docunits should not require specifics like a token or a server
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 15:41:34 +0000 (10:41 -0500)]
tests.sh: special case when running in gitlab_ci
When run is a containerized environment, some tests may behave differently.
This prepares some special cases for them.
Cf #2732
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 15:29:01 +0000 (10:29 -0500)]
tests/base_autocast: workaround a gcc bug
Versions of gcc between bellow 6.4.1 and 7.3.1 failed to compile
correctly the generated C.
So this changes the Nit, so the C can be compiled with buggy gcc versions.
Cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85244 for details
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 15:20:38 +0000 (10:20 -0500)]
lib&contrib: add some raw and nitish in READMEs
nitunit in jenkins did not test READMEs (cf #2313)
In order to test them, first fix them!
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 15:06:21 +0000 (10:06 -0500)]
add .gitlab-ci.yml
Signed-off-by: Jean Privat <jean@pryen.org>
Jean Privat [Mon, 18 Feb 2019 14:54:25 +0000 (09:54 -0500)]
docker: add image for continuous integration (without nit)
Signed-off-by: Jean Privat <jean@pryen.org>
Alexis Laferrière [Fri, 15 Feb 2019 13:10:06 +0000 (08:10 -0500)]
curl: update test for latest changes
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Feb 2019 13:09:21 +0000 (08:09 -0500)]
neo4j: remove unused curl handle (using a now private class)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Fri, 15 Feb 2019 13:08:38 +0000 (08:08 -0500)]
popcorn: there's no more a global curl handle, so this should be fixed
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Alexis Laferrière [Sat, 12 Jan 2019 04:12:50 +0000 (23:12 -0500)]
curl: intro shortcut methods `http_get` and `http_download` on `Text`
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>