NativeScript / NativeScript/nativescript-cli
Plugin's include.gradle is not properly respected when building aar
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 1.1k
- フォーク
- 204
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 8
説明
Tell us about the problem
Currently {N} CLI detects if a plugin has any Android resources/java files/etc. and tries to build an android archive (.aar) for said plugin. During building of this .aar file CLI takes into account the plugin's include.gradle file, if it exists, however the logic for this is incomplete. Instead of only taking into account certain tags (like dependencies or repositories), it seems more appropriate that the whole include.gradle be included in the process of building the plugin's .aar file.
In other words instead of any additional parsing CLI should only include a
apply from: <path-to-plugin-include.gradle-file>
section in the plugin's build.gradle.
Which platform(s) does your issue occur on?
Android
Please tell us how to recreate the issue in as much detail as possible.
- tns create myApp
- cd myApp
- tns plugin add nativescript-mapbox
- edit
node_modules/nativescript-mapbox/platforms/android/include.gradleso that the contents become:
android {
productFlavors {
"mapbox" {
dimension "mapbox"
}
}
}
repositories {
mavenCentral()
}
def coreLibrary = 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.3.1@aar'
def serviceLibrary = 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.9@aar'
def pluginsString = 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.3.0'
// see https://www.mapbox.com/android-sdk/
dependencies {
// core library
compile ("$coreLibrary"){
transitive=true
}
// service library
compile ("$serviceLibrary"){
transitive=true
}
// plugins
compile "$pluginsString"
}
- Try to execute
tns build android
CLI fails to build the .aar file in this case, because the dependencies section is copied, however it is in its essence incomplete.
This is only a dummy example to illustrate the flaw in the CLI logic. The content of the include.gradle may contain more complex logic, which needs to be taken into account.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
lib/services/android-plugin-build-service.ts の232~239行付近を読み、その後 nativescript-mapbox の include.gradle の例と tns build android を使って問題を再現します。include.gradle がプラグインのビルドにどのように組み込まれるかを追跡します。完了条件は、選択されたセクションだけがコピーされるのではなく、.aar の構築中にファイル全体が適用されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- android, groovy, javascript
- 領域
- build-system, cli, mobile-dev
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 48/100