#!/bin/bash

# This is used by android-shell-app.js
set -eo pipefail

if [ -f /etc/profile ]; then
  source /etc/profile >/dev/null
fi

if [ -f ~/.bash_profile ]; then
  source ~/.bash_profile >/dev/null
fi

pushd ../../tools-public/
mkdir -p ../android/expoview/src/main/java/host/exp/exponent/generated/

gulp generate-dynamic-macros --buildConstantsPath ../android/expoview/src/main/java/host/exp/exponent/generated/ExponentBuildConstants.java --platform android
popd

#!/bin/bash

# This is used by android-shell-app.js
set -eo pipefail

# Initialize the shell if we aren't already running in a terminal (initialize just once)
if [[ -z "$TERM" ]] || [[ $TERM == "dumb" ]]; then
  if [ -f /etc/profile ]; then
    source /etc/profile >/dev/null
  fi

  if [ -f ~/.bash_profile ]; then
    source ~/.bash_profile >/dev/null
  fi
fi

pushd ../../tools-public/
mkdir -p ../android/expoview/src/main/java/host/exp/exponent/generated/

gulp generate-dynamic-macros --buildConstantsPath ../android/expoview/src/main/java/host/exp/exponent/generated/ExponentBuildConstants.java --platform android
popd

Set up bash environment only if we weren't already in a terminal
Set up bash environment only if we weren't already in a terminal

If we're running generate-dynamic-macros from a terminal (e.g. from run.sh) we just use the inherited environment. But if we're running from a Gradle script invoked by Android Studio we still need to set up the environment.

Test Plan: Build Android twice, once via the Run button in Android Studio and once via run.sh

fbshipit-source-id: 021dd1d
