Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/gesturehandler/platforms/android/buildscript.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repositories {
mavenCentral()
}
dependencies {
classpath "org.nativescript:gradle-api:0.1.0-alpha.2"
}
44 changes: 7 additions & 37 deletions packages/gesturehandler/platforms/android/include.gradle
Original file line number Diff line number Diff line change
@@ -1,45 +1,15 @@
import groovy.json.JsonSlurper

dependencies {
implementation "androidx.annotation:annotation:1.1.0"

if (project.hasProperty("tempBuild")) {
// we need to copy the code in both places as N main gradle system does not support top level code
// for now we support only @nativescript/core and @akylas/nativescript
// we should have a more generic way
def widgetsDir = "$USER_PROJECT_ROOT/node_modules/@nativescript/core/platforms/android"
def appPackageJsonFile = file("$USER_PROJECT_ROOT/package.json")
if (appPackageJsonFile.exists()) {
def appPackageJson = new JsonSlurper().parseText(appPackageJsonFile.text)
if (appPackageJson.dependencies['@akylas/nativescript'] != null) {
widgetsDir = "$USER_PROJECT_ROOT/node_modules/@akylas/nativescript/platforms/android"
}
// NativeScript CLIs before 9.2 don't load org.nativescript:gradle-api in this plugin's own aar build.
if (project.extensions.findByName("nativescript") == null) {
throw new GradleException("@nativescript-community/gesturehandler needs NativeScript CLI 9.2 or newer: npm i -D nativescript@latest")
}

// if ui-mobile-base is provided as source the name is nativescript.aar
//else use widget-release.aar
if (file("$widgetsDir/widgets-release.aar").exists()) {
implementation(name:'widgets-release', ext:'aar')
} else {
implementation(name:'nativescript', ext:'aar')
def core = nativescript.findPlugin("@nativescript/core") ?: nativescript.findPlugin("@akylas/nativescript")
if (core == null) {
throw new GradleException("@nativescript-community/gesturehandler needs @nativescript/core or @akylas/nativescript")
}
compileOnly core.artifacts
}
}
repositories {
if (project.hasProperty("tempBuild")) {
// we need to copy the code in both places as N main gradle system does not support top level code
// for now we support only @nativescript/core and @akylas/nativescript
// we should have a more generic way
def widgetsDir = "$USER_PROJECT_ROOT/node_modules/@nativescript/core/platforms/android"
def appPackageJsonFile = file("$USER_PROJECT_ROOT/package.json")
if (appPackageJsonFile.exists()) {
def appPackageJson = new JsonSlurper().parseText(appPackageJsonFile.text)
if (appPackageJson.dependencies['@akylas/nativescript'] != null) {
widgetsDir = "$USER_PROJECT_ROOT/node_modules/@akylas/nativescript/platforms/android"
}
}
flatDir {
dirs "$widgetsDir"
}
}
}