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

impr(android): allow gradle to automatically download missing dependencies #11432

Merged
merged 9 commits into from Jan 30, 2020

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Jan 14, 2020

  • Allow Gradle to automatically download and install missing dependencies (Android SDK, Build-tools etc..)
  • These changes will offload SDK validation to Gradle
TEST CASE #1
  • Remove Android SDK Platform 29
  • Attempt to build Titanium application
  • Gradle should download and install Android SDK Platform 29 and build successfully
TEST CASE #2
  • Remove Android SDK Build-Tools
  • Attempt to build Titanium application
  • Gradle should download and install Android SDK Build-Tools and build successfully
TEST CASE #3
  • Remove Android SDK Platform-Tools
  • Attempt to build Titanium application
  • Gradle should download and install Android SDK Platform-Tools and build successfully
TEST CASE #4
  • Remove Android SDK Tools
  • Attempt to build Titanium application
  • Gradle should download and install Android SDK Tools and build successfully

Repeat test cases for Titanium native module

JIRA Ticket

@build
Copy link
Contributor

build commented Jan 14, 2020

Fails
🚫 Tests have failed, see below for more information.
Warnings
⚠️

Commit c09c32cf1b7c66a2f2c454c739f054ed1547074b has a message "feat(android): allow gradle to automatically download missing dependencies" giving 1 errors:

  • header must not be longer than 72 characters, current length is 74
Messages
📖 👍 Hey!, You deleted more code than you added. That's awesome!
📖

💾 Here's the generated SDK zipfile.

📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖 ❌ 1 tests have failed There are 1 tests failing and 701 skipped out of 7250 total tests.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.Androidactivity callbacks (9)5.22
Error: timeout of 5000ms exceeded
at Titanium.<anonymous> (/ti-mocha.js:6535:53120)

Generated by 🚫 dangerJS against f094c06

@jquick-axway
Copy link
Contributor

jquick-axway commented Jan 14, 2020

I think an app build will still fail if you set the --no-prompt flag.

appc run -p android --no-prompt --build-only

Our _build.js script's cli:pre-validate event listener is still asserting when tools are missing, such as for ANDROID_SDK_MISSING_PROGRAMS.

The rest of your changes look good!

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@ssjsamir ssjsamir self-requested a review January 28, 2020 13:38
Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garymathews When following the instructions mentioned in the description and building using appc run -p android --no-prompt --build-only I get the following error for Step 3 and Step 4 [ERROR] Missing required option: --device-id <name>

Test Steps:

  1. Created a new Titanium application
  2. Removed Android SDK Platform 29
  3. Built application
  4. Able to build to build using the instructions mentioned in step one.
    Note: It will not download system images needed for emulators just the Android SDK Platform 29 which is needed for building. If you try to build to an emulator the below is error is shown.
[ERROR] �� �Emulator exited with error: 1

[ERROR] �� �PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/Users/Samir/Library/Android/sdk]!

Build failed. Process exited with code 1.
  1. Removed Android SDK Build-Tools
  2. Attempted to build Titanium application
  3. Application built without any issues and SDK Builds-Tools were installed
  4. Removed Android SDK Platform-tools
  5. Attempted to build Titanium application
  6. Following error is shown
[ERROR] Missing required option: --device-id <name>
  1. Removed Android SDK Tools
  2. Attempted to build Titanium application
  3. Following error is shown
[ERROR] Missing required option: --device-id <name>

Test Environment

MacOS Catalina: 10.15.1 beta
Xcode: 11.3
Java Version: 1.8.0_131
Android NDK: 18.1.5063045
Node.js: 10.16.3
"NPM":"4.2.15-1","CLI":"7.1.2-7"
Pixel xl (7.1.1) Emulator

@garymathews
Copy link
Contributor Author

@ssjsamir Thanks for finding that, I've updated the PR.

@ssjsamir
Copy link
Contributor

@garymathews For the first three test cases everything seems fine but for number 4 when I try to build without the tools folder, the application builds without downloading/installing anything to the Library/Android/sdk location. And when I try to run the application normally (to an Android emulator) I get the following error:

[WARN] �� � Unable to find any emulators, possibily due to missing dependencies.
Continuing with build... (will attempt to install missing dependencies)
2020-01-29T14:21:19.740Z | ERROR | An uncaught exception was thrown!
Cannot read property 'once' of undefined
2020-01-29T14:21:19.741Z | ERROR | Cannot read property 'once' of undefined
Build failed. Process exited with code 1.

@garymathews
Copy link
Contributor Author

@ssjsamir I'm having trouble reproducing that issue, what are the steps your doing for 4?

The app builds fine when I remove Android SDK Tools or delete the tools folder from ../Android/sdk.

[INFO]  Building for target: emulator
[INFO]  Performing build only
...
[INFO]  [GRADLE] BUILD SUCCESSFUL in 12s
[INFO]  [GRADLE] 45 actionable tasks: 45 executed
[INFO]  Writing build manifest: /Users/gmathews/projects/classicTest/build/android/build-manifest.json
[INFO]  Performed build only, skipping installing of the application
[INFO]  Project built successfully in 15s 124ms

@ssjsamir
Copy link
Contributor

@garymathews The app is building fine but Tools is not actually being downloaded/installed in the SDK location for me unlike the others.

@garymathews
Copy link
Contributor Author

It will only download the dependencies it needs to build the app, so if the apps building fine then it won't download additional dependencies. I think this behaviour is fine then?

@ssjsamir
Copy link
Contributor

@garymathews That seems fine with me. To get the above error I ran to an emulator after removing the tools folder rather than doing a build-only.

@ssjsamir ssjsamir self-requested a review January 30, 2020 19:08
Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed able to build with the following missing dependencies Android SDK Platform 29, Android SDK Build-Tools , Android SDK Platform-Tools and Android SDK Tools.
Test Environment

MacOS Catalina: 10.15.1 beta
Xcode: 11.3
Java Version: 1.8.0_131
Android NDK: 18.1.5063045
Node.js: 10.16.3
"NPM":"4.2.15-1","CLI":"7.1.2-7"
Pixel xl (7.1.1) Emulator

@sgtcoolguy sgtcoolguy merged commit 57a6b49 into tidev:master Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants