NativeScript / NativeScript/nativescript-cli

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

Đang mở
#5,082 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
204
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
8

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với luồng CLI tns run android và thiết lập môi trường tự động được configure local build sử dụng; tái hiện chuỗi lời nhắc bằng cách từ chối các bước 3 và 4. Theo dõi thời điểm JAVA_HOME, ANDROID_HOMEANDROID_SDK_ROOT được ghi vào .bash_profile hoặc .zprofile. Được xem là hoàn tất khi các bước cài đặt bị từ chối không nối thêm hoặc thay thế các biến này, kể cả sau nhiều lần thử lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, javascript
Lĩnh vực
cli, mobile
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.