Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing local bazel doesn't work without android sdk #2559

Closed
ittaiz opened this issue Feb 21, 2017 · 10 comments
Closed

Testing local bazel doesn't work without android sdk #2559

ittaiz opened this issue Feb 21, 2017 · 10 comments
Assignees

Comments

@ittaiz
Copy link
Member

ittaiz commented Feb 21, 2017

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

I'm trying to follow the instructions on compiling bazel but it seems that without android sdk this doesn't work

If possible, provide a minimal example to reproduce the problem:

➜  bazel git:(master) bazel test //src/... //third_party/ijar/...
ERROR: /DEFAULT.WORKSPACE:81:1: in bind rule //external:android/sdk: The external label '//external:android/sdk' is not bound to anything.
ERROR: Analysis of target '//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_split_stub_application' failed; build aborted.
INFO: Elapsed time: 0.598s
ERROR: Couldn't start the build. Unable to run tests.

Environment info

  • Operating System:
    OS X El-Capitan 10.11.6

  • Bazel version (output of bazel info release):

development version

  • If bazel info release returns "development version" or "(@non-git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):
    54b9d2c

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).
#509 is related but it just wants the error message to be better. I would rather drop android sdk as a requirement.

@iirina
Copy link
Contributor

iirina commented Feb 21, 2017

When running the tests under //src/..., the tests for Android are also started. I'm not sure it would be a good idea to disable these tests by default, but rather improve our documentation on what basic tests to run, depending on whether the user is interested or not in Android.

Here are the instructions for running the Android tests.

@ittaiz
Copy link
Member Author

ittaiz commented Feb 21, 2017

@iirina thanks!
Don't the android instructions mandate something additional? What is /WORKSPACE.user?
Additionally the main problem is that the current documentation says to run //src/... while it doesn't work

@iirina
Copy link
Contributor

iirina commented Feb 21, 2017

/WORKSPACE.user is a file created by scripts/workspace_user.sh containing generated android_ndk_repository and android_sdk_repository rules. But yes you are right, you need to hame some environment variables set up (ANDROID_HOME, ANDROID_SDK, ANDROID_NDK) that also means you have to have Android set up.

I'm adding @aj-michael for Android support and @steren for the documentation part.

@ittaiz
Copy link
Member Author

ittaiz commented Feb 21, 2017 via email

@steren
Copy link
Contributor

steren commented Feb 21, 2017

adding @michelleirvine, the owner of our documentation

@aj-michael
Copy link
Contributor

There is some confusion here, the error that you got is not due to an Android test, it is due to building an Android tool:

//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_split_stub_application

You want to use the --build_tests_only flag and everything should be ok. You can see the full list of flags for this step here:

https://github.com/bazelbuild/bazel/blob/master/compile.sh#L218

We should update the documentation to include this flag.

@ittaiz
Copy link
Member Author

ittaiz commented Feb 21, 2017 via email

@aj-michael
Copy link
Contributor

While we're on the topic though, I should mention that //src/test/shell/bazel/android:android_integration_test will run and silently skip all the tests and return a pass if an android sdk and android ndk are not installed. I've been doing some work to make the process of setting up android_sdk_repository and android_ndk_repository be less of a burden in #2284, but it's not quite done yet.

At some point, I would like to make android_integration_test fail if no Android SDK is installed, to prevent people from committing Android-related code while forgetting to run these tests. @ittaiz I would be curious to hear your perspective on how you think we could best handle the android tests for people who do not have an Android SDK on hand.

@ittaiz
Copy link
Member Author

ittaiz commented Feb 22, 2017 via email

bazel-io pushed a commit that referenced this issue Feb 23, 2017
These targets are unneeded and do not build without an android_sdk_repository
set up.

This issue was identified in #2559.

--
PiperOrigin-RevId: 148251416
MOS_MIGRATED_REVID=148251416
@aj-michael
Copy link
Contributor

As of 65b49a2, bazel test //src/... no longer builds //src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_split_stub_application so marking this as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants