编程语言
首页 > 编程语言> > bazel编译程序

bazel编译程序

作者:互联网

目录结构:

eg1
|
|-WORKSPACE
├─lib │ BUILD │ print_time.


cpp │ print_time.h │ └─main BUILD main.cpp

其中WORKSPACE为一个空文件。

其余文件内容:

1、print_time.h文件内容

void print_time_fun();

2、print_time.cpp 文件内容

#include <iostream>
#include <ctime>
#include "print_time.h"

void print_time_fun()
{
  std::cout << "function in file: print_time.cpp" << std::endl;
  std::time_t time = std::time(nullptr);
  std::cout << time << std::endl;
  std::cout << std::asctime(std::localtime(&time)) << std::endl;
}

3、main.cpp 文件内容

#include <iostream>
#include <ctime>
#include "lib/print_time.h"

void print_time()
{
  std::time_t time = std::time(nullptr);
  std::cout << std::asctime(std::localtime(&time));
}

int main()
{
    std::cout << "Hello world" << std::endl;
    print_time();
    print_time_fun();
    return 0;
}

bazel 编译

  1. WORKSPACE文件所在的目录为该工程的根目录,该文件可空
  2. 根目录下可以有多个子目录和子BUILD
  3. BUILD中定义了编译的相关依赖关系
  4. lib/BUILD文件 
cc_library (
  name = "print_time",
  srcs = ["print_time.cpp"],
  hdrs = ["print_time.h"],
  visibility = ["//main:__pkg__"],
)   

5、main/BUILD 文件

cc_binary(
   name = "main",
   srcs = ["main.cpp"],
   deps = [
     "//lib:print_time",
   ]
)
  1. 编译命令:bazel build //main:main
  2. 执行:./bazel-bin/main/main
  3. 结果

编译结果

D:\documents\bazel\eg1>bazel build //main:main
INFO: Invocation ID: c1754480-7d92-4d20-a9bf-6e39a89faf2c
INFO: Analysed target //main:main (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //main:main up-to-date:
  C:/users/wt/_bazel_wt/iri3qqqs/execroot/__main__/bazel-out/x64_windows-fastbuild/bin/main/main.exe
INFO: Elapsed time: 1.308s, Critical Path: 0.73s
INFO: 4 processes: 4 local.
INFO: Build completed successfully, 5 total actions

运行结果

D:\documents\bazel\eg1\bazel-bin\main>main
Hello world
Tue Jul  7 14:53:50 2020
function in file: print_time.cpp
1594104830
Tue Jul  7 14:53:50 2020

bazel编译生成了很多其他文件,不知道是不是可以通过命令禁止掉。

下面是生成所有文件的目录结构:

  1 │  WORKSPACE
  2 │  
  3 ├─bazel-bin
  4 │  ├─lib
  5 │  │  │  print_time.lib
  6 │  │  │  print_time.lib-2.params
  7 │  │  │  
  8 │  │  └─_objs
  9 │  │      └─print_time
 10 │  │              print_time.obj
 11 │  │              
 12 │  └─main
 13 │      │  main.exe
 14 │      │  main.exe-2.params
 15 │      │  main.exe.runfiles_manifest
 16 │      │  main.pdb
 17 │      │  
 18 │      ├─main.exe.runfiles
 19 │      │      MANIFEST
 20 │      │      
 21 │      └─_objs
 22 │          └─main
 23 │                  main.obj
 24 │                  
 25 ├─bazel-eg1
 26 │  ├─bazel-out
 27 │  │  │  stable-status.txt
 28 │  │  │  volatile-status.txt
 29 │  │  │  
 30 │  │  ├─x64_windows-fastbuild
 31 │  │  │  ├─bin
 32 │  │  │  │  ├─lib
 33 │  │  │  │  │  │  print_time.lib
 34 │  │  │  │  │  │  print_time.lib-2.params
 35 │  │  │  │  │  │  
 36 │  │  │  │  │  └─_objs
 37 │  │  │  │  │      └─print_time
 38 │  │  │  │  │              print_time.obj
 39 │  │  │  │  │              
 40 │  │  │  │  └─main
 41 │  │  │  │      │  main.exe
 42 │  │  │  │      │  main.exe-2.params
 43 │  │  │  │      │  main.exe.runfiles_manifest
 44 │  │  │  │      │  main.pdb
 45 │  │  │  │      │  
 46 │  │  │  │      ├─main.exe.runfiles
 47 │  │  │  │      │      MANIFEST
 48 │  │  │  │      │      
 49 │  │  │  │      └─_objs
 50 │  │  │  │          └─main
 51 │  │  │  │                  main.obj
 52 │  │  │  │                  
 53 │  │  │  ├─genfiles
 54 │  │  │  └─testlogs
 55 │  │  └─_tmp
 56 │  │      └─action_outs
 57 │  │              stdout-4
 58 │  │              stdout-5
 59 │  │              
 60 │  ├─external
 61 │  │  ├─bazel_tools
 62 │  │  │  ├─src
 63 │  │  │  │  │  BUILD
 64 │  │  │  │  │  
 65 │  │  │  │  ├─conditions
 66 │  │  │  │  │      BUILD
 67 │  │  │  │  │      
 68 │  │  │  │  ├─java_tools
 69 │  │  │  │  │  ├─buildjar
 70 │  │  │  │  │  │  └─java
 71 │  │  │  │  │  │      └─com
 72 │  │  │  │  │  │          └─google
 73 │  │  │  │  │  │              └─devtools
 74 │  │  │  │  │  │                  └─build
 75 │  │  │  │  │  │                      └─buildjar
 76 │  │  │  │  │  │                          └─jarhelper
 77 │  │  │  │  │  │                                  BUILD
 78 │  │  │  │  │  │                                  JarCreator.java
 79 │  │  │  │  │  │                                  JarHelper.java
 80 │  │  │  │  │  │                                  
 81 │  │  │  │  │  └─import_deps_checker
 82 │  │  │  │  │      └─java
 83 │  │  │  │  │          └─com
 84 │  │  │  │  │              └─google
 85 │  │  │  │  │                  └─devtools
 86 │  │  │  │  │                      └─build
 87 │  │  │  │  │                          └─importdeps
 88 │  │  │  │  │                                  BUILD
 89 │  │  │  │  │                                  ImportDepsChecker_deploy.jar
 90 │  │  │  │  │                                  
 91 │  │  │  │  ├─main
 92 │  │  │  │  │  ├─cpp
 93 │  │  │  │  │  │  └─util
 94 │  │  │  │  │  │          bazel_log_handler.cc
 95 │  │  │  │  │  │          bazel_log_handler.h
 96 │  │  │  │  │  │          BUILD
 97 │  │  │  │  │  │          errors.h
 98 │  │  │  │  │  │          errors_posix.cc
 99 │  │  │  │  │  │          errors_windows.cc
100 │  │  │  │  │  │          exit_code.h
101 │  │  │  │  │  │          file.cc
102 │  │  │  │  │  │          file.h
103 │  │  │  │  │  │          file_platform.h
104 │  │  │  │  │  │          file_posix.cc
105 │  │  │  │  │  │          file_windows.cc
106 │  │  │  │  │  │          logging.cc
107 │  │  │  │  │  │          logging.h
108 │  │  │  │  │  │          md5.cc
109 │  │  │  │  │  │          md5.h
110 │  │  │  │  │  │          numbers.cc
111 │  │  │  │  │  │          numbers.h
112 │  │  │  │  │  │          path.cc
113 │  │  │  │  │  │          path.h
114 │  │  │  │  │  │          path_platform.h
115 │  │  │  │  │  │          path_posix.cc
116 │  │  │  │  │  │          path_windows.cc
117 │  │  │  │  │  │          port.cc
118 │  │  │  │  │  │          port.h
119 │  │  │  │  │  │          profiler.cc
120 │  │  │  │  │  │          profiler.h
121 │  │  │  │  │  │          profiler_posix.cc
122 │  │  │  │  │  │          profiler_windows.cc
123 │  │  │  │  │  │          strings.cc
124 │  │  │  │  │  │          strings.h
125 │  │  │  │  │  │          
126 │  │  │  │  │  ├─native
127 │  │  │  │  │  │  │  BUILD
128 │  │  │  │  │  │  │  
129 │  │  │  │  │  │  └─windows
130 │  │  │  │  │  │          BUILD
131 │  │  │  │  │  │          file-jni.cc
132 │  │  │  │  │  │          file.cc
133 │  │  │  │  │  │          file.h
134 │  │  │  │  │  │          jni-util.cc
135 │  │  │  │  │  │          jni-util.h
136 │  │  │  │  │  │          processes-jni.cc
137 │  │  │  │  │  │          util.cc
138 │  │  │  │  │  │          util.h
139 │  │  │  │  │  │          
140 │  │  │  │  │  └─protobuf
141 │  │  │  │  │          action_cache.proto
142 │  │  │  │  │          analysis.proto
143 │  │  │  │  │          android_deploy_info.proto
144 │  │  │  │  │          bazel_flags.proto
145 │  │  │  │  │          BUILD
146 │  │  │  │  │          build.proto
147 │  │  │  │  │          builtin.proto
148 │  │  │  │  │          bundlemerge.proto
149 │  │  │  │  │          command_line.proto
150 │  │  │  │  │          command_server.proto
151 │  │  │  │  │          crosstool_config.proto
152 │  │  │  │  │          deps.proto
153 │  │  │  │  │          desugar_deps.proto
154 │  │  │  │  │          execution_statistics.proto
155 │  │  │  │  │          extra_actions_base.proto
156 │  │  │  │  │          invocation_policy.proto
157 │  │  │  │  │          java_compilation.proto
158 │  │  │  │  │          option_filters.proto
159 │  │  │  │  │          plmerge.proto
160 │  │  │  │  │          remote_execution_log.proto
161 │  │  │  │  │          spawn.proto
162 │  │  │  │  │          test_status.proto
163 │  │  │  │  │          worker_protocol.proto
164 │  │  │  │  │          
165 │  │  │  │  └─tools
166 │  │  │  │      ├─android
167 │  │  │  │      │  └─java
168 │  │  │  │      │      └─com
169 │  │  │  │      │          └─google
170 │  │  │  │      │              └─devtools
171 │  │  │  │      │                  └─build
172 │  │  │  │      │                      └─android
173 │  │  │  │      │                          │  all_android_tools_deploy.jar
174 │  │  │  │      │                          │  BUILD
175 │  │  │  │      │                          │  
176 │  │  │  │      │                          ├─desugar
177 │  │  │  │      │                          │  │  BUILD
178 │  │  │  │      │                          │  │  
179 │  │  │  │      │                          │  └─scan
180 │  │  │  │      │                          │          BUILD
181 │  │  │  │      │                          │          
182 │  │  │  │      │                          ├─dexer
183 │  │  │  │      │                          │      AsyncZipOut.java
184 │  │  │  │      │                          │      BUILD
185 │  │  │  │      │                          │      DexBuilder.java
186 │  │  │  │      │                          │      DexConversionEnqueuer.java
187 │  │  │  │      │                          │      DexConverter.java
188 │  │  │  │      │                          │      DexFileAggregator.java
189 │  │  │  │      │                          │      DexFileArchive.java
190 │  │  │  │      │                          │      DexFileMerger.java
191 │  │  │  │      │                          │      DexFiles.java
192 │  │  │  │      │                          │      DexFileSplitter.java
193 │  │  │  │      │                          │      Dexing.java
194 │  │  │  │      │                          │      DexLimitTracker.java
195 │  │  │  │      │                          │      MultidexStrategy.java
196 │  │  │  │      │                          │      ZipEntryComparator.java
197 │  │  │  │      │                          │      ZipEntryContent.java
198 │  │  │  │      │                          │      ZipEntryPredicates.java
199 │  │  │  │      │                          │      
200 │  │  │  │      │                          ├─idlclass
201 │  │  │  │      │                          │      BUILD
202 │  │  │  │      │                          │      
203 │  │  │  │      │                          ├─incrementaldeployment
204 │  │  │  │      │                          │      BUILD
205 │  │  │  │      │                          │      IncrementalClassLoader.java
206 │  │  │  │      │                          │      Placeholder.java
207 │  │  │  │      │                          │      StubApplication.java
208 │  │  │  │      │                          │      
209 │  │  │  │      │                          ├─junctions
210 │  │  │  │      │                          │      JunctionCreator.java
211 │  │  │  │      │                          │      NoopJunctionCreator.java
212 │  │  │  │      │                          │      WindowsJunctionCreator.java
213 │  │  │  │      │                          │      
214 │  │  │  │      │                          ├─proto
215 │  │  │  │      │                          │      BUILD
216 │  │  │  │      │                          │      Configuration.proto
217 │  │  │  │      │                          │      Resources.proto
218 │  │  │  │      │                          │      ResourcesInternal.proto
219 │  │  │  │      │                          │      serialize_format.proto
220 │  │  │  │      │                          │      
221 │  │  │  │      │                          └─ziputils
222 │  │  │  │      │                                  BUILD
223 │  │  │  │      │                                  
224 │  │  │  │      ├─launcher
225 │  │  │  │      │  │  bash_launcher.cc
226 │  │  │  │      │  │  bash_launcher.h
227 │  │  │  │      │  │  BUILD
228 │  │  │  │      │  │  dummy.cc
229 │  │  │  │      │  │  java_launcher.cc
230 │  │  │  │      │  │  java_launcher.h
231 │  │  │  │      │  │  launcher.cc
232 │  │  │  │      │  │  launcher.h
233 │  │  │  │      │  │  launcher_main.cc
234 │  │  │  │      │  │  python_launcher.cc
235 │  │  │  │      │  │  python_launcher.h
236 │  │  │  │      │  │  win_rules.bzl
237 │  │  │  │      │  │  
238 │  │  │  │      │  └─util
239 │  │  │  │      │          BUILD
240 │  │  │  │      │          data_parser.cc
241 │  │  │  │      │          data_parser.h
242 │  │  │  │      │          data_parser_test.cc
243 │  │  │  │      │          dummy.cc
244 │  │  │  │      │          launcher_util.cc
245 │  │  │  │      │          launcher_util.h
246 │  │  │  │      │          launcher_util_test.cc
247 │  │  │  │      │          
248 │  │  │  │      └─singlejar
249 │  │  │  │              BUILD
250 │  │  │  │              combiners.cc
251 │  │  │  │              combiners.h
252 │  │  │  │              diag.h
253 │  │  │  │              input_jar.cc
254 │  │  │  │              input_jar.h
255 │  │  │  │              mapped_file.cc
256 │  │  │  │              mapped_file.h
257 │  │  │  │              mapped_file_posix.inc
258 │  │  │  │              mapped_file_windows.inc
259 │  │  │  │              options.cc
260 │  │  │  │              options.h
261 │  │  │  │              output_jar.cc
262 │  │  │  │              output_jar.h
263 │  │  │  │              port.h
264 │  │  │  │              singlejar_main.cc
265 │  │  │  │              token_stream.h
266 │  │  │  │              transient_bytes.h
267 │  │  │  │              zip_headers.h
268 │  │  │  │              zlib_interface.h
269 │  │  │  │              
270 │  │  │  └─tools
271 │  │  │      │  BUILD
272 │  │  │      │  test_sharding_compliant
273 │  │  │      │  
274 │  │  │      ├─android
275 │  │  │      │  │  aar_embedded_jars_extractor.py
276 │  │  │      │  │  aar_native_libs_zip_creator.py
277 │  │  │      │  │  aar_resources_extractor.py
278 │  │  │      │  │  android_sdk_repository_template.bzl
279 │  │  │      │  │  bazel_debug.keystore
280 │  │  │      │  │  BUILD
281 │  │  │      │  │  build_incremental_dexmanifest.py
282 │  │  │      │  │  build_java8_legacy_dex.sh
283 │  │  │      │  │  build_split_manifest.py
284 │  │  │      │  │  desugar.sh
285 │  │  │      │  │  desugar_jdk_libs.jar
286 │  │  │      │  │  dex_list_obfuscator.sh
287 │  │  │      │  │  fail.sh
288 │  │  │      │  │  incremental_install.py
289 │  │  │      │  │  instrumentation_test_check.py
290 │  │  │      │  │  junction.py
291 │  │  │      │  │  minify_java8_legacy_libs.cfg
292 │  │  │      │  │  resource_extractor.py
293 │  │  │      │  │  strip_resources.py
294 │  │  │      │  │  stubify_manifest.py
295 │  │  │      │  │  zip_manifest_creator.sh
296 │  │  │      │  │  
297 │  │  │      │  └─emulator
298 │  │  │      │          BUILD
299 │  │  │      │          googletest.sh
300 │  │  │      │          no_se_linux.properties
301 │  │  │      │          snapshots.img.zip
302 │  │  │      │          
303 │  │  │      ├─bash
304 │  │  │      │  └─runfiles
305 │  │  │      │          BUILD
306 │  │  │      │          runfiles.bash
307 │  │  │      │          
308 │  │  │      ├─buildstamp
309 │  │  │      │      BUILD
310 │  │  │      │      get_workspace_status
311 │  │  │      │      
312 │  │  │      ├─build_defs
313 │  │  │      │  │  BUILD
314 │  │  │      │  │  
315 │  │  │      │  ├─apple
316 │  │  │      │  │  │  BUILD
317 │  │  │      │  │  │  shared.bzl
318 │  │  │      │  │  │  
319 │  │  │      │  │  └─test
320 │  │  │      │  │      │  BUILD
321 │  │  │      │  │      │  
322 │  │  │      │  │      └─testdata
323 │  │  │      │  │          └─BlazeFramework.framework
324 │  │  │      │  │              │  BlazeFramework
325 │  │  │      │  │              │  Info.plist
326 │  │  │      │  │              │  README.md
327 │  │  │      │  │              │  
328 │  │  │      │  │              ├─Headers
329 │  │  │      │  │              │      BlazeFramework.h
330 │  │  │      │  │              │      Multiplier.h
331 │  │  │      │  │              │      
332 │  │  │      │  │              └─Modules
333 │  │  │      │  │                      module.modulemap
334 │  │  │      │  │                      
335 │  │  │      │  ├─cc
336 │  │  │      │  │      action_names.bzl
337 │  │  │      │  │      BUILD
338 │  │  │      │  │      
339 │  │  │      │  ├─hash
340 │  │  │      │  │      BUILD
341 │  │  │      │  │      hash.bzl
342 │  │  │      │  │      sha256.py
343 │  │  │      │  │      sha256_test.sh
344 │  │  │      │  │      
345 │  │  │      │  ├─pkg
346 │  │  │      │  │  │  archive.py
347 │  │  │      │  │  │  archive_test.py
348 │  │  │      │  │  │  BUILD
349 │  │  │      │  │  │  build_tar.py
350 │  │  │      │  │  │  build_test.sh
351 │  │  │      │  │  │  make_deb.py
352 │  │  │      │  │  │  make_rpm.py
353 │  │  │      │  │  │  make_rpm_test.py
354 │  │  │      │  │  │  path.bzl
355 │  │  │      │  │  │  path_test.py
356 │  │  │      │  │  │  pkg.bzl
357 │  │  │      │  │  │  README.md
358 │  │  │      │  │  │  rpm.bzl
359 │  │  │      │  │  │  testenv.py
360 │  │  │      │  │  │  testenv.sh
361 │  │  │      │  │  │  
362 │  │  │      │  │  └─testdata
363 │  │  │      │  │          a.ar
364 │  │  │      │  │          ab.ar
365 │  │  │      │  │          a_ab.ar
366 │  │  │      │  │          a_b.ar
367 │  │  │      │  │          a_b_ab.ar
368 │  │  │      │  │          b.ar
369 │  │  │      │  │          empty.ar
370 │  │  │      │  │          tar_test.tar
371 │  │  │      │  │          tar_test.tar.bz2
372 │  │  │      │  │          tar_test.tar.gz
373 │  │  │      │  │          tar_test.tar.xz
374 │  │  │      │  │          
375 │  │  │      │  └─repo
376 │  │  │      │          android.bzl
377 │  │  │      │          BUILD
378 │  │  │      │          git.bzl
379 │  │  │      │          http.bzl
380 │  │  │      │          java.bzl
381 │  │  │      │          jvm.bzl
382 │  │  │      │          maven_rules.bzl
383 │  │  │      │          utils.bzl
384 │  │  │      │          
385 │  │  │      ├─build_rules
386 │  │  │      │      BUILD
387 │  │  │      │      test_rules.bzl
388 │  │  │      │      
389 │  │  │      ├─coverage
390 │  │  │      │      BUILD
391 │  │  │      │      collect-coverage.sh
392 │  │  │      │      dummy_coverage_report_generator
393 │  │  │      │      
394 │  │  │      ├─cpp
395 │  │  │      │  │  BUILD
396 │  │  │      │  │  BUILD.empty
397 │  │  │      │  │  BUILD.static.freebsd
398 │  │  │      │  │  BUILD.static.windows
399 │  │  │      │  │  BUILD.tpl
400 │  │  │      │  │  build_interface_so
401 │  │  │      │  │  cc_configure.bzl
402 │  │  │      │  │  cc_toolchain_config_lib.bzl
403 │  │  │      │  │  compiler_flag.bzl
404 │  │  │      │  │  CROSSTOOL
405 │  │  │      │  │  CROSSTOOL.empty
406 │  │  │      │  │  CROSSTOOL.tpl
407 │  │  │      │  │  crosstool_lib.bzl
408 │  │  │      │  │  crosstool_utils.bzl
409 │  │  │      │  │  dummy_toolchain.bzl
410 │  │  │      │  │  empty.cc
411 │  │  │      │  │  grep-includes.sh
412 │  │  │      │  │  lib_cc_configure.bzl
413 │  │  │      │  │  link_dynamic_library.sh
414 │  │  │      │  │  linux_cc_wrapper.sh.tpl
415 │  │  │      │  │  msys_gcc_installation_error.bat
416 │  │  │      │  │  osx_cc_configure.bzl
417 │  │  │      │  │  osx_cc_wrapper.sh
418 │  │  │      │  │  osx_cc_wrapper.sh.tpl
419 │  │  │      │  │  toolchain_utils.bzl
420 │  │  │      │  │  unix_cc_configure.bzl
421 │  │  │      │  │  vc_installation_error.bat.tpl
422 │  │  │      │  │  windows_cc_configure.bzl
423 │  │  │      │  │  
424 │  │  │      │  └─runfiles
425 │  │  │      │          BUILD
426 │  │  │      │          runfiles.cc
427 │  │  │      │          runfiles.h
428 │  │  │      │          
429 │  │  │      ├─def_parser
430 │  │  │      │      BUILD
431 │  │  │      │      def_parser.exe
432 │  │  │      │      no_op.bat
433 │  │  │      │      
434 │  │  │      ├─genrule
435 │  │  │      │      BUILD
436 │  │  │      │      genrule-setup.sh
437 │  │  │      │      
438 │  │  │      ├─j2objc
439 │  │  │      │      BUILD
440 │  │  │      │      j2objc_header_map.py
441 │  │  │      │      j2objc_wrapper.py
442 │  │  │      │      
443 │  │  │      ├─java
444 │  │  │      │  └─runfiles
445 │  │  │      │          BUILD
446 │  │  │      │          Runfiles.java
447 │  │  │      │          Util.java
448 │  │  │      │          
449 │  │  │      ├─jdk
450 │  │  │      │  │  BUILD
451 │  │  │      │  │  default_java_toolchain.bzl
452 │  │  │      │  │  DumpPlatformClassPath.java
453 │  │  │      │  │  ExperimentalTestRunner_deploy.jar
454 │  │  │      │  │  GenClass_deploy.jar
455 │  │  │      │  │  JacocoCoverage_deploy.jar
456 │  │  │      │  │  JavaBuilder_deploy.jar
457 │  │  │      │  │  proguard_whitelister.py
458 │  │  │      │  │  proguard_whitelister_test.py
459 │  │  │      │  │  proguard_whitelister_test_input.cfg
460 │  │  │      │  │  TestRunner_deploy.jar
461 │  │  │      │  │  turbine_deploy.jar
462 │  │  │      │  │  turbine_direct_binary_deploy.jar
463 │  │  │      │  │  VanillaJavaBuilder_deploy.jar
464 │  │  │      │  │  
465 │  │  │      │  ├─ijar
466 │  │  │      │  │      ijar.exe
467 │  │  │      │  │      
468 │  │  │      │  └─singlejar
469 │  │  │      │          bazel-singlejar_deploy.jar
470 │  │  │      │          
471 │  │  │      ├─launcher
472 │  │  │      │      BUILD
473 │  │  │      │      launcher.exe
474 │  │  │      │      
475 │  │  │      ├─objc
476 │  │  │      │      actoolwrapper.sh
477 │  │  │      │      BUILD
478 │  │  │      │      device_debug_entitlements.plist
479 │  │  │      │      dummy.c
480 │  │  │      │      dummy.proto
481 │  │  │      │      gcov_stub
482 │  │  │      │      ibtoolwrapper.sh
483 │  │  │      │      j2objc_dead_code_pruner.py
484 │  │  │      │      libtool.sh
485 │  │  │      │      make_hashed_objlist.py
486 │  │  │      │      mcov_stub
487 │  │  │      │      momcwrapper.sh
488 │  │  │      │      objc_dummy.mm
489 │  │  │      │      precomp_bundlemerge_deploy.jar
490 │  │  │      │      precomp_plmerge_deploy.jar
491 │  │  │      │      protobuf_compiler.py
492 │  │  │      │      protobuf_compiler_wrapper.sh
493 │  │  │      │      protobuf_support
494 │  │  │      │      realpath
495 │  │  │      │      StdRedirect.dylib
496 │  │  │      │      xcrunwrapper.sh
497 │  │  │      │      XCTest-Info.plist
498 │  │  │      │      
499 │  │  │      ├─osx
500 │  │  │      │  │  alias_rules.bzl
501 │  │  │      │  │  BUILD
502 │  │  │      │  │  xcode_configure.bzl
503 │  │  │      │  │  xcode_locator.m
504 │  │  │      │  │  xcode_locator_stub.sh
505 │  │  │      │  │  xcode_version_flag.bzl
506 │  │  │      │  │  
507 │  │  │      │  └─crosstool
508 │  │  │      │          BUILD
509 │  │  │      │          BUILD.tpl
510 │  │  │      │          CROSSTOOL.tpl
511 │  │  │      │          osx_archs.bzl
512 │  │  │      │          wrapped_ar.tpl
513 │  │  │      │          wrapped_clang.cc
514 │  │  │      │          wrapped_clang.tpl
515 │  │  │      │          wrapped_clang_pp.tpl
516 │  │  │      │          
517 │  │  │      ├─python
518 │  │  │      │  │  2to3.sh
519 │  │  │      │  │  BUILD
520 │  │  │      │  │  
521 │  │  │      │  └─runfiles
522 │  │  │      │          BUILD
523 │  │  │      │          runfiles.py
524 │  │  │      │          
525 │  │  │      ├─runfiles
526 │  │  │      │      BUILD
527 │  │  │      │      
528 │  │  │      ├─sh
529 │  │  │      │      BUILD
530 │  │  │      │      sh_configure.bzl
531 │  │  │      │      sh_toolchain.bzl
532 │  │  │      │      
533 │  │  │      ├─test
534 │  │  │      │  │  BUILD
535 │  │  │      │  │  collect_cc_coverage.sh
536 │  │  │      │  │  collect_coverage.sh
537 │  │  │      │  │  generate-xml.sh
538 │  │  │      │  │  test-setup.sh
539 │  │  │      │  │  tw.exe
540 │  │  │      │  │  
541 │  │  │      │  └─CoverageOutputGenerator
542 │  │  │      │      └─java
543 │  │  │      │          └─com
544 │  │  │      │              └─google
545 │  │  │      │                  └─devtools
546 │  │  │      │                      └─coverageoutputgenerator
547 │  │  │      │                              all_lcov_merger_tools_deploy.jar
548 │  │  │      │                              BUILD
549 │  │  │      │                              
550 │  │  │      ├─whitelists
551 │  │  │      │  │  BUILD
552 │  │  │      │  │  
553 │  │  │      │  └─config_feature_flag
554 │  │  │      │          BUILD
555 │  │  │      │          
556 │  │  │      └─zip
557 │  │  │          │  BUILD
558 │  │  │          │  
559 │  │  │          └─zipper
560 │  │  │                  zipper.exe
561 │  │  │                  
562 │  │  └─local_config_cc
563 │  │          BUILD
564 │  │          CROSSTOOL
565 │  │          dummy_toolchain.bzl
566 │  │          get_env.bat
567 │  │          msys_gcc_installation_error.bat
568 │  │          WORKSPACE
569 │  │          
570 │  ├─lib
571 │  │      BUILD
572 │  │      print_time.cpp
573 │  │      print_time.h
574 │  │      
575 │  └─main
576 │          BUILD
577 │          main.cpp
578 │          
579 ├─bazel-genfiles
580 ├─bazel-out
581 │  │  stable-status.txt
582 │  │  volatile-status.txt
583 │  │  
584 │  ├─x64_windows-fastbuild
585 │  │  ├─bin
586 │  │  │  ├─lib
587 │  │  │  │  │  print_time.lib
588 │  │  │  │  │  print_time.lib-2.params
589 │  │  │  │  │  
590 │  │  │  │  └─_objs
591 │  │  │  │      └─print_time
592 │  │  │  │              print_time.obj
593 │  │  │  │              
594 │  │  │  └─main
595 │  │  │      │  main.exe
596 │  │  │      │  main.exe-2.params
597 │  │  │      │  main.exe.runfiles_manifest
598 │  │  │      │  main.pdb
599 │  │  │      │  
600 │  │  │      ├─main.exe.runfiles
601 │  │  │      │      MANIFEST
602 │  │  │      │      
603 │  │  │      └─_objs
604 │  │  │          └─main
605 │  │  │                  main.obj
606 │  │  │                  
607 │  │  ├─genfiles
608 │  │  └─testlogs
609 │  └─_tmp
610 │      └─action_outs
611 │              stdout-4
612 │              stdout-5
613 │              
614 ├─bazel-testlogs
615 ├─lib
616 │      BUILD
617 │      print_time.cpp
618 │      print_time.h
619 │      
620 └─main
621         BUILD
622         main.cpp
View Code

 

参考博客:https://blog.csdn.net/qq_37268614/article/details/93617069

参考博客:https://blog.csdn.net/weixin_40198941/article/details/93198073

参考官网:https://docs.bazel.build/versions/master/tutorial/cpp.html

标签:bzl,java,cc,bazel,BUILD,time,main,编译程序
来源: https://www.cnblogs.com/juluwangshier/p/13260848.html