项目作者: google

项目描述 :
Jsonnet - The data templating language
高级语言: Jsonnet
项目地址: git://github.com/google/jsonnet.git
创建时间: 2014-08-01T20:29:12Z
项目社区:https://github.com/google/jsonnet

开源协议:Apache License 2.0

下载


Jsonnet - The data templating language

master branch build status badge

For an introduction to Jsonnet and documentation,
visit our website.

This repository contains the original implementation. You can also try go-jsonnet, a newer implementation which in some cases is orders of magnitude faster.

Visit our discussion forum.

Packages

Jsonnet is available on Homebrew:

  1. brew install jsonnet

Jsonnet is available on MSYS2:

  1. pacman -S mingw-w64-clang-i686-jsonnet
  1. pacman -S mingw-w64-clang-x86_64-jsonnet
  1. pacman -S mingw-w64-i686-jsonnet
  1. pacman -S mingw-w64-x86_64-jsonnet
  1. pacman -S mingw-w64-ucrt-x86_64-jsonnet

The Python binding is on pypi:

  1. pip install jsonnet

You can also download and install Jsonnet using the vcpkg
dependency manager:

  1. git clone https://github.com/Microsoft/vcpkg.git
  2. cd vcpkg
  3. ./bootstrap-vcpkg.sh
  4. ./vcpkg integrate install
  5. vcpkg install jsonnet

The Jsonnet port in vcpkg is kept up to date by Microsoft team members and community contributors.
If the version is out of date, please create an issue or pull
request
on the vcpkg repository.

Building Jsonnet

You can use either GCC or Clang to build Jsonnet. Note that on recent versions
of macOS, /usr/bin/gcc and /usr/bin/g++ are actually Clang, so there is no
difference.

Makefile

To build Jsonnet with GCC, run:

  1. make

To build Jsonnet with Clang, run:

  1. make CC=clang CXX=clang++

To run the output binary, run:

  1. ./jsonnet

To run the reformatter, run:

  1. ./jsonnetfmt

Bazel

Bazel builds are also supported.
Install Bazel if it is
not installed already. Then, run the following command to build with GCC:

  1. bazel build -c opt //cmd:all

To build with Clang, use one of these two options:

  1. env CC=clang CXX=clang++ bazel build -c opt //cmd:all
  2. # OR
  3. bazel build -c opt --action_env=CC=clang --action_env=CXX=clang++ //cmd:all

This builds the jsonnet and jsonnetfmt targets defined in cmd/BUILD. To launch
the output binaries, run:

  1. bazel-bin/cmd/jsonnet
  2. bazel-bin/cmd/jsonnetfmt

Cmake

  1. cmake . -Bbuild
  1. cmake --build build --target run_tests

Contributing

See the contributing page on our website.

Developing Jsonnet

Running tests

To run the comprehensive suite:

  1. make test

Locally serving the website

You need a doc/js/libjsonnet.wasm which can either be downloaded from the
production website:

  1. wget https://jsonnet.org/js/libjsonnet.wasm -O doc/js/libjsonnet.wasm

Or you can build it yourself, which requires checking out
go-jsonnet. See the README.md in
that repo for instructions.

The standard library is documented in a structured format in doc/_stdlib_gen/stdlib-content.jsonnet.
The HTML (input for Jekyll) is regenerated using the following command:

  1. tools/scripts/update_web_content.sh

Then, from the root of the repository you can generate and serve the website using
Jekyll (you need version 4.3.0 or later):

  1. jekyll serve -s doc/

This should build and serve the website locally, and automatically rebuild
when you change any underlying files.