[英]How do I include a Skylark configuration parser in my application?
I like the idea of configuring my Java application with restricted Python code.我喜欢使用受限制的 Python 代码配置我的 Java 应用程序的想法。 This restrained Python configuration language goes by the name of Skylark.
这种内敛的 Python 配置语言名为 Skylark。 I found a Go library for Skylark support , but I need a Java one.
我找到了一个支持 Skylark的Go 库,但我需要一个 Java库。
Which maven artifact from the bazel project or buck project can I add to my pom.xml
dependencies section to get Skylark support library?我可以将 bazel 项目或 buck 项目中的哪个 maven 工件添加到我的
pom.xml
依赖项部分以获取 Skylark 支持库?
Until #2367 is resolved, the following worked for me.在#2367解决之前,以下对我有用。 Build Skylark_deploy.jar with Bazel and add it to your Maven project as a system dependency.
使用 Bazel 构建 Skylark_deploy.jar 并将其作为系统依赖项添加到您的 Maven 项目中。 This results in your classpath being a mess, essentially, but it is quick to set up and enables practical experimentation.
这本质上会导致您的类路径变得一团糟,但它可以快速设置并启用实际实验。
Warning: Skylark has not yet stabilized its API, so anything under com.google.devtools is subject to unannounced change.警告:Skylark 尚未稳定其 API,因此 com.google.devtools 下的任何内容都可能会发生未经宣布的更改。
git clone git@github.com:bazelbuild/bazel.git --depth 1
cd bazel
bazel build //src/main/java/com/google/devtools/skylark:Skylark
bazel build //src/main/java/com/google/devtools/skylark:Skylark_deploy.jar
Check that it works, either of the two command below should start Skylark REPL检查它是否有效,以下两个命令中的任何一个都应该启动 Skylark REPL
bazel-bin/src/main/java/com/google/devtools/skylark/Skylark
java -jar bazel-bin/src/main/java/com/google/devtools/skylark/Skylark_deploy.jar
The Skylark_deploy.jar is currently 9.4MiB in size. Skylark_deploy.jar 目前的大小为 9.4MiB。
<systemPath>${project.basedir}/lib/Skylark_deploy.jar</systemPath>
compile files('lib/Skylark_deploy.jar')
See https://github.com/bazelbuild/bazel/blob/0f99c3cc0b7b82e198c8f365254493fc4713edcd/src/main/java/com/google/devtools/starlark/cmd/Starlark.java for initial inspiration.请参阅https://github.com/bazelbuild/bazel/blob/0f99c3cc0b7b82e198c8f365254493fc4713edcd/src/main/java/com/google/devtools/starlark/cmd/Starlark.java以获得初步灵感。 (Skylark was renamed to Starlark at one point.)
(Skylark 曾一度更名为 Starlark。)
See https://github.com/google/copybara/blob/d4f9bd37ddf6eb51f1072ffb4e61332f7c410624/java/com/google/copybara/config/SkylarkParser.java and then https://github.com/google/copybara/blob/d4f9bd37ddf6eb51f1072ffb4e61332f7c410624/java/com/google/copybara/Core.java for even better inspiration.见https://github.com/google/copybara/blob/d4f9bd37ddf6eb51f1072ffb4e61332f7c410624/java/com/google/copybara/config/SkylarkParser.java然后https://github.com/google/copybara/blob/d4f9bd37ddf6eb51f1072ffb4e61332f7c410624/java/ com/google/copybara/Core.java以获得更好的灵感。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.