From ed11b012a4e1487727c595380bff8866d40f2529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Barzowski?= Date: Sun, 22 Nov 2020 15:12:08 +0100 Subject: [PATCH] Release 0.17.0 --- cpp/CMakeLists.txt | 2 +- doc/_stdlib_gen/stdlib-content.jsonnet | 21 +++++++++++++++++---- doc/ref/stdlib.html | 22 ++++++++++++++++++++-- include/libjsonnet.h | 2 +- test_cmd/fmt_help.golden.stdout | 2 +- test_cmd/fmt_help.golden.stdout.golang | 2 +- test_cmd/fmt_no_args.golden.stderr | 2 +- test_cmd/fmt_no_args.golden.stderr.golang | 2 +- test_cmd/fmt_version1.golden.stdout | 2 +- test_cmd/fmt_version2.golden.stdout | 2 +- test_cmd/help.golden.stdout.cpp | 2 +- test_cmd/help.golden.stdout.golang | 2 +- test_cmd/no_args.golden.stderr.cpp | 2 +- test_cmd/no_args.golden.stderr.golang | 2 +- test_cmd/version1.golden.stdout | 2 +- test_cmd/version2.golden.stdout | 2 +- 16 files changed, 51 insertions(+), 20 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5f6b22583..554990284 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -15,7 +15,7 @@ add_dependencies(libjsonnet++ jsonnet) # CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without # this step the output would be |liblibjsonnet|. set_target_properties(libjsonnet++ PROPERTIES OUTPUT_NAME jsonnet++ - VERSION "0.16.0" + VERSION "0.17.0" SOVERSION "0" PUBLIC_HEADER "${LIB_HEADER}") install(TARGETS libjsonnet++ diff --git a/doc/_stdlib_gen/stdlib-content.jsonnet b/doc/_stdlib_gen/stdlib-content.jsonnet index 36f38bb49..d60932919 100644 --- a/doc/_stdlib_gen/stdlib-content.jsonnet +++ b/doc/_stdlib_gen/stdlib-content.jsonnet @@ -83,6 +83,7 @@ local html = import 'html.libsonnet'; { name: 'objectValues', params: ['o'], + availableSince: '0.17.0', description: ||| Returns an array of the values in the given object. Does not include hidden fields. |||, @@ -104,6 +105,7 @@ local html = import 'html.libsonnet'; { name: 'objectValuesAll', params: ['o'], + availableSince: '0.17.0', description: ||| As std.objectValues but also includes hidden fields. |||, @@ -944,10 +946,17 @@ local html = import 'html.libsonnet'; { name: 'flatMap', params: ['func', 'arr'], - description: ||| - Apply the given function to every element of the array to form a new array then flatten the result. - It can be thought of as a generalized map, where each element can get mapped to 0, 1 or more elements. - |||, + description: html.paragraphs([ + ||| + Apply the given function to every element of arr to form a new array then flatten the result. + The argument arr must be an array or a string. If arr is an array, function func must return an array. + If arr is a string, function func must return an string. + |||, + ||| + The std.flatMap function can be thought of as a generalized std.map, + with each element mapped to 0, 1 or more elements. + ||| + ]), examples: [ { input: 'std.flatMap(function(x) [x, x], [1, 2, 3])', @@ -961,6 +970,10 @@ local html = import 'html.libsonnet'; input: 'std.flatMap(function(x) if x == 2 then [] else [x * 3, x * 2], [1, 2, 3])', output: std.flatMap(function(x) if x == 2 then [] else [x * 3, x * 2], [1, 2, 3]), }, + { + input: 'std.flatMap(function(x) x+x, "foo")', + output: std.flatMap(function(x) x+x, "foo") + }, ], }, { diff --git a/doc/ref/stdlib.html b/doc/ref/stdlib.html index 9b5008352..9462dc2c3 100644 --- a/doc/ref/stdlib.html +++ b/doc/ref/stdlib.html @@ -217,6 +217,11 @@

+

+ + Available since version 0.17.0. + +

Returns an array of the values in the given object. Does not include hidden fields.

@@ -283,6 +288,11 @@

+

+ + Available since version 0.17.0. + +

As std.objectValues but also includes hidden fields.

@@ -1733,8 +1743,13 @@

- Apply the given function to every element of the array to form a new array then flatten the result. - It can be thought of as a generalized map, where each element can get mapped to 0, 1 or more elements. + Apply the given function to every element of arr to form a new array then flatten the result. + The argument arr must be an array or a string. If arr is an array, function func must return an array. + If arr is a string, function func must return an string. +

+

+ The std.flatMap function can be thought of as generalized map, + where each element is mapped to 0, 1 or more elements.

Example: std.flatMap(function(x) [x, x], [1, 2, 3]) yields [ 1, 1, 2, 2, 3, 3 ]. @@ -1745,6 +1760,9 @@

Example: std.flatMap(function(x) if x == 2 then [] else [x * 3, x * 2], [1, 2, 3]) yields [ 3, 2, 9, 6 ].

+

+ Example: std.flatMap(function(x) x+x, "foo") yields "ffoooo". +

diff --git a/include/libjsonnet.h b/include/libjsonnet.h index 439ee83ab..d4b4b826a 100644 --- a/include/libjsonnet.h +++ b/include/libjsonnet.h @@ -31,7 +31,7 @@ limitations under the License. * * If this isn't the sae as jsonnet_version() then you've got a mismatched binary / header. */ -#define LIB_JSONNET_VERSION "v0.16.0" +#define LIB_JSONNET_VERSION "v0.17.0" /** Return the version string of the Jsonnet interpreter. Conforms to semantic versioning * http://semver.org/ If this does not match LIB_JSONNET_VERSION then there is a mismatch between diff --git a/test_cmd/fmt_help.golden.stdout b/test_cmd/fmt_help.golden.stdout index 287177ff1..b8809aa6f 100644 --- a/test_cmd/fmt_help.golden.stdout +++ b/test_cmd/fmt_help.golden.stdout @@ -1,4 +1,4 @@ -Jsonnet reformatter v0.16.0 +Jsonnet reformatter v0.17.0 jsonnetfmt {