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

Windows, Android: building //examples/android/java/bazel:hello_world is broken at HEAD #3808

Closed
laszlocsomor opened this issue Sep 25, 2017 · 2 comments
Assignees
Labels
bazel.build P1 I'll work on this now. (Assignee required) platform: windows type: bug

Comments

@laszlocsomor
Copy link
Contributor

$ git rev-parse HEAD
9ebc4b222c5eb3d788ec4f6ae837d8e745105b02

I built Bazel, then used the binary to build the Android example:

C:\work\bazel>C:/tmp1/o6hbs7n0/execroot/io_bazel/bazel-out/msvc_x64-fastbuild/bin/src/bazel.exe build //examples/android/java/bazel:hello_world --python_path=c:\Python27\python.exe
(...)
ERROR: C:/tempdir/temp/_bazel_laszlocsomor/o6hbs7n0/external/androidsdk/com.android.support/BUILD:419:1: AarResourcesExtractor external/androidsdk/com.android.support/_aar/unzipped/resources/appcompat-v7-25.0.0 failed (Exit 1).
Traceback (most recent call last):
  File "c:\tempdir\temp\Bazel.runfiles_ek1fej\runfiles\io_bazel\..\bazel_tools\tools\android\aar_resources_extractor.py", line 68, in <module>
    main()
  File "c:\tempdir\temp\Bazel.runfiles_ek1fej\runfiles\io_bazel\..\bazel_tools\tools\android\aar_resources_extractor.py", line 64, in main
    ExtractResources(aar, FLAGS.output_res_dir)
  File "c:\tempdir\temp\Bazel.runfiles_ek1fej\runfiles\io_bazel\..\bazel_tools\tools\android\aar_resources_extractor.py", line 53, in ExtractResources
    aar.extract(name, output_res_dir)
  File "c:\Python27\lib\zipfile.py", line 1028, in extract
    return self._extract_member(member, path, pwd)
  File "c:\Python27\lib\zipfile.py", line 1079, in _extract_member
    os.mkdir(targetpath)
WindowsError: [Error 206] The filename or extension is too long: u'bazel-out\\android-arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-fastbuild\\bin\\external\\androidsdk\\com.android.support\\_aar\\unzipped\\resources\\appcompat-v7-25.0.0\\res\\drawable-xxhdpi-v4'

/cc @aj-michael

@aj-michael
Copy link
Contributor

I'm not aware of any Android changes that would have extended this path length

@laszlocsomor
Copy link
Contributor Author

The reason seems to be that aar_resources_extractor uses MAX_PATH (260) as the length limit before creating junctions, which is fine for files, but for directories the limit is 248. I'll fix that.

Also, aar_embedded_jars_extractor also needs to handle long paths, so I'll fix that too to use junctions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel.build P1 I'll work on this now. (Assignee required) platform: windows type: bug
Projects
None yet
Development

No branches or pull requests

2 participants