Skip to content

Conversation

@vimanyu
Copy link
Contributor

@vimanyu vimanyu commented Mar 25, 2021

Fixes a series of issues that were causing Windows Android builds to error out.

  1. flatbuffers was not getting downloaded as an external library and gradle/cmake build was failing to find cmake function build_flatbuffers
  2. Android Gradle CMake was invoking system level CMake as a child process to download and build external libraries. In addition to using the same cmake as the parent process, some CMake options had to be passed through to the child process to make it work correctly. For example, Android Gradle CMake prefers to use the generator "Android Gradle - Ninja" and ninja as the make program.
  3. strings.exe is a special utility tool required on Android/Windows. Our android build script was downloading strings.exe to the repo root but since the PATH was not modified, this downloaded tool wasn't found. Additionally, there is another conflicting strings.exe on Github runners which meant that we have to prepend our repo root directory to the PATH variable on Github runners.
  4. strings.exe prompts for accepting license on first invocation. Found an undocumented flag -accepteula that accepts the license which is run in a dummy github workflow step. Just running with this fails exits the command with error code but we ignore that error.

vimanyu added 17 commits March 24, 2021 19:17
For downloading external third party libraries, our cmake system
runs a child process cmake command to configure/build external libraries.
For Android/Windows combination, a specific cmake configuration is used
using a toolchain from the android ndk and it's own distinct make program.
We want to ensure that these values are passed to the child cmake too.
-accepteula works just on Windows. Linux/Mac runners are hanging
indefinitely when this flag is supplied. Took it out from gradle
and instead added a "dummy" step in workflow to just accept the license.
@google-cla google-cla bot added the cla: yes label Mar 25, 2021
@DellaBitta DellaBitta added the tests-requested: quick Trigger a quick set of integration tests. label Mar 25, 2021
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels Mar 25, 2021
@github-actions
Copy link

github-actions bot commented Mar 25, 2021

❌  Integration test FAILED

Requested by @DellaBitta on commit b0fe3b7
Last updated: Thu Mar 25 06:44:53 PDT 2021
View integration test results

DellaBitta
DellaBitta previously approved these changes Mar 25, 2021
Copy link
Contributor

@DellaBitta DellaBitta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but also please check my comments.


execute_process(
COMMAND ${ENV_COMMAND} cmake --build . -- ${cmake_build_args}
COMMAND ${ENV_COMMAND} ${CMAKE_COMMAND} --build . -- ${cmake_build_args}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there really be a space between -- and ${cmake_build_args} ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just not clear on why we use the "--" at all - typically that's how you separate sets of arguments, for example the arguments afterwards are sent to a subprocess, or are considered a list of filenames even if they start with a "-". But why is that necessary here?

(For example, if you have a filename called "-q", you can't normally run "grep hello -q" because grep will interpret "-q" as an argument. So you must do "grep hello -- -q" which tells grep that everything following the "--" is a filename. But I'm still not sure why that's required for this cmake call.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more you know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I didn't spot this and am not sure why this exists. I substituted hard coded cmake to using a variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with the "--" though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change that I made is "cmake" converted to "${CMAKE_COMMAND}". Will investigate why the "-- ${cmake_build_args}" exists in another PR as I don't want to introduce new changes for this Windows/Android task.

"android": {
"matrix": {
"os": ["ubuntu-latest", "macos-latest"],
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Mar 25, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Mar 25, 2021
vimanyu added 2 commits March 25, 2021 13:41
Noticed errors in Build logs complaining of CMakeLists not specifying
minimum version.
@jonsimantov jonsimantov removed the tests: failed This PR's integration tests failed. label Mar 29, 2021
@vimanyu
Copy link
Contributor Author

vimanyu commented Mar 29, 2021

Integration tests builds are also fixed now.
https://github.com/firebase/firebase-cpp-sdk/runs/2221512221?check_suite_focus=true

The only error was with the Storage test which is unrelated to issues with building on Windows for Android.

[  FAILED  ] FirebaseStorageTest.TestLargeFilePauseResumeAndDownloadCancel

@vimanyu vimanyu merged commit 6071a27 into main Mar 29, 2021
@vimanyu vimanyu deleted the feature/fix-android-windows-builds branch March 29, 2021 22:22
@vimanyu vimanyu self-assigned this Mar 29, 2021
@firebase firebase locked and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants