Page MenuHomePhabricator

[Nix] Add support for Android build on Darwin
ClosedPublic

Authored by jon on Jul 21 2022, 1:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 15, 5:31 PM
Unknown Object (File)
Wed, May 15, 5:31 PM
Unknown Object (File)
Wed, May 15, 5:31 PM
Unknown Object (File)
Wed, May 15, 5:31 PM
Unknown Object (File)
Wed, May 15, 5:29 PM
Unknown Object (File)
Wed, May 1, 11:11 PM
Unknown Object (File)
Mar 31 2024, 11:38 AM
Unknown Object (File)
Mar 31 2024, 11:38 AM

Details

Summary

Provide defaults for openjdk and the ANDROID_SDK_ROOT (follows
android studio defaults).

https://linear.app/comm/issue/ENG-1443/

Test Plan

On an intel or m1 mac:
Follow existing directions to download android sdk and ndk

nix develop
cd native/android && ./gradlew bundleRelease --no-daemon

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'm unable to test anything nix-related on macOS

ashoat added a subscriber: atul.

@atul my understanding is that this is for macOS not NixOS

@atul my understanding is that this is for macOS not NixOS

Yeah, unable to test anything nix-related on my Mac

What's the reason for that? We can't move forward with Nix support if a core member of the team is unable to run Nix...

(Maybe we should track in a Linear task?)

Unrelated, but building nodejs-16.13.0 takes a really long time. Any idea why?

This revision is now accepted and ready to land.Jul 22 2022, 11:21 AM

What's the reason for that? We can't move forward with Nix support if a core member of the team is unable to run Nix...

(Maybe we should track in a Linear task?)

Something is broken with the Nix Store partition and I'm scared to mess with it.

There's like a long list of uninstallation steps that I found and will try to go through. Hopefully uninstalling and re-installing should resolve things without breaking things any further. I'm going to do a full backup of my computer first in case something goes wrong (which it seems like it has for many people based on GitHub issues).

If uninstalling/reinstalling doesn't work, I'll write up a Linear issue. But figured I'd give that a shot first.

I'm upgrading to 12.5 to see if it breaks anything

varun requested changes to this revision.Jul 22 2022, 11:33 AM
varuns-MacBook-Pro:android varun$ ./gradlew bundleRelease --no-daemon
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.9/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build 
(node:87685) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/varun/Code/comm/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> com.android.builder.errors.EvalIssueException: SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/varun/Code/comm/native/android/local.properties'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
varuns-MacBook-Pro:android varun$ echo $ANDROID_SDK_ROOT
/Users/varun/Library/Android/sdk

The test plan actually didn't work for me. The env var is set but the SDK still can't be located

This revision now requires changes to proceed.Jul 22 2022, 11:33 AM

What's the result of ls /Users/varun/Library/Android/sdk, you should have ~11 folders

What's the result of ls /Users/varun/Library/Android/sdk, you should have ~11 folders

That folder doesn't exist for me

/Users/varun/Library/Android/sdk/bin/sdkmanager --list (from the nix shell) should also show a lot of output

The Android directory doesn't exist for me inside Library.

I haven't nix-ified the android sdk installation yet, so you would need to still follow https://github.com/CommE2E/comm/blob/master/docs/dev_environment.md#android-studio and the android sdk installation part.

I'll create a task

This revision is now accepted and ready to land.Jul 27 2022, 12:53 PM