NativeScript / NativeScript/nativescript-cli

`tns run android` appends to .bash_profile/.zprofile even if denied for local build configuration

Abierto
#5,082 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
JavaScript
Estrellas
1.1k
Forks
204
Merge medio
1 d 9 h
PR fusionados (30 d)
8

Descripción

Environment

  • CLI: 6.1.2
  • Cross-platform modules: 6.0.7
  • Android Runtime: 6.1.2
  • iOS Runtime: 6.1.1
  • Plugin(s): -

Describe the bug
When running tns run android and if the environment is not properly set up, the automatic environment setup script for a local build will automatically append JAVA_HOME and ANDROID_HOME, as well as ANDROID_SDK_ROOT to .bash_profile / .zprofile even if install steps 3 and 4 are rejected.

This happens every time the installer is run up to these steps which leads to a spammed .bash_profile / .zprofile if the installer needs to be aborted or restarted a couple of times. This will also overwrite previously set variables.

The output of the cli is as follows:

Step 3 of 12:
Allow the script to install Open JDK 8?
(Y)es/(N)o
n
You have chosen not to install Open JDK 8. Some features of NativeScript may not work correctly if you haven't already installed it
Set JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Step 4 of 12:
Allow the script to install Android SDK?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
n
You have chosen not to install Android SDK. Some features of NativeScript may not work correctly if you haven't already installed it
Set ANDROID_HOME=/usr/local/share/android-sdk
Set ANDROID_SDK_ROOT=/usr/local/share/android-sdk
Configuring your system for Android development... This might take some time, please, be patient.
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration

To Reproduce

  1. Have an incomplete environment set up (e.g. do not have ANDROID_HOME as environment variable set)
  2. run tns run android in your project
  3. choose configure local build
  4. deny all steps 3 and 4
  5. check .bashprofile / .zprofile

Expected behavior
Have the setup script not append variables in .bashprofile / .zprofile or replace the variables if installation steps 3 and 4 are rejected.

Additional context
My .bash_profile after I had to retry the installer a couple of times:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el flujo de CLI tns run android y la configuración automática del entorno utilizada por configure local build; reproduce la secuencia de prompts rechazando los pasos 3 y 4. Rastrea cuándo se escriben JAVA_HOME, ANDROID_HOME y ANDROID_SDK_ROOT en .bash_profile o .zprofile. Se considera terminado cuando los pasos de instalación rechazados no añaden ni reemplazan estas variables, incluso después de reintentos repetidos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, javascript
Área
cli, mobile
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.