NativeScript / NativeScript/nativescript-cli

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

Aperta
#5,082 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
1.1k
Fork
204
Merge medio
1g 9h
PR unite (30g)
8

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con il flusso CLI tns run android e con la configurazione automatica dell’ambiente utilizzata da configure local build; riproduci la sequenza di prompt rifiutando i passaggi 3 e 4. Traccia quando JAVA_HOME, ANDROID_HOME e ANDROID_SDK_ROOT vengono scritte in .bash_profile o .zprofile. Il lavoro è completato quando i passaggi di installazione rifiutati non aggiungono né sostituiscono queste variabili, anche dopo ripetuti tentativi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, javascript
Ambito
cli, mobile
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.