How do you debug a Bazel sandboxing failure? - bazel

Repo with full code example.
When I try to run a test with Bazel involving the tree-sitter binary, I get an Operation not permitted error without any further information.
❯ bazel test --test_output=errors --verbose_failures --sandbox_debug //tree-sitter-nbts:check-generated
INFO: Analyzed target //tree-sitter-nbts:check-generated (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
FAIL: //tree-sitter-nbts:check-generated (see /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/execroot/__main__/bazel-out/darwin_arm64-fastbuild/testlogs/tree-sitter-nbts/check-generated/test.log)
INFO: From Testing //tree-sitter-nbts:check-generated:
==================== Test output for //tree-sitter-nbts:check-generated:
++ dirname /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts/check-generated
+ cd /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts
+ git init -b main
Initialized empty Git repository in /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts/.git/
+ git add .
+ GIT_AUTHOR_EMAIL=_
+ GIT_AUTHOR_NAME=_
+ GIT_COMMITTER_EMAIL=_
+ GIT_COMMITTER_NAME=_
+ git commit -m 'Initial commit'
[main (root-commit) 1f79ef2] Initial commit
11 files changed, 11 insertions(+)
create mode 120000 Cargo.lock
create mode 120000 Cargo.toml
create mode 120000 bindings/rust/build.rs
create mode 120000 bindings/rust/lib.rs
create mode 120000 check-generated
create mode 120000 check-generated.sh
create mode 120000 grammar.js
create mode 120000 src/grammar.json
create mode 120000 src/node-types.json
create mode 120000 src/parser.c
create mode 120000 src/tree_sitter/parser.h
+ tree-sitter generate
Operation not permitted (os error 1)
================================================================================
Target //tree-sitter-nbts:check-generated up-to-date:
bazel-bin/tree-sitter-nbts/check-generated
INFO: Elapsed time: 0.220s, Critical Path: 0.11s
INFO: 2 processes: 2 darwin-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//tree-sitter-nbts:check-generated FAILED in 0.1s
/private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/execroot/__main__/bazel-out/darwin_arm64-fastbuild/testlogs/tree-sitter-nbts/check-generated/test.log
INFO: Build completed, 1 test FAILED, 2 total actions
What is a good way of debugging this? So far, I know the following:
Running tree-sitter generate directly in the source tree works fine.
The bazel test command works fine with --spawn_strategy=standalone, which I think confirms that this is a sandboxing issue.
The bazel test command works fine inside the Nix environment (see the linked repo). This one is a little weird, not sure what's going on here.
Configuration information:
macOS 12.4 on an M1 Mac
Bazel v5.2.0 (both in Nix and outside)
tree-sitter v0.20.6 (both in Nix and outside) (I tried using the Nix-installed binary with Bazel and that didn't seem to make any difference)
OpenJDK v11.0.15 in the global environment vs OpenJDK v11.0.11 in Nix.
GitHub issues which seem related:
ln call fails with "operation not permitted" during bazel test - This comment mentions there is no command printed with --verbose_failures --sandbox_debug.
Strange "Operation not permitted" problem for test program accessing files in the sand box on MacOS

Related

While adding the maven dependency in bazel project,unable to running the bazel run #maven//:pin,getting maven_install.json as empty.facing below issue

bazel run #maven//:pin
Starting local Bazel server and connecting to it...
INFO: Analyzed target #maven//:pin (7 packages loaded, 26 targets configured).
INFO: Found 1 target...
Target #maven//:pin up-to-date:
bazel-bin/external/maven/pin
bazel-bin/external/maven/pin.exe
INFO: Elapsed time: 14.964s, Critical Path: 0.13s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Starting local Bazel server and connecting to it...
C:\Users\mohit.jaiswal_bazel_mohit.jaiswal\3crxb23l\execroot_main_\bazel-out\x64_windows-fastbuild\bin\external\maven\pin: line 13: ../maven/jq: No such file o
r directory
and maven_install.json file is showing empty
Make sure github.com/bazelbuild/rules_jvm_external is added properly in the worksapce file. Clean the build by [bazel clean --expunge] and try compiling it again.

Bazel inside Alpine container issue

I'm trying to test the build of google/or-tools using the Bazel based build system on various GNU/Linux distro by using various common distros
When trying to use bazel inside an Alpine:edge based Dockerfile (i.e. in a RUN cmd), at "docker build" time.
I don't have a consistency build between my Archlinux and on Github action workflow runners (ubuntu 18.04 IIRC).
Dockerfile: https://github.com/google/or-tools/blob/master/bazel/docker/alpine/Dockerfile
I run it using my Makefile target alpine_build in google/or-tools/bazel
ref: https://github.com/google/or-tools/blob/master/bazel/Makefile
From GH ubuntu-latest (18.04 LTS ?) runner, I got this trace
$ make alpine_build
...
Step 11/11 : RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
---> Running in 9a2f9b6f24c7
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "fe1790ca0df67173702f70d5646b82f48f412b99", shallow_since = "1576187991 -0800"
DEBUG: Call stack for the definition of repository 'com_google_protobuf' which is a git_repository (rule definition at /root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
- /home/lib/WORKSPACE:22:1
Loading: 2 packages loaded
Analyzing: 301 targets (16 packages loaded, 0 targets configured)
Analyzing: 301 targets (25 packages loaded, 43 targets configured)
Analyzing: 301 targets (26 packages loaded, 43 targets configured)
...
ref: https://github.com/google/or-tools/runs/568849544?check_suite_focus=true
So everything seems fine up to this point (still need to figure out the jdk javac issue but it's an other topic)
On the contrary on my Archlinux, I've got:
$ make alpine_build
...
Step 11/11 : RUN bazel build --curses=no --copt='-Wno-sign-compare' //...:all
---> Running in e13ca9fd3e84
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
INFO: Call stack for the definition of repository 'com_google_protobuf' which is a git_repository (rule definition at /root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
- /home/lib/WORKSPACE:22:1
ERROR: An error occurred during the fetch of repository 'com_google_protobuf':
java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
ERROR: no such package '#com_google_protobuf//': java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
ERROR: no such package '#com_google_protobuf//': java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
INFO: Elapsed time: 29.713s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
The command '/bin/sh -c bazel build --curses=no --copt='-Wno-sign-compare' //...:all' returned a non-zero code: 1
make: *** [Makefile:121: alpine_build] Error 1
I've tried to look at the file /root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin
using the previous step (alpine_devel) container:
$ make sh_alpine_devel
/home/lib # bazel build --curses=no --copt='-Wno-sign-compare' //...:all
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
INFO: Call stack for the definition of repository 'com_google_protobuf' which is a git_repository (rule definition at /root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
- /home/lib/WORKSPACE:22:1
ERROR: An error occurred during the fetch of repository 'com_google_protobuf':
java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
ERROR: no such package '#com_google_protobuf//': java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
ERROR: no such package '#com_google_protobuf//': java.io.IOException: unlinkat(/root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/refs/remotes/origin) (Directory not empty)
INFO: Elapsed time: 29.924s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
cat /root/.cache/bazel/_bazel_root/86fee77ec27da0053940f3f327a6fd59/external/com_google_protobuf/.git/logs/
refs/remotes/origin/revert-6272-MutableSequence-import
0000000000000000000000000000000000000000 c5fedd61a48a174054f98684d5ddbc2d11530367 root <root#Flex2.home> 1586336706 +0000 fetch origin refs/heads/*:refs/remotes/origin/* refs/tags/*:refs/tags/*: storing head
note Flex2 is my local machine...
So my questions:
Is it a known issue (ed don't find anything on java.io.IOException: unlinkat) ?
Does Bazel deal with the kernel (or uname -a etc...) which could explain why I don't have the same behaviour from one host to an other ?
May I have more trace to debug this issue ?
How can I fix it ?
Thanks,
Basically you need to tell to bazel to use the java locally installed by alpine than downloading one.
this can be done using the option --host_javabase=#local_jdk//:jdk
ref: https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/bazel/docker/alpine/Dockerfile#L26
Minimal working example:
https://github.com/Mizux/bazel-cpp/blob/main/ci/docker/alpine/Dockerfile

iOS- Not working sonar script 'run-sonar-swift'

I am trying to implement sonar qube swift. I have installed all prerequisites setup that you can find in the link.
https://medium.com/#pranay.urkude/sonarqube-integration-with-ios-b76df8405014
But when i run the ./run-sonar-swift.sh -v command then getting the error. which is mention in below logs please
>Apples-MacBook-Air:Wanna Aman$ ./run-sonar-swift.sh -v
Running run-sonar-swift.sh...
Project count is [1]
Xcode project file is: Wanna.xcodeproj
Xcode workspace file is: Wanna.xcworkspace
Xcode application scheme is: Wanna
Number version from plist is: 1.0
Destination simulator is: platform=iOS Simulator,name=iPhone 7,OS=12.2
Excluded paths from coverage are:
Creating directory sonar-reports/
Extracting Xcode project information
+ xcodebuild clean build -workspace Wanna.xcworkspace -scheme Wanna -destination 'platform=iOS Simulator,name=iPhone 7,OS=12.2' -destination-timeout 360 COMPILER_INDEX_STORE_ENABLE=NO
+ returnValue=0
+ set +x
▸ Clean Succeeded
▸ Copying Pods-Wanna-umbrella.h
▸ Processing Pods-Wanna-Info.plist
▸ Compiling Pods-Wanna-dummy.m
▸ Compiling Pods_Wanna_vers.c
▸ Touching Pods_Wanna.framework (in target: Pods-Wanna)
▸ Running script '[CP] Check Pods Manifest.lock'
▸ Compiling ViewController.swift
▸ Compiling AppDelegate.swift
▸ Linking Wanna
▸ Compiling LaunchScreen.storyboard
▸ Compiling Main.storyboard
▸ Processing Info.plist
▸ Touching Wanna.app (in target: Wanna)
▸ Build Succeeded
actual = 9549, min = 3
Running surefire
+ xcodebuild clean build test -workspace Wanna.xcworkspace -scheme Wanna -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 7,OS=12.2' -destination-timeout 60
2019-07-01 17:00:18.123 xcodebuild[34637:171741] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/Aman/Library/Developer/Xcode/DerivedData/Wanna-flozsuddkzcjfadhlxefzthqazgq/Logs/Test/Run-Wanna-2019.07.01_17-00-12-+0530.xcresult/3_Test/Diagnostics/WannaTests-DACAF56A-03C3-43EA-AEF4-BF18730C5266/WannaTests-13AB698C-A67D-4AB5-92FF-A0F03008C70D/Session-WannaTests-2019-07-01_170018-25708T.log
2019-07-01 17:00:18.124 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: (86CE27D3-0AD7-4F62-B501-A3EB8862A636) Beginning test session WannaTests-86CE27D3-0AD7-4F62-B501-A3EB8862A636 at 2019-07-01 17:00:18.124 with Xcode 10E1001 on target <DVTiPhoneSimulator: 0x7fdd68da7af0> {
SimDevice: iPhone 7 (763FCF55-E246-4DC4-9240-91D57CED4F0A, iOS 12.2, Shutdown)
} (12.2 (16E226))
2019-07-01 17:00:28.099 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: (86CE27D3-0AD7-4F62-B501-A3EB8862A636) Finished requesting crash reports. Continuing with testing.
2019-07-01 17:00:40.206 xcodebuild[34637:171675] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/Aman/Library/Developer/Xcode/DerivedData/Wanna-flozsuddkzcjfadhlxefzthqazgq/Logs/Test/Run-Wanna-2019.07.01_17-00-12-+0530.xcresult/3_Test/Diagnostics/WannaUITests-9971F8D3-0217-4F89-B28E-AF6745AC64E6/WannaUITests-2DC182C8-A11E-4D24-897F-C2F8F6D2D86F/Session-WannaUITests-2019-07-01_170040-45gLHX.log
2019-07-01 17:00:40.206 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: (273A8001-66F3-469C-9A45-E7B689DF080A) Beginning test session WannaUITests-273A8001-66F3-469C-9A45-E7B689DF080A at 2019-07-01 17:00:40.206 with Xcode 10E1001 on target <DVTiPhoneSimulator: 0x7fdd68da7af0> {
SimDevice: iPhone 7 (763FCF55-E246-4DC4-9240-91D57CED4F0A, iOS 12.2, Booted)
} (12.2 (16E226))
2019-07-01 17:00:40.461 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: (273A8001-66F3-469C-9A45-E7B689DF080A) Finished requesting crash reports. Continuing with testing.
2019-07-01 17:00:58.421 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: 40.317 elapsed -- Testing started completed.
2019-07-01 17:00:58.421 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2019-07-01 17:00:58.421 xcodebuild[34637:171579] [MT] IDETestOperationsObserverDebug: 40.317 sec, +40.317 sec -- end
+ returnValue=0
+ set +x
.T. Executed 2 tests, with 0 failures (0 unexpected) in 0.542 (0.545) seconds
Executed 1 test, with 0 failures (0 unexpected) in 9.052 (9.056) seconds
\nComputing coverage report\n
>Command line exclusion flags for slather is:
slather coverage --binary-basename Wanna --input-format profdata --cobertura-xml --output-directory sonar-reports --workspace Wanna.xcworkspace --scheme Wanna Wanna.xcodeproj
+ slather coverage --binary-basename Wanna --input-format profdata --cobertura-xml --output-directory sonar-reports --workspace Wanna.xcworkspace --scheme Wanna Wanna.xcodeproj
Slathering...
Slathered
+ returnValue=0
+ set +x
Running SwiftLint...dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /usr/local/bin/swiftlint
Reason: image not found
./run-sonar-swift.sh: line 384: 34914 Abort trap: 6 $SWIFTLINT_CMD lint --path "$word" > sonar-reports/"$appScheme"-swiftlint.txt
Running Tailor...Running OCLint...
Path included in oclint analysis is: --include .*/Wanna/Wanna/*
+ oclint-json-compilation-database -v --include ../Wanna/Wanna/AppDelegate.swift ../Wanna/Wanna/Assets.xcassets ../Wanna/Wanna/Base.lproj ../Wanna/Wanna/Info.plist ../Wanna/Wanna/ViewController.swift -- -rc LONG_LINE=250 -max-priority-1 10000 -max-priority-2 10000 -max-priority-3 10000 -report-type pmd -o sonar-reports/Wanna-oclint.xml
------------------------------ OCLint ------------------------------
/usr/local/bin/oclint -p /Users/Aman/Desktop/Wanna ../Wanna/Wanna/Assets.xcassets ../Wanna/Wanna/Base.lproj ../Wanna/Wanna/Info.plist ../Wanna/Wanna/ViewController.swift -rc LONG_LINE=250 -max-priority-1 10000 -max-priority-2 10000 -max-priority-3 10000 -report-type pmd -o sonar-reports/Wanna-oclint.xml
--------------------------------------------------------------------
>Skipping /Users/Aman/Desktop/Wanna/../Wanna/Wanna/Assets.xcassets. Compile command not found.
Skipping /Users/Aman/Desktop/Wanna/../Wanna/Wanna/Base.lproj. Compile command not found.
Skipping /Users/Aman/Desktop/Wanna/../Wanna/Wanna/Info.plist. Compile command not found.
Skipping /Users/Aman/Desktop/Wanna/../Wanna/Wanna/ViewController.swift. Compile command not found.
+ returnValue=0
+ set +x
Running FauxPas...Determining build settings for 3 targets and 2 build configurations
The Xcode project format is "Xcode 9.3". Faux Pas supports Xcode projects that are Xcode 8.0 or 6.3 or 3.2 or 3.1 -compatible. Some features may not work correctly.
Checking project: Wanna
target: Wanna
configuration: Release
ruleset: 86 Rules tagged [Recommended]: UndetachedDelegate, InvalidStringsFile, StringsFileEncoding, UIKitKVO, UnnecessaryNullCheck, RetinaImagesResolution, AssertionSideEffects, SuspiciousResources, NullCoalescingOp, LoadMethodWithoutAutoreleasePool, UnknownResourceCodeReference, StringsdictWithoutStrings, InitializeSuperInvocation, UnsupportedWeakReference, CompilerWarnings, HardcodedUIString, HardcodedSelfClass, MacroBasedIncludeGuard, RestrictedDirectMethodCall, RecommendedVCSIgnores, RetainingImmutableProperty, MissingAPIUsageDescription, CompleteNotificationCenterDetachment, XIBRuntimeAttributeMismatch, ThreadUnsafeInstanceCaching, MissingTranslation, RestrictedMethodOverride, MissingDeviceTypeResource, OldVerboseObjCSyntax, ViewLayoutInXIB, IsEqualAndHash, FileRefOutsideVCS, LiteralStringKeyPath, BasicProjectSettings, DuplicateTranslation, StrongDelegate, ConstructorReturnType, SetterInvocationInInitOrDealloc, ArgumentModification, FastEnumElementOutside, UnusedErrorValue, CopyingMutableProperty, ImplicitBundleId, UnnecessaryNibMethod, AssociatedObjectOnValueType, OrderedPointerToZeroComparison, PrefixHeaderIncludeSuggestion, ReleaseBuildCompilerArgs, XcconfigOverwrites, BuildSettingSelfReference, BuildSettingPlacement, FixedFormatDateFormatter, TerminatingApp, AbsPathInBuildSetting, PrivateCategory, FileRefWithAbsPath, MissingImageResolutionVariant, TranslationPunctuation, WeakReferenceToTopLevelXIBObject, UnprefixedClass, InitializeMethodCategoryOverride, SuspiciousDateTimeFormat, ReleaseBuildConfig, AssigningDelegate, UnknownResourceXIBReference, GlobalAndLocalizedResource, UnknownResourceModifier, Swizzling, ZeroAssignmentToPointer, DiscardedOpaqueNotificationObserver, DylibInstallName, TranslationFormatMismatch, SuspiciousMissingResources, ErrorConditionCheck, RedundantInclude, ReservedPrefix, NSLogUsed, UnprefixedCategoryMethod, UnidiomaticAccessorNaming, UncommentedLocalizedString, DuplicateResource, ViewControllerInitWithNibName, CategoryMethodConflict, BlockAPIRetainCycle, FileRefIgnoredInVCS, MissingNotificationCenterDetachment
Trial Version: Delaying operation for 15 more seconds…
Trial Version: Delaying operation for 14 more seconds…
Trial Version: Delaying operation for 13 more seconds…
Trial Version: Delaying operation for 12 more seconds…
Trial Version: Delaying operation for 11 more seconds…
Trial Version: Delaying operation for 10 more seconds…
Trial Version: Delaying operation for 9 more seconds…
Trial Version: Delaying operation for 8 more seconds…
Trial Version: Delaying operation for 7 more seconds…
Trial Version: Delaying operation for 6 more seconds…
Trial Version: Delaying operation for 5 more seconds…
Trial Version: Delaying operation for 4 more seconds…
Trial Version: Delaying operation for 3 more seconds…
Trial Version: Delaying operation for 2 more seconds…
Trial Version: Delaying operation for 1 more seconds…
Initialization: Determining VCS state...
Initialization: Resolving build settings...
Rule InvalidStringsFile will not be applied: “Applies to localized projects.”
Rule StringsFileEncoding will not be applied: “Applies to projects under Git version control.”
Rule LoadMethodWithoutAutoreleasePool will not be applied: “Applies to projects targeting an OS prior to iOS 6 or Mac OS 10.8.”
Rule StringsdictWithoutStrings will not be applied: “Applies to localized projects.”
Rule UnsupportedWeakReference will not be applied: “Applies to OS X targets.”
Rule HardcodedUIString will not be applied: “Applies to localized projects.”
Rule RecommendedVCSIgnores will not be applied: “Applies to projects under Git version control.”
Rule MissingTranslation will not be applied: “Applies to localized projects.”
Rule FileRefOutsideVCS will not be applied: “Applies to projects using one of these version control systems: Git, Mercurial, Bazaar, Subversion, Fossil.”
Rule DuplicateTranslation will not be applied: “Applies to localized projects.”
Rule PrefixHeaderIncludeSuggestion will not be applied: “Applies to projects that use a prefix header, and have at least 10 source code files.”
Rule TranslationPunctuation will not be applied: “Applies to localized projects.”
Rule DylibInstallName will not be applied: “Applies to OS X targets.”
Rule TranslationFormatMismatch will not be applied: “Applies to localized projects.”
Rule RedundantInclude will not be applied: “Applies to projects using a prefix header.”
Rule UncommentedLocalizedString will not be applied: “Applies to localized projects.”
Rule FileRefIgnoredInVCS will not be applied: “Applies to projects under Git version control.”
Rule MissingNotificationCenterDetachment will not be applied: “Applies to projects targeting an OS prior to iOS 9 or Mac OS 10.11.”
Initialization: Performing full build: required because project contains Swift code
Initialization: Building the project
Initialization: Processing build steps
ERROR: Initialization: Could not determine build steps for specified target 'Wanna'
Preparation failed → clearing build log caches
Checked total 0 code statements in 00:00:24.871 (the preparation took 00:00:09.792 (39.4%)).
Total 0 diagnostics.
(Evaluation trial limitation: only 5 random diagnostics will be returned when using machine-readable output.)
Some errors were encountered. If these are a problem, please consider the following remedies:
• Just try again — the project caches have now been cleared
• If source files are generated during builds, or if interpreting this project's source code otherwise depends on full builds to occur, enable the 'Build project before checking' option.
• In general, ensure that the xcodebuild arguments Faux Pas uses are correct: enable the 'verbose' option and try performing the checks to see what arguments are being used, and then determine if they need to be adjusted
Running Lizard...Running SonarQube using SonarQube Runner
+ sonar-scanner --define sonar.projectVersion=1.0
./run-sonar-swift.sh: line 101: sonar-scanner: command not found
+ returnValue=127
+ set +x
ERROR - Command 'sonar-scanner --define sonar.projectVersion=1.0' failed with error code: 127
Thanks in advance
You need to install sonar scanner first
brew install sonar-scanner

Force Bazel to use local java only

I'd like to use bazel in a locked-down environment, one without uncontrolled internet access. I'd like to force bazel to use the locally installed java, instead of downloading one. I could not figure out the required combination of flags - this is what I tried:
$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
$ javac -version
javac 1.8.0_171
$ bazel clean --expunge
$ bazel info release
release 0.24.1
$ bazel build //hello
# This builds a 'hello world' cpp file.
# This rule also downloads some rules, would be nice to avoid it as
INFO: Build completed successfully, 6 total actions well
$ bazel test --nofetch //hello:hello_test
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.160s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
I get the same results with a more intricate command line:
$ bazel test --nofetch --define=ABSOLUTE_JAVABASE=/usr/lib/jvm/java-8-openjdk-amd64 --host_javabase=#local_jdk//:jdk --javabase=#local_jdk//:jdk --host_java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 --java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 //hello:hello_test
INFO: Build options --define, --host_java_toolchain, --host_javabase, and 2 more have changed, discarding analysis cache.
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.215s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
I tried every combination of the java flags, no luck. I also tried to enable every incompatible change (--all_incompatible_changes), which yields to a different result:
INFO: Build options --incompatible_allow_python_version_transitions, --incompatible_auto_configure_host_platform, --incompatible_cc_coverage, and 24 more have changed, discarding analysis cache.
ERROR: While resolving toolchains for target //hello:hello_test: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
INFO: Elapsed time: 0.228s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
It now looks for #local_config_platform.
Is there a bazel target which I can build from source and includes these dependencies?
Is there a different command line, which enables bazel test --nofetch?
It appear that bootstrapping bazel from source can solve the issue. After downloading bazel-<version>-dist.zip from GitHub, in the unzipped folder:
env EXTRA_BAZEL_ARGS="--host_javabase=#local_jdk//:jdk" bash ./compile.sh
The compiled output is placed into output/bazel. This is a self-contained Bazel binary, without an embedded JDK.
https://docs.bazel.build/versions/master/install-compile-source.html

build abseil on windows using bazel

im trying to build abseil on windows using bazel,
the version im trying to build is :
abseil-cpp-20181200
im using the next bazel command:
bazel build
im getting this output:
INFO: Invocation ID: d85f94c1-e562-4ede-9bcd-9ab7e39020f3
Loading:
Loading: 0 packages loaded
Analyzing: 0 targets (0 packages loaded, 0 targets configured)
INFO: Analysed 0 targets (0 packages loaded, 0 targets configured).
INFO: Found 0 targets...
[0 / 1] [-----] BazelWorkspaceStatusAction stable-status.txt
INFO: Elapsed time: 0.261s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
I see that some folders were created in abseil-cpp-20181200
bazel-abseil-cpp-20181200
bazel-bin
bazel-genfiles
bazel-out
bazel-testlogs
these folders are empty.
the system im using is windows7 64 bit
if more info is needed please tell me and I will supply it,
help is appreciated
bazel build itself doesn't build anything. You'll have to specify a target to tell Bazel what to build. For example, if you want to build strings, specify the target //absl/strings:strings, or //absl/strings for short:
$ bazel build //absl/strings
See the C++ Quickstart for more information.

Resources