bazel

Bazel build is not working on from Maven project

狂风中的少年 提交于 2019-12-24 21:00:13
问题 I'm new to Bazel and learning its build work, currently I am trying to do with bazel build from a Maven project, please advise me how to make it working, thanks. Here is the WORKSPACE file I am trying to define: maven_jar( name = "junit", artifact = "junit:junit:3.8.1", ) maven_jar( name = "log4j1", artifact = "org.apache.logging.log4j:log4j-core:2.6.2", ) maven_jar( name = "log4j2", artifact = "org.apache.logging.log4j:log4j-api:2.6.2", ) ..... Here is the BUILD file I am trying to define:

bazel for jni: jni.h file not found

不羁岁月 提交于 2019-12-24 10:35:02
问题 I'm trying to use bazel to build my JNI library (written in C). No luck after about 4 hours: "jni.h file not found". How can I put the JDK include directories on the search path? Tried using absolute paths but bazel rejects those. Trying to use a new_local_repository for the JDK but cannot see how to make it work. This is bazel 0.5.3 on MacOS 10.12.6, Java 1.8 回答1: Can you depend on @local_jdk//:jni_header or some other magic labels from https://github.com/bazelbuild/bazel/blob

Where is the bazel rule generating the `gen_io_ops.py` file when building TensorFlow from sources?

六月ゝ 毕业季﹏ 提交于 2019-12-24 09:41:14
问题 I'm trying to determine how the gen_io_ops module is generated by bazel when building TensorFlow from source. In tensorflow/python/ops/io_ops.py, there is this piece of code: from tensorflow.python.ops.gen_io_ops [...] # used in the TextLineReader initialization rr = gen_io_ops._text_line_reader_v2(...) referring to the bazel-genfiles/tensorflow/python/ops/gen_io_ops.py module (and generated by bazel when building TensorFlow). The _text_line_reader_v2 is a wrapper of the TextLineReaderV2

How to link a library build using make rule in bazel

六月ゝ 毕业季﹏ 提交于 2019-12-24 00:46:16
问题 I have built a lib.so using make rule in bazel. How do I link this external lib.so to a regular cc_library rule. I tried adding it in deps, but the guide suggests that deps can have cc_library or objc_library targets. Also, do I need to pass any specific linking options, and how can I read more about them? 回答1: In the BUILD file, create a cc_library target that imports the built lib.so for other cc_library targets to depend on: cc_library( name = "lib", srcs = ["lib.so"], linkopts = ["...", "

Bazel- How to recursively glob deleted_packages to ignore maven outputs?

假装没事ソ 提交于 2019-12-24 00:32:57
问题 I have a mutli-module project which I'm migrating from Maven to Bazel. During this migration people will need to be able to work on both build systems. After an mvn clean install Maven copies some of the BUILD files into the target folder. When I later try to run bazel build //... it thinks the BUILD files under the various target folders are valid packages and fails due to some mismatch. I've seen deleted_packages but AFAICT it requires I specify the list of folders to "delete" while I can't

Bazel build java demo: build ok but fail to run

╄→гoц情女王★ 提交于 2019-12-23 22:26:47
问题 I'm new to bazel and have this demo project: (1)mkdir demo-project (2)cd demo-project (3)mkdir -p src/main/java/com/demo (4)vi src/main/java/com/demo/DemoRunner.java package com.demo; public class DemoRunner { public static void main(String args[]) { Hello.hello(); } } (5)vi src/main/java/com/demo/Hello.java package com.demo; public class Hello { public static void hello() { System.out.println("hello,world"); } } (6)vi ~/demo-project/BUILD java_binary( name = "hello", srcs = glob(["**/*.java"

How can I build custom rules using the output of workspace_status_command?

梦想的初衷 提交于 2019-12-23 03:14:40
问题 The bazel build flag --workspace_status_command supports calling a script to retrieve e.g. repository metadata, this is also known as build stamping and available in rules like java_binary . I'd like to create a custom rule using this metadata. I want to use this for a common support function. It should receive the git version and some other attributes and create a version.go output file usable as a dependency. So I started a journey looking at rules in various bazel repositories. Rules like

国内加速下载镜像地址

☆樱花仙子☆ 提交于 2019-12-22 22:39:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 国内直接从官网下载比较困难,需要一些技术手段。这里提供一个国内的镜像下载地址列表,方便网友下载。 Zabbix Yarn Selenium Redis RabbitMQ Python Phantomjs Phantomjs POI Openresty Openjdk Nodejs Nginx MySQL Memcached Leveldown Keepalived Helm HAProxy Grafana Git for MacOS GeckoDriver Filebeat Etcd Electron ChromeDriver Bazel Ansible Tortoisegit Logstash Kibana Elasticsearch Git for Windows 来源: oschina 链接: https://my.oschina.net/newbe36524/blog/3146008

Why is a publicly visible Bazel ProtoBuf target 'not declared'

一个人想着一个人 提交于 2019-12-22 16:01:18
问题 I'm attempting to use Bazel's Protocol Buffer Rules to compile (generate) Python language bindings and any dependencies. The layout of my project is simple, with a single directory, proto , containing the .proto file and BUILD file. WORKSPACE BUILD.six |-- proto | |-- example.proto | |-- BUILD My WORKSPACE file: workspace(name = "com_example") http_archive( name = "com_google_protobuf", strip_prefix = "protobuf-3.4.1", urls = ["https://github.com/google/protobuf/archive/v3.4.1.zip"], ) new

Use generated code in a bazel build

a 夏天 提交于 2019-12-22 05:35:13
问题 $ python gencpp.py This command generates a cpp file foo.cpp in the working directory. I'd like to run this command in bazel before building to be able to include foo.cpp in cc_binary 's srcs attribute. What I've tried: genrule( name = 'foo', outs = ['foo.cpp'], cmd = 'python gencpp.py', ) cc_library( srcs = ['foo.cpp'], # tried also with :foo ... ) declared output 'external/somelib/foo.cpp' was not created by genrule. This is probably because the genrule actually didn't create this output,