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

Expo EAS server configuration for iOS does not include Java #11

Closed
peterbee opened this issue Jan 25, 2023 · 9 comments · Fixed by #12
Closed

Expo EAS server configuration for iOS does not include Java #11

peterbee opened this issue Jan 25, 2023 · 9 comments · Fixed by #12

Comments

@peterbee
Copy link

My iOS builds are failing on Expo EAS because Java is not found. The EAS Server Configuration documentation also does not mention Java on iOS build machines.

The Android build worked correctly.

Have iOS builds worked with shadow-cljs release app on EAS in the past?

Script 'eas-build-post-install' is present in package.json, running it...
> [email protected] eas-build-post-install
> npx shadow-cljs release app
[stderr] shadow-cljs - config: /Users/expo/workingdir/build/shadow-cljs.edn
[stderr] The operation couldn’t be completed. Unable to locate a Java Runtime.
[stderr] Please visit http://www.java.com for information on installing Java.
[stderr] ===== ERROR =================
[stderr] java process exit with non-zero exit code
[stderr] =============================
npm exited with non-zero code: 1
@thheller
Copy link
Owner

shadow-cljs uses Clojure (which runs in the JVM) to build the code. Therefore java is required.

I don't know any particulars about any third party services, or whether they include java or not. I don't even know what EAS is, so I really cannot offer any help on this.

@peterbee
Copy link
Author

Looks like @wodin added the EAS Build notes in the Readme.

@wodin Have you been able to build for iOS on EAS?

@wodin
Copy link
Contributor

wodin commented Jan 26, 2023

Hi @peterbee

I just saw your question here now. As I mentioned on the Expo forums you could try to install Java in a pre-build hook, but it might be best to just build the ClojureScript code before running eas build.

@thheller, you're probably not terribly interested, but just in case: EAS is Expo Application Services, which includes a build service (EAS Build) for Expo apps and other React Native apps. So basically you run eas build and it uploads your code to one of their Android or iOS build workers, installs the JavaScript dependencies, generates the native Android or iOS project (by running npx expo prebuild) and then builds the app like any normal React Native app. Basically, EAS Build is how you build Expo apps these days. The old expo build:* is no longer supported.

@thheller
Copy link
Owner

Seems like there should be a supported image that can handle all the IOS stuff and also has Java?

@wodin
Copy link
Contributor

wodin commented Jan 26, 2023

This app should work as-is for Android, but given that the iOS build workers don't seem to have Java installed, I think I should update the documentation (and probably remove the eas-build-post-install hook from package.json again).

The most straightforward approach to building this app using Expo's EAS Build service is to build the ClojureScript code before running eas build .... There is one problem with this, though:

The eas build command does not upload the app directory because it's listed in .gitignore.

There are a couple of ways around this:

  1. Just remove app from .gitignore. Of course this means you either have these files cluttering up your git status or else you have to commit these generated files. Neither of these options is that great, but maybe committing them is not that bad
  2. Copy .gitignore to .easignore and remove app from the latter. Then you can have still keep app out of your Git repository while allowing eas build to upload it to the build worker. This has the potential for .gitignore and .easignore getting out of sync

I'm leaning towards just committing the app directory.

@thheller do you have any opinion on the above?

Seems like there should be a supported image that can handle all the IOS stuff and also has Java?

Yes, maybe you're right. Maybe I can get an opinion on that from the Expo team

@thheller
Copy link
Owner

I'd very strongly recommend to never commit build output to git. That is just terrible.

However, if thats the only way to get it to build go for it. I have never and will never use any of this, so do what gets the job done. ;)

@wodin
Copy link
Contributor

wodin commented Jan 27, 2023

My impression is that the Expo team seems understandably unwilling to bulk up every macOS builder with a Java installation that the vast majority of users won't need. Although they do have different build types that you can choose from, they are only for different versions of the OS, Xcode, etc.

But fortunately, Homebrew is available on the build workers, and installing temurin11 (or whatever version you need) takes a minute or two.

I gave the following a try and it worked fine:

build-cljs.sh

#!/bin/bash

set -e

if [[ "$EAS_BUILD_PLATFORM" == "ios" ]]; then
  HOMEBREW_NO_AUTO_UPDATE=1 brew install homebrew/cask-versions/temurin11
fi

exec npx shadow-cljs release app

package.json

{
  "scripts": {
    "eas-build-post-install": "./build-cljs.sh"
  }
}

In the test app, I did not actually have a Shadow CLJS project, though. No shadow-cljs.edn etc. So shadow-cljs complained, but it still exited with a 0 exit status, which was surprising. But I see that it does exit with an exit status of 1 if e.g. there's an empty shadow-cljs.edn, so this is probably not a big problem.

@thheller
Copy link
Owner

Might still be good to open a support ticket. They already seem to provide a couple different images, should be easy to add one that also has a JVM installed.

@wodin
Copy link
Contributor

wodin commented Jan 27, 2023

I agree it shouldn't be that hard for them to add another image, but they don't have any similar variations at the moment. It's currently just variations in OS versions and Xcode/node/etc. versions. Adding a new macOS image with Java would mean they would have to maintain that going forward (and possibly different images for different OS, Xcode, etc. versions), so I would understand if they don't want to do that.

Anyway, I'm OK with the status quo. If someone else wants to persuade the Expo team to create a macOS + Java image, then they can create the ticket :)

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

Successfully merging a pull request may close this issue.

3 participants