Gradle error when building the android-support-test project - android-testing

I'm trying to build the Android Support Testing project. I'm following these instructions. I've got my build env setup and I've synced the Repo. When I try to build the project I get this error.
$ pwd
/Volumes/android/android-support-test
$ ls -l
-r--r--r-- 1 me staff 87 Feb 5 12:56 Makefile
-rw-r--r-- 1 me staff 749 Feb 5 16:14 android-support-test.iml
drwxr-xr-x 11 me staff 374 Feb 5 12:56 build
lrwxr-xr-x 1 me staff 31 Feb 5 12:57 build.gradle -> frameworks/testing/build.gradle
drwxr-xr-x 16 me staff 544 Feb 5 12:57 external
drwxr-xr-x 4 me staff 136 Feb 5 12:57 frameworks
drwxr-xr-x 3 me staff 102 Feb 5 16:14 gradle
-r-xr-xr-x 1 me staff 5884 Feb 5 12:57 gradlew
lrwxr-xr-x 1 me staff 35 Feb 5 12:57 local.properties -> frameworks/testing/local.properties
drwxr-xr-x 3 me staff 102 Feb 5 16:17 out
drwxr-xr-x 7 me staff 238 Feb 5 12:57 prebuilts
lrwxr-xr-x 1 me staff 34 Feb 5 12:57 settings.gradle -> frameworks/testing/settings.gradle
$ ./gradlew assembleDebug
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/2.5/userguide/gradle_daemon.html.
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* Where:
Build file '/Volumes/android/android-support-test/frameworks/testing/build.gradle' line: 16
* What went wrong:
A problem occurred evaluating root project 'android-support-test'.
> Could not read script '/Volumes/android/android-support-test/version.gradle' as it does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.31 secs
The version.gradle file is in /Volumes/android/android-support-test/frameworks/testing but build.gradle is looking for it in /Volumes/android/android-support-test.
I think the aliasing of build.gradle -> frameworks/testing/build.gradle is not working correctly. Am I missing something?

The frameworks/testing Repo project should have contained an additional sym link, but you can just create it yourself:
ln -s frameworks/testing/version.gradle version.gradle
h/t to John Lombardo on the Android Testing Support Library google group

Related

How to setup Jenkins Xcode plugin for workspaces?

I am green to the iOS app development space. I need to setup a build in Jenkins for a new Swift application I built. As part of that, I used Cocoapods to manage dependencies which in turn, meant I now had a workspace instead of a simple project.
I'm now trying to build this application as part of our pipepline and have hit the following error:
FATAL: Since there are multiple projects in the workspace, you must be specify the location of the target project as Xcode Project File.
Build step 'Xcode' marked build as failure
Finished: FAILURE
The root of my project looks as follows:
$ ls -la
total 32
drwxr-xr-x 14 mcbint staff 448 15 Jan 15:16 .
drwxr-xr-x 3 mcbint staff 96 15 Jan 14:33 ..
drwxr-xr-x 13 mcbint staff 416 16 Jan 11:11 .git
-rw-r--r-- 1 mcbint staff 108 15 Jan 14:56 .gitignore
-rw-r--r-- 1 mcbint staff 501 15 Jan 14:56 Podfile
-rw-r--r-- 1 mcbint staff 379 15 Jan 14:56 Podfile.lock
drwxr-xr-x 9 mcbint staff 288 15 Jan 15:16 Pods
-rw-r--r-- 1 mcbint staff 666 15 Jan 14:56 README.md
drwxr-xr-x 10 mcbint staff 320 15 Jan 14:56 mcb-phoneagent-ios
drwxr-xr-x 5 mcbint staff 160 15 Jan 15:16 mcb-phoneagent-ios.xcodeproj
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-ios.xcworkspace
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-iosTests
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-iosUITests
drwxr-xr-x 2 mcbint staff 64 15 Jan 15:07 test-reports
I have setup the project in xcode as follows:
On my development machine I can successfully build the application with the command:
xcodebuild -workspace mcb-phoneagent-ios.xcworkspace -scheme mcb-phoneagent-ios
Does anybody see anything I've setup incorrectly?
This is how I resolved this issue when i ran into it:
Make sure that you have your scheme container set to the workspace (not the project. This can be checked in Xcode in Product -> Scheme -> Manage Schemes, then look in the column titled "Container")
confirm that the xcshareddata is in the workspace directory that Jenkins is using.
In Jenkins Under the General build settings of the Xcode there is a "Settings" button
click on it and find the Xcode schema file text box.
Fill that box in with the name of the xcsheme file you want to use for the given workspace that was entered as the Xcode Workspace file (in your case I'm guessing it would be mcb-phoneagent-ios).
Since you use Cocopod, you need to use the *.xcworkspace file, not the *.workspace,
and from personal experience much easier to archive and use *.app files with jenkins instead of letting it to build for u the projects

How to specify a target BUILD file

I am trying to build/install the dependencies of a project called envoy.
The project directory looks like this:
$ ls -salt
total 176
0 drwxr-xr-x. 3 app app 37 Aug 31 13:06 ..
4 drwxrwxr-x. 16 app app 4096 Aug 4 02:28 .
0 drwxrwxr-x. 2 app app 23 Aug 4 02:28 .circleci
4 -rwxrwxr-x. 1 app app 259 Aug 4 02:28 .clang-format
0 drwxrwxr-x. 2 app app 22 Aug 4 02:28 .github
4 -rw-rw-r--. 1 app app 217 Aug 4 02:28 .gitignore
4 -rw-rw-r--. 1 app app 61 Aug 4 02:28 BUILD
4 -rw-rw-r--. 1 app app 433 Aug 4 02:28 CODEOWNERS
4 -rw-rw-r--. 1 app app 139 Aug 4 02:28 CODE_OF_CONDUCT.md
12 -rw-rw-r--. 1 app app 10993 Aug 4 02:28 CONTRIBUTING.md
4 -rw-rw-r--. 1 app app 1421 Aug 4 02:28 DCO
8 -rw-rw-r--. 1 app app 4221 Aug 4 02:28 DEPRECATED.md
4 -rw-rw-r--. 1 app app 2189 Aug 4 02:28 DEVELOPER.md
12 -rw-rw-r--. 1 app app 8202 Aug 4 02:28 GOVERNANCE.md
4 -rw-rw-r--. 1 app app 1718 Aug 4 02:28 ISSUE_TEMPLATE.md
12 -rw-rw-r--. 1 app app 11358 Aug 4 02:28 LICENSE
4 -rw-rw-r--. 1 app app 108 Aug 4 02:28 NOTICE
4 -rw-rw-r--. 1 app app 2923 Aug 4 02:28 OWNERS.md
4 -rw-rw-r--. 1 app app 2211 Aug 4 02:28 PULL_REQUEST_TEMPLATE.md
8 -rw-rw-r--. 1 app app 4844 Aug 4 02:28 README.md
8 -rw-rw-r--. 1 app app 6907 Aug 4 02:28 REPO_LAYOUT.md
16 -rw-rw-r--. 1 app app 13200 Aug 4 02:28 SECURITY_RELEASE_PROCESS.md
12 -rw-rw-r--. 1 app app 12085 Aug 4 02:28 STYLE.md
4 -rw-rw-r--. 1 app app 6 Aug 4 02:28 VERSION
4 -rw-rw-r--. 1 app app 514 Aug 4 02:28 WORKSPACE
4 drwxrwxr-x. 9 app app 4096 Aug 4 02:28 api
4 drwxrwxr-x. 3 app app 4096 Aug 4 02:28 bazel
4 drwxrwxr-x. 4 app app 4096 Aug 4 02:28 ci
4 drwxrwxr-x. 4 app app 4096 Aug 4 02:28 configs
4 drwxrwxr-x. 3 app app 4096 Aug 4 02:28 docs
4 drwxrwxr-x. 8 app app 4096 Aug 4 02:28 examples
0 drwxrwxr-x. 3 app app 18 Aug 4 02:28 include
0 drwxrwxr-x. 2 app app 41 Aug 4 02:28 restarter
0 drwxrwxr-x. 7 app app 70 Aug 4 02:28 source
0 drwxrwxr-x. 3 app app 50 Aug 4 02:28 support
4 drwxrwxr-x. 15 app app 4096 Aug 4 02:28 test
4 drwxrwxr-x. 6 app app 4096 Aug 4 02:28 tools
There are two bazel WORKSPACE files:
$ find . -iname WORKSPACE
./WORKSPACE
./ci/WORKSPACE
I guess I have to build the bazel native dependencies from the top directory, but i do not know how to specify the target BUILD file. Could you please advise on the bazel build
command to achieve that ?
EDIT: am trying to build what is mentioned in step#2 over here https://github.com/envoyproxy/envoy/blob/master/bazel/README.md
EDIT #2: when doing $ bazel build //source/exe:envoy
i get the following error
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule #com_github_grpc_grpc//:grpc_nanopb: please do not import '#com_github_grpc_grpc//third_party/nanopb:pb_common.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule #com_github_grpc_grpc//:grpc_nanopb: please do not import '#com_github_grpc_grpc//third_party/nanopb:pb_decode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule #com_github_grpc_grpc//:grpc_nanopb: please do not import '#com_github_grpc_grpc//third_party/nanopb:pb_encode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
ERROR: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/io_bazel_rules_go/proto/BUILD.bazel:21:1: no such package '#org_golang_x_net//context': failed to fetch org_golang_x_net: 2018/09/12 03:10:46 unrecognized import path "golang.org/x/net"
and referenced by '#io_bazel_rules_go//proto:go_grpc'
ERROR: Analysis of target '//source/exe:envoy' failed; build aborted: no such package '#org_golang_x_net//context': failed to fetch org_golang_x_net: 2018/09/12 03:10:46 unrecognized import path "golang.org/x/net"
INFO: Elapsed time: 73.577s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (253 packages loaded)
Could you please advise further ?
EDIT #3: For reasons of completeness, I run this under scl so that i have a more recent GCC version
- name: "Install envoy dependencies"
yum: name="{{ item }}" state=latest
with_items:
- cmake
- libtool
- libstdc++
- bazel
- centos-release-scl
- devtoolset-7-gcc-c++ # scl enable devtoolset-7 bash
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
meaning that I enter a shell by typing scl enable devtoolset-7 bash and then the usual stuff
From DEVELOPER.md, to build Envoy:
$ bazel build //source/exe:envoy
This //source/exe:envoy target is defined in source/exe/BUILD.
To run all tests:
$ bazel test //test/...
... refers to all targets, recursively.
To run a specific tests, e.g. async_client_impl_test defined in test/common/http/BUILD. //test/common/http is the package name.
$ bazel test //test/common/http:async_client_impl_test
You can run these commands from anywhere in the project directory because of // in the absolute target labels.
Can you try "go get -u google.golang.org/grpc" and see if it works?

Jenkins symlinks/permalinks broken after restart

Jenkins version 2.114 is running builds but they seem to disappear from the Dashboard after a restart. I have Jenkins setup on Linux and all the log is present under
${JENKINS_HOME}/jobs/${ITEM_FULL_NAME}/builds
I have tried Reload Configuration from Disk with following set in /etc/sysconfig/jenkins
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
Below is build and workspace directory settings:
Workspace Root Directory :${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}
Build Record Root Directory: ${ITEM_ROOTDIR}/builds
Below you can see the build number 117 and 118, but still, the lastFailedBuild, lastStableBuild , lastSuccessfulBuild are set to -1, which doesn't exist
drwxr-xr-x 4 jenkins jenkins 4096 Apr 2 20:17 117
drwxr-xr-x 4 jenkins jenkins 4096 Apr 3 20:17 118
lrwxrwxrwx 1 jenkins jenkins 2 Apr 3 11:09 lastFailedBuild -> -1
lrwxrwxrwx 1 jenkins jenkins 2 Apr 4 10:44 lastStableBuild -> -1
lrwxrwxrwx 1 jenkins jenkins 2 Apr 4 03:21 lastSuccessfulBuild -> -1
lrwxrwxrwx 1 jenkins jenkins 2 Apr 3 10:58 lastUnstableBuild -> -1
lrwxrwxrwx 1 jenkins jenkins 2 Apr 3 10:58 lastUnsuccessfulBuild -> -1
I have also set the
Discard Old Builds Slicer - Days to keep artifacts as 30
Discard Old Builds Slicer - Max # of builds to keep as 40
I ran the jenkins-job-checker[ https://github.com/docwhat/jenkins-job-checker ] on one of the jobs and found the following :
Problem: NOTLINK: The number link builds/1 is not a symlink!
Problem: NOTLINK: The number link builds/2 is not a symlink!
Problem: NOTLINK: The number link builds/3 is not a symlink!
Proposal: Archive non-link builds/1
Proposal: Archive non-link builds/2
Proposal: Archive non-link builds/3
Really appreaciate some help
The links have been replaced with the permalinks file:
rwxr-xr-x 2 jenkins jenkins 4096 Aug 6 2018 98
drwxr-xr-x 2 jenkins jenkins 4096 Aug 7 2018 99
lrwxrwxrwx 1 jenkins jenkins 3 Jan 19 13:47 lastFailedBuild -> 649
lrwxrwxrwx 1 jenkins jenkins 3 Jan 19 13:48 lastSuccessfulBuild -> 622
lrwxrwxrwx 1 jenkins jenkins 2 Jun 14 2018 lastUnstableBuild -> -1
lrwxrwxrwx 1 jenkins jenkins 3 Jan 19 13:49 lastUnsuccessfulBuild -> 649
-rw-r--r-- 1 jenkins jenkins 0 Jun 14 2018 legacyIds
-rw-r--r-- 1 jenkins jenkins 134 Jan 19 14:42 permalinks
jenkins#ip-1-9-2-253_jenkins:~/jobs/cron_dockers/jobs/ios/builds$ cat permalinks
lastCompletedBuild 651
lastFailedBuild 650
lastStableBuild 651
lastSuccessfulBuild 651
lastUnstableBuild -1
lastUnsuccessfulBuild 650
Make sure the values in the permalinks file are correct, these are the values that are used to generate the values in the Jenkins GUI.
I installed the plugin operations-center-context and that solved my problem
I found the solution in below link:
https://support.cloudbees.com/hc/en-us/articles/216227047-After-moving-a-job-symlinks-for-folders-became-actual-folders

Buck build failing for "events-logs" Gerrit plugin (jar)

I am trying to build Gerrit plugin "events-log" jar ( https://gerrit.googlesource.com/plugins/events-log) via Buck build, but its failing with below error:
root#jenkins-test:~/events-log# ll
drwxr-xr-x 7 root root 4096 Jun 29 13:25 ./
drwxrwxr-x 24 root root 4096 Jun 29 13:22 ../
-rw-r--r-- 1 root root 1017 Jun 29 12:57 BUCK
-rw-r--r-- 1 root root 173 Jun 29 12:57 .buckconfig
drwxr-xr-x 3 root root 4096 Jun 29 13:25 .buckd/
drwxr-xr-x 6 root root 4096 Jun 29 13:05 buck-out/
drwxr-xr-x 8 root root 4096 Jun 29 13:27 .git/
-rw-r--r-- 1 root root 146 Jun 29 12:57 .gitignore
drwxr-xr-x 5 root root 4096 Jun 29 12:57 lib/
drwxr-xr-x 4 root root 4096 Jun 29 12:57 src/
root#jenkins-test:~/events-log# /root/buck/bin/buck build events-log:events-
log
Using buckd.
BUILD FAILED: No build file at events-log/BUCK when resolving target
//events-log:events-log.
Can somebody please tell how to fix it and build the jar.
Thanks
I think I've finally figured it out ...
What I wound up doing is checking out Gerrit and building the events-log plugin in the Gerrit tree.
git clone https://gerrit.googlesource.com/gerrit
cd gerrit
git co v2.11.2
git submodule init
git submodule update
git clone https://gerrit.googlesource.com/plugins/events-log plugins/events-log
buck build plugins/events-log
I'm pretty sure you just want /root/buck/bin/buck build //:events-log. See http://buckbuild.com/concept/build_target.html
Eventually I found src/main/resources/Documentation/build.md, with which I finally succeeded in building events-log:
git clone https://gerrit.googlesource.com/plugins/events-log
git clone https://gerrit.googlesource.com/bucklets
cd events-log
git checkout stable-2.12
ln -s ../bucklets .
ln -s bucklets/buckversion .buckversion
ln -s bucklets/watchmanconfig .watchmanconfig
buck build plugin
This builds buck-out/gen/events-log.jar.
If the version is 2.14 or later, please use bazle to build
And I also try to build v2.13 with buck, you need to modify gerrit_plugin.bucklet which is under bucklets folder
Old content:
target_suffix = ''):
from multiprocessing import cpu_count
from os import path,getcwd
New content:
target_suffix = ''):
with allow_unsafe_import():
from multiprocessing import cpu_count
from os import path,getcwd
Then execute "buck build plugin
Out put:
ruhu#CCM-P700:~/tools/events-log$ buck build plugin
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1-sources.jar
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar
Download http://repo1.maven.org/maven2/com/google/gerrit/gerrit-plugin-api/2.13/gerrit-plugin-api-2.13.jar
Parsing buck files: finished in 1.3 sec (100%)
Creating action graph: finished in 1.6 sec (100%)
Building: finished in 03:47.3 min (100%) 19/19 jobs, 19 updated, 94.7% cache mis
Total time: 03:50.3 min

idlj parameter invalid argument -td mac?

Im trying to follow a tutorial to do a CORBA assignment.
project
-Client/HelloClient.java
-Server/HelloServer.java
-Hello.idl
I do the first step, trying to compile the IDL (from the project root), and it fails.
$ idlj –td Client –fclient Hello.idl
com.sun.tools.corba.se.idl.InvalidArgument: Invalid argument: –td.
java version "1.8.0_11"
$ ls -l
total 16
drwxr-xr-x 3 juliusskye staff 102 Oct 28 20:14 Client
-rw-r-----# 1 juliusskye staff 85 Oct 28 17:49 Hello.idl
drwxr-xr-x 3 juliusskye staff 102 Oct 28 17:52 Server
-rw-r--r-- 1 juliusskye staff 425 Oct 29 13:45 idljintro.iml
drwxr-xr-x 2 juliusskye staff 68 Oct 29 13:45 src
I found this which says CORBA has problems parsing paths with / in front. But mine doesn't have a /
apparently the Lecturer's instructions were wrong or outdated or the compiler is not fully working but compilation of all files is achieved by
idlj -fall hello.idl

Resources