nativescript 9.0.0-alpha.9 → 9.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/config.json +1 -1
- package/config/test-deps-versions-generated.json +3 -3
- package/docs/build-jekyll-md.sh +1 -1
- package/docs/man_pages/config/config-get.md +36 -0
- package/docs/man_pages/config/config-set.md +40 -0
- package/docs/man_pages/config/config.md +39 -0
- package/docs/man_pages/project/hooks/hooks.md +35 -0
- package/docs/man_pages/start.md +1 -0
- package/lib/.d.ts +4 -0
- package/lib/bootstrap.js +2 -0
- package/lib/commands/build.js +22 -3
- package/lib/commands/clean.js +3 -2
- package/lib/commands/config.js +9 -3
- package/lib/commands/hooks/common.js +79 -0
- package/lib/commands/hooks/hooks-lock.js +100 -0
- package/lib/commands/hooks/hooks.js +71 -0
- package/lib/commands/plugin/build-plugin.js +6 -2
- package/lib/commands/typings.js +1 -1
- package/lib/common/declarations.d.ts +5 -0
- package/lib/common/definitions/extensibility.d.ts +2 -2
- package/lib/common/definitions/mobile.d.ts +78 -72
- package/lib/common/file-system.js +1 -1
- package/lib/common/logger/logger.js +1 -1
- package/lib/common/mobile/android/android-device.js +8 -2
- package/lib/common/mobile/mobile-core/devices-service.js +1 -1
- package/lib/common/plist-parser.js +3 -3
- package/lib/common/project-helper.js +15 -2
- package/lib/common/services/hooks-service.js +1 -1
- package/lib/config.js +2 -38
- package/lib/constants.js +3 -2
- package/lib/controllers/build-controller.js +1 -1
- package/lib/controllers/deploy-controller.js +5 -2
- package/lib/controllers/migrate-controller.js +6 -5
- package/lib/controllers/platform-controller.js +3 -1
- package/lib/controllers/prepare-controller.js +54 -13
- package/lib/controllers/run-controller.js +12 -13
- package/lib/controllers/update-controller.js +2 -2
- package/lib/data/build-data.js +2 -0
- package/lib/declarations.d.ts +3 -1
- package/lib/definitions/android-plugin-migrator.d.ts +3 -2
- package/lib/definitions/build.d.ts +4 -2
- package/lib/definitions/hooks.d.ts +1 -0
- package/lib/definitions/ios-debugger-port-service.d.ts +1 -1
- package/lib/definitions/livesync.d.ts +1 -1
- package/lib/definitions/project.d.ts +14 -0
- package/lib/definitions/run.d.ts +2 -4
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/nativescript-cli.js +28 -0
- package/lib/options.js +9 -2
- package/lib/project-data.js +8 -2
- package/lib/services/analytics/analytics-broker-process.js +1 -1
- package/lib/services/analytics/analytics-service.js +1 -1
- package/lib/services/android/gradle-build-args-service.js +21 -7
- package/lib/services/android/gradle-build-service.js +15 -1
- package/lib/services/android-plugin-build-service.js +58 -44
- package/lib/services/android-project-service.js +63 -4
- package/lib/services/build-artifacts-service.js +24 -9
- package/lib/services/bundler/bundler-compiler-service.js +77 -104
- package/lib/services/cocoapods-service.js +10 -4
- package/lib/services/device/device-install-app-service.js +27 -5
- package/lib/services/extensibility-service.js +1 -1
- package/lib/services/ios/xcodebuild-args-service.js +7 -5
- package/lib/services/ios-project-service.js +5 -2
- package/lib/services/plugins-service.js +3 -2
- package/lib/services/project-data-service.js +16 -18
- package/lib/services/timeline-profiler-service.js +21 -13
- package/lib/services/versions-service.js +2 -1
- package/package.json +16 -13
- package/vendor/aab-tool/README.txt +1 -1
- package/vendor/aab-tool/bundletool.jar +0 -0
- package/vendor/gradle-app/app/build.gradle +1292 -0
- package/vendor/gradle-app/app/gradle-helpers/AnalyticsCollector.gradle +48 -0
- package/vendor/gradle-app/app/gradle-helpers/BuildToolTask.gradle +50 -0
- package/vendor/gradle-app/app/gradle-helpers/CustomExecutionLogger.gradle +52 -0
- package/vendor/gradle-app/app/gradle.properties +45 -0
- package/vendor/gradle-app/build.gradle +170 -0
- package/vendor/gradle-app/settings.gradle +78 -0
- package/vendor/gradle-plugin/build.gradle +214 -91
- package/vendor/gradle-plugin/gradle.properties +2 -18
- package/vendor/gradle-plugin/settings.gradle +23 -11
- package/lib/common/resources/platform-tools/android/darwin/NOTICE.txt +0 -3407
- package/lib/common/resources/platform-tools/android/darwin/adb +0 -0
- package/lib/common/resources/platform-tools/android/linux/NOTICE.txt +0 -4451
- package/lib/common/resources/platform-tools/android/linux/adb +0 -0
- package/lib/common/resources/platform-tools/android/win32/AdbWinApi.dll +0 -0
- package/lib/common/resources/platform-tools/android/win32/AdbWinUsbApi.dll +0 -0
- package/lib/common/resources/platform-tools/android/win32/NOTICE.txt +0 -4451
- package/lib/common/resources/platform-tools/android/win32/adb.exe +0 -0
- package/lib/common/resources/platform-tools/android/win32/fastboot.exe +0 -0
|
@@ -7,94 +7,130 @@ apply plugin: 'com.android.library'
|
|
|
7
7
|
apply plugin: 'kotlin-android'
|
|
8
8
|
apply plugin: 'kotlin-parcelize'
|
|
9
9
|
|
|
10
|
+
def loadPropertyFile = { path ->
|
|
11
|
+
try {
|
|
12
|
+
if(project.hasProperty("loadedProperties_${path}")) {
|
|
13
|
+
logger.info "\t + gradle properties already loaded. SKIPPING"
|
|
14
|
+
} else {
|
|
15
|
+
logger.info "\t + trying to load gradle properties from \"$path\""
|
|
16
|
+
|
|
17
|
+
Properties properties = new Properties()
|
|
18
|
+
properties.load(new FileInputStream("$path"))
|
|
19
|
+
properties.each { prop ->
|
|
20
|
+
logger.info "\t + [$path] setting ${prop.key} = ${prop.value}"
|
|
21
|
+
project.ext.set(prop.key, prop.value)
|
|
22
|
+
}
|
|
23
|
+
project.ext.set("loadedProperties_${path}", true)
|
|
24
|
+
|
|
25
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + loaded gradle properties from \"$path\""
|
|
26
|
+
}
|
|
27
|
+
} catch(Exception ex) {
|
|
28
|
+
logger.warn "\t + failed to load gradle properties from \"$path\". Error is: ${ex.getMessage()}"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
10
32
|
buildscript {
|
|
11
|
-
|
|
12
|
-
project.ext.PLATFORMS_ANDROID = "platforms/android"
|
|
13
|
-
project.ext.PLUGIN_NAME = "{{pluginName}}"
|
|
33
|
+
def GRADLE_PROPERTIES_FILENAME = "gradle.properties"
|
|
14
34
|
|
|
15
|
-
def
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} else {
|
|
19
|
-
project.ext.USER_PROJECT_ROOT = "$rootDir/../../../"
|
|
35
|
+
def getFile = { dir, filename ->
|
|
36
|
+
File file = new File("$dir$File.separator$filename")
|
|
37
|
+
file?.exists() ? file : null
|
|
20
38
|
}
|
|
21
39
|
|
|
22
|
-
def
|
|
23
|
-
|
|
24
|
-
project.ext.USER_PROJECT_PLATFORMS_ANDROID = USER_PROJECT_PLATFORMS_ANDROID_FROM_ENV;
|
|
25
|
-
} else {
|
|
26
|
-
project.ext.USER_PROJECT_PLATFORMS_ANDROID = project.ext.USER_PROJECT_ROOT + PLATFORMS_ANDROID
|
|
40
|
+
def getPropertyFile = { dir ->
|
|
41
|
+
return getFile(dir, GRADLE_PROPERTIES_FILENAME)
|
|
27
42
|
}
|
|
43
|
+
def getUserProperties = { dir ->
|
|
44
|
+
def file = getPropertyFile(dir)
|
|
45
|
+
if (!file) {
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
28
48
|
|
|
49
|
+
Properties properties = new Properties()
|
|
50
|
+
properties.load(file.newInputStream())
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
file("${project.ext.USER_PROJECT_PLATFORMS_ANDROID}/${dep.directory}/$PLATFORMS_ANDROID")
|
|
32
|
-
}
|
|
33
|
-
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "2.0.0" }
|
|
34
|
-
def kotlinVersion = computeKotlinVersion()
|
|
35
|
-
repositories {
|
|
36
|
-
google()
|
|
37
|
-
mavenCentral()
|
|
52
|
+
return properties
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
def loadPropertyFile = { path ->
|
|
55
|
+
try {
|
|
56
|
+
if(project.hasProperty("loadedProperties_${path}")) {
|
|
57
|
+
logger.info "\t + gradle properties already loaded. SKIPPING"
|
|
58
|
+
} else {
|
|
59
|
+
logger.info "\t + trying to load gradle properties from \"$path\""
|
|
60
|
+
|
|
61
|
+
Properties properties = new Properties()
|
|
62
|
+
properties.load(new FileInputStream("$path"))
|
|
63
|
+
properties.each { prop ->
|
|
64
|
+
logger.info "\t + [$path] setting ${prop.key} = ${prop.value}"
|
|
65
|
+
project.ext.set(prop.key, prop.value)
|
|
66
|
+
}
|
|
67
|
+
project.ext.set("loadedProperties_${path}", true)
|
|
68
|
+
|
|
69
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + loaded gradle properties from \"$path\""
|
|
70
|
+
}
|
|
71
|
+
} catch(Exception ex) {
|
|
72
|
+
logger.warn "\t + failed to load gradle properties from \"$path\". Error is: ${ex.getMessage()}"
|
|
73
|
+
}
|
|
45
74
|
}
|
|
75
|
+
|
|
46
76
|
|
|
47
|
-
// Set up styled logger
|
|
48
|
-
project.ext.getDepPlatformDir = getDepPlatformDir
|
|
49
|
-
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
50
|
-
|
|
51
|
-
// the build script will not work with previous versions of the CLI (3.1 or earlier)
|
|
52
|
-
def dependenciesJson = file("${project.ext.USER_PROJECT_PLATFORMS_ANDROID}/dependencies.json")
|
|
53
|
-
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
54
|
-
def pluginData = appDependencies.find { it.name == project.ext.PLUGIN_NAME }
|
|
55
|
-
project.ext.nativescriptDependencies = appDependencies.findAll{pluginData.dependencies.contains(it.name)}
|
|
56
77
|
project.ext.getAppPath = { ->
|
|
57
|
-
def
|
|
58
|
-
def
|
|
59
|
-
def nsConfig
|
|
60
|
-
|
|
61
|
-
if (nsConfigFile.exists()) {
|
|
62
|
-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
63
|
-
}
|
|
78
|
+
// def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
79
|
+
// def nsConfig
|
|
64
80
|
|
|
81
|
+
// if (nsConfigFile.exists()) {
|
|
82
|
+
// nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
83
|
+
// }
|
|
84
|
+
def relativePathToApp = "app"
|
|
65
85
|
if (project.hasProperty("appPath")) {
|
|
66
86
|
// when appPath is passed through -PappPath=/path/to/app
|
|
67
87
|
// the path could be relative or absolute - either case will work
|
|
68
88
|
relativePathToApp = appPath
|
|
69
|
-
} else if (nsConfig != null && nsConfig.appPath != null) {
|
|
70
|
-
|
|
89
|
+
// } else if (nsConfig != null && nsConfig.appPath != null) {
|
|
90
|
+
// relativePathToApp = nsConfig.appPath
|
|
71
91
|
}
|
|
72
92
|
|
|
73
93
|
project.ext.appPath = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToApp).toAbsolutePath()
|
|
74
94
|
|
|
75
95
|
return project.ext.appPath
|
|
76
96
|
}
|
|
77
|
-
|
|
97
|
+
project.ext.getBuildPath = { ->
|
|
98
|
+
// def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
99
|
+
// def nsConfig
|
|
100
|
+
|
|
101
|
+
// if (nsConfigFile.exists()) {
|
|
102
|
+
// nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
103
|
+
// }
|
|
104
|
+
def relativeBuildToApp = "platforms"
|
|
105
|
+
if (project.getProperty("appBuildPath")) {
|
|
106
|
+
relativeBuildToApp = appBuildPath
|
|
107
|
+
// } else if (nsConfig != null && nsConfig.buildPath != null) {
|
|
108
|
+
// relativeBuildToApp = nsConfig.buildPath
|
|
109
|
+
}
|
|
110
|
+
project.ext.relativeBuildPath = relativeBuildToApp
|
|
111
|
+
project.ext.buildPath = Paths.get(USER_PROJECT_ROOT).resolve(relativeBuildToApp).toAbsolutePath()
|
|
112
|
+
return project.ext.relativeBuildPath
|
|
113
|
+
}
|
|
78
114
|
project.ext.getAppResourcesPath = { ->
|
|
115
|
+
// def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
116
|
+
// def nsConfig
|
|
117
|
+
|
|
118
|
+
// if (nsConfigFile.exists()) {
|
|
119
|
+
// nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
120
|
+
// }
|
|
79
121
|
def relativePathToAppResources
|
|
80
122
|
def absolutePathToAppResources
|
|
81
|
-
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
82
|
-
def nsConfig
|
|
83
|
-
|
|
84
|
-
if (nsConfigFile.exists()) {
|
|
85
|
-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
86
|
-
}
|
|
87
123
|
|
|
88
124
|
if (project.hasProperty("appResourcesPath")) {
|
|
89
125
|
// when appResourcesPath is passed through -PappResourcesPath=/path/to/App_Resources
|
|
90
126
|
// the path could be relative or absolute - either case will work
|
|
91
127
|
relativePathToAppResources = appResourcesPath
|
|
92
128
|
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
93
|
-
} else if (nsConfig != null && nsConfig.appResourcesPath != null) {
|
|
94
|
-
|
|
95
|
-
|
|
129
|
+
// } else if (nsConfig != null && nsConfig.appResourcesPath != null) {
|
|
130
|
+
// relativePathToAppResources = nsConfig.appResourcesPath
|
|
131
|
+
// absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
96
132
|
} else {
|
|
97
|
-
absolutePathToAppResources = "${getAppPath()}/App_Resources"
|
|
133
|
+
absolutePathToAppResources = "${project.ext.getAppPath()}/App_Resources"
|
|
98
134
|
}
|
|
99
135
|
|
|
100
136
|
project.ext.appResourcesPath = absolutePathToAppResources
|
|
@@ -102,8 +138,61 @@ buildscript {
|
|
|
102
138
|
return absolutePathToAppResources
|
|
103
139
|
}
|
|
104
140
|
|
|
141
|
+
project.ext.applyBeforePluginGradleConfiguration = { ->
|
|
142
|
+
def appResourcesPath = project.ext.getAppResourcesPath()
|
|
143
|
+
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
|
|
144
|
+
def beforePluginGradle = file(pathToBeforePluginGradle)
|
|
145
|
+
if (beforePluginGradle.exists()) {
|
|
146
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t ~ applying user-defined configuration from ${beforePluginGradle}"
|
|
147
|
+
apply from: pathToBeforePluginGradle
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def initialize = { ->
|
|
153
|
+
// set up our logger
|
|
154
|
+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
155
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t ~initialize"
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
project.ext.USER_PROJECT_ROOT = "$rootDir/../.."
|
|
159
|
+
if (project.hasProperty('projectRoot')) {
|
|
160
|
+
project.ext.USER_PROJECT_ROOT = projectRoot
|
|
161
|
+
}
|
|
162
|
+
project.ext.PLATFORMS_ANDROID = project.ext.getBuildPath() + "/android"
|
|
163
|
+
project.ext.PLUGIN_NAME = "{{pluginName}}"
|
|
164
|
+
|
|
165
|
+
def userDir = "$USER_PROJECT_ROOT"
|
|
166
|
+
rootProject.ext.userDefinedGradleProperties = getUserProperties("${project.ext.getAppResourcesPath()}/Android")
|
|
167
|
+
|
|
168
|
+
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/gradle.properties")
|
|
169
|
+
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/additional_gradle.properties")
|
|
170
|
+
|
|
171
|
+
if (rootProject.hasProperty("userDefinedGradleProperties")) {
|
|
172
|
+
rootProject.ext.userDefinedGradleProperties.each { entry ->
|
|
173
|
+
def propertyName = entry.getKey()
|
|
174
|
+
def propertyValue = entry.getValue()
|
|
175
|
+
project.ext.set(propertyName, propertyValue)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
def getDepPlatformDir = { dep ->
|
|
180
|
+
file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/${dep.directory}/platforms/android")
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Set up styled logger
|
|
184
|
+
project.ext.getDepPlatformDir = getDepPlatformDir
|
|
185
|
+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
// the build script will not work with previous versions of the CLI (3.1 or earlier)
|
|
189
|
+
def dependenciesJson = file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/dependencies.json")
|
|
190
|
+
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
191
|
+
def pluginData = appDependencies.find { it.name == project.ext.PLUGIN_NAME }
|
|
192
|
+
project.ext.nativescriptDependencies = appDependencies.findAll{pluginData.dependencies.contains(it.name)}.plus([pluginData])
|
|
193
|
+
}
|
|
105
194
|
def applyBuildScriptConfigurations = { ->
|
|
106
|
-
def absolutePathToAppResources = getAppResourcesPath()
|
|
195
|
+
def absolutePathToAppResources = project.ext.getAppResourcesPath()
|
|
107
196
|
def pathToBuildScriptGradle = "$absolutePathToAppResources/Android/buildscript.gradle"
|
|
108
197
|
def buildScriptGradle = file(pathToBuildScriptGradle)
|
|
109
198
|
if (buildScriptGradle.exists()) {
|
|
@@ -118,6 +207,12 @@ buildscript {
|
|
|
118
207
|
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined buildscript from dependency ${pluginBuildScriptGradle}"
|
|
119
208
|
apply from: pathToPluginBuildScriptGradle, to: buildscript
|
|
120
209
|
}
|
|
210
|
+
// def pathToPluginProjectBuildScriptGradle = "${getDepPlatformDir(dep)}/project-buildscript.gradle"
|
|
211
|
+
// def pluginProjectBuildScriptGradle = file(pathToPluginProjectBuildScriptGradle)
|
|
212
|
+
// if (pluginProjectBuildScriptGradle.exists()) {
|
|
213
|
+
// outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined project-buildscript from dependency ${pluginProjectBuildScriptGradle}"
|
|
214
|
+
// apply from: pathToPluginProjectBuildScriptGradle, to: project
|
|
215
|
+
// }
|
|
121
216
|
}
|
|
122
217
|
|
|
123
218
|
def pathToPluginBuildScriptGradle = "$rootDir/buildscript.gradle"
|
|
@@ -127,8 +222,26 @@ buildscript {
|
|
|
127
222
|
apply from: pathToPluginBuildScriptGradle, to: buildscript
|
|
128
223
|
}
|
|
129
224
|
}
|
|
225
|
+
|
|
226
|
+
initialize()
|
|
227
|
+
project.ext.applyBeforePluginGradleConfiguration()
|
|
130
228
|
applyBuildScriptConfigurations()
|
|
131
229
|
|
|
230
|
+
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
|
|
231
|
+
def computeBuildToolsVersion = { -> project.hasProperty("androidBuildToolsVersion") ? androidBuildToolsVersion : "{{runtimeAndroidPluginVersion}}" }
|
|
232
|
+
def kotlinVersion = computeKotlinVersion()
|
|
233
|
+
def androidBuildToolsVersion = computeBuildToolsVersion()
|
|
234
|
+
|
|
235
|
+
repositories {
|
|
236
|
+
google()
|
|
237
|
+
mavenCentral()
|
|
238
|
+
}
|
|
239
|
+
dependencies {
|
|
240
|
+
classpath "com.android.tools.build:gradle:$androidBuildToolsVersion"
|
|
241
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
242
|
+
classpath "org.codehaus.groovy:groovy-all:3.0.8"
|
|
243
|
+
}
|
|
244
|
+
|
|
132
245
|
}
|
|
133
246
|
|
|
134
247
|
def pluginDependencies
|
|
@@ -150,6 +263,7 @@ allprojects {
|
|
|
150
263
|
url 'https://maven.google.com/'
|
|
151
264
|
name 'Google'
|
|
152
265
|
}
|
|
266
|
+
jcenter()
|
|
153
267
|
if (pluginDependencies.size() > 0) {
|
|
154
268
|
flatDir {
|
|
155
269
|
dirs pluginDependencies
|
|
@@ -167,83 +281,92 @@ def computeBuildToolsVersion = { ->
|
|
|
167
281
|
|
|
168
282
|
android {
|
|
169
283
|
namespace "{{pluginNamespace}}"
|
|
170
|
-
|
|
171
|
-
kotlinOptions {
|
|
172
|
-
jvmTarget = '17'
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
compileOptions {
|
|
176
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
177
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (project.hasProperty("ndkVersion")) {
|
|
182
|
-
ndkVersion project.ndkVersion
|
|
183
|
-
}
|
|
184
|
-
|
|
185
284
|
def applyPluginGradleConfigurations = { ->
|
|
186
285
|
nativescriptDependencies.each { dep ->
|
|
187
286
|
def includeGradlePath = "${getDepPlatformDir(dep)}/include.gradle"
|
|
188
287
|
if (file(includeGradlePath).exists()) {
|
|
288
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying plugin include.gradle from dependency ${includeGradlePath}"
|
|
189
289
|
apply from: includeGradlePath
|
|
190
290
|
}
|
|
191
291
|
}
|
|
192
292
|
}
|
|
193
|
-
|
|
293
|
+
|
|
294
|
+
project.ext.applyBeforePluginGradleConfiguration()
|
|
194
295
|
applyPluginGradleConfigurations()
|
|
195
296
|
|
|
196
297
|
compileSdkVersion computeCompileSdkVersion()
|
|
197
298
|
buildToolsVersion computeBuildToolsVersion()
|
|
198
299
|
|
|
300
|
+
compileOptions {
|
|
301
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
302
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
303
|
+
}
|
|
304
|
+
if (project.hasProperty("ndkVersion")) {
|
|
305
|
+
ndkVersion project.ndkVersion
|
|
306
|
+
}
|
|
307
|
+
|
|
199
308
|
defaultConfig {
|
|
200
309
|
targetSdkVersion computeTargetSdkVersion()
|
|
201
310
|
versionCode 1
|
|
202
311
|
versionName "1.0"
|
|
203
312
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def applyBeforePluginGradleConfiguration() {
|
|
208
|
-
def appResourcesPath = getAppResourcesPath()
|
|
209
|
-
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
|
|
210
|
-
def beforePluginGradle = file(pathToBeforePluginGradle)
|
|
211
|
-
if (beforePluginGradle.exists()) {
|
|
212
|
-
outLogger.withStyle(Style.SuccessHeader).println "\t ~ applying user-defined configuration from ${beforePluginGradle}"
|
|
213
|
-
apply from: pathToBeforePluginGradle
|
|
313
|
+
lintOptions {
|
|
314
|
+
checkReleaseBuilds false
|
|
315
|
+
abortOnError false
|
|
214
316
|
}
|
|
215
317
|
}
|
|
216
318
|
|
|
217
319
|
task addDependenciesFromNativeScriptPlugins {
|
|
218
320
|
nativescriptDependencies.each { dep ->
|
|
219
|
-
def aarFiles = fileTree(dir: getDepPlatformDir(dep)
|
|
321
|
+
def aarFiles = fileTree(dir: getDepPlatformDir(dep)).matching {
|
|
322
|
+
include "**/*.aar"
|
|
323
|
+
exclude "cpp/**"
|
|
324
|
+
exclude project.hasProperty("aarIgnoreFilter") ? project.findProperty('aarIgnoreFilter').split(',').collect{it as String} : []
|
|
325
|
+
}
|
|
326
|
+
def currentDirname = file(project.buildscript.sourceFile).getParentFile().getName()
|
|
220
327
|
aarFiles.each { aarFile ->
|
|
221
328
|
def length = aarFile.name.length() - 4
|
|
222
329
|
def fileName = aarFile.name[0..<length]
|
|
330
|
+
if(fileName == currentDirname) {
|
|
331
|
+
return
|
|
332
|
+
}
|
|
223
333
|
outLogger.withStyle(Style.SuccessHeader).println "\t + adding aar plugin dependency: " + aarFile.getAbsolutePath()
|
|
224
334
|
project.dependencies.add("implementation", [name: fileName, ext: "aar"])
|
|
225
335
|
}
|
|
226
336
|
|
|
227
|
-
def jarFiles = fileTree(dir: getDepPlatformDir(dep)
|
|
337
|
+
def jarFiles = fileTree(dir: getDepPlatformDir(dep)).matching {
|
|
338
|
+
include "**/*.jar"
|
|
339
|
+
exclude "cpp/**"
|
|
340
|
+
exclude project.hasProperty("jarIgnoreFilter") ? project.findProperty('jarIgnoreFilter').split(',').collect{it as String} : []
|
|
341
|
+
}
|
|
228
342
|
jarFiles.each { jarFile ->
|
|
229
343
|
def jarFileAbsolutePath = jarFile.getAbsolutePath()
|
|
230
344
|
outLogger.withStyle(Style.SuccessHeader).println "\t + adding jar plugin dependency: $jarFileAbsolutePath"
|
|
231
|
-
pluginsJarLibraries.add(jarFile.getAbsolutePath())
|
|
345
|
+
// pluginsJarLibraries.add(jarFile.getAbsolutePath())
|
|
232
346
|
}
|
|
233
347
|
|
|
234
348
|
project.dependencies.add("implementation", jarFiles)
|
|
235
349
|
}
|
|
236
350
|
}
|
|
237
351
|
|
|
238
|
-
|
|
239
|
-
|
|
352
|
+
// This wont work with gradle 8 + should be the same as the code just after
|
|
353
|
+
// afterEvaluate {
|
|
354
|
+
// def generateBuildConfig = project.hasProperty("generateBuildConfig") ? project.generateBuildConfig : false
|
|
355
|
+
// def generateR = project.hasProperty("generateR") ? project.generateR : false
|
|
356
|
+
// generateReleaseBuildConfig.enabled = generateBuildConfig
|
|
357
|
+
// generateDebugBuildConfig.enabled = generateBuildConfig
|
|
358
|
+
// generateReleaseResValues.enabled = generateR
|
|
359
|
+
// generateDebugResValues.enabled = generateR
|
|
360
|
+
// }
|
|
361
|
+
project.tasks.configureEach {
|
|
362
|
+
if (name == 'bundleRelease') {
|
|
240
363
|
def generateBuildConfig = project.hasProperty("generateBuildConfig") ? project.generateBuildConfig : false
|
|
241
364
|
def generateR = project.hasProperty("generateR") ? project.generateR : false
|
|
242
365
|
if (!generateBuildConfig) {
|
|
243
|
-
|
|
366
|
+
it.exclude '**/BuildConfig.class'
|
|
244
367
|
}
|
|
245
368
|
if (!generateR) {
|
|
246
|
-
|
|
369
|
+
it.exclude '**/R.class', '**/R$*.class'
|
|
247
370
|
}
|
|
248
371
|
}
|
|
249
|
-
}
|
|
372
|
+
}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# IDE (e.g. Android Studio) users:
|
|
4
|
-
# Gradle settings configured through the IDE *will override*
|
|
5
|
-
# any settings specified in this file.
|
|
6
|
-
|
|
7
|
-
# For more details on how to configure your build environment visit
|
|
8
|
-
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
9
|
-
|
|
10
|
-
# When configured, Gradle will run in incubating parallel mode.
|
|
11
|
-
# This option should only be used with decoupled projects. More details, visit
|
|
12
|
-
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
13
|
-
#org.gradle.parallel=true
|
|
14
|
-
|
|
15
|
-
# Specifies the JVM arguments used for the daemon process.
|
|
16
|
-
# The setting is particularly useful for tweaking memory settings.
|
|
1
|
+
# Nativescript CLI plugin build gradle properties
|
|
17
2
|
org.gradle.jvmargs=-Xmx16384M
|
|
18
3
|
|
|
19
4
|
android.enableJetifier=true
|
|
20
5
|
android.useAndroidX=true
|
|
21
|
-
android.nonTransitiveRClass=true
|
|
22
|
-
android.enableSeparateRClassCompilation=true
|
|
6
|
+
android.nonTransitiveRClass=true
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import groovy.json.JsonSlurper
|
|
2
2
|
|
|
3
|
-
// def USER_PROJECT_ROOT = "$rootDir/../../../"
|
|
4
|
-
def PLATFORMS_ANDROID = "platforms/android"
|
|
5
|
-
def PLUGIN_NAME = "{{pluginName}}"
|
|
6
3
|
|
|
7
|
-
def
|
|
8
|
-
def
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
4
|
+
def getProjectRoot = { ->
|
|
5
|
+
def projectRoot = "$rootDir/../../"
|
|
6
|
+
if (System.getProperties().projectRoot != null) {
|
|
7
|
+
projectRoot = System.getProperties().projectRoot
|
|
8
|
+
}
|
|
9
|
+
return projectRoot
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def getBuildPath = { ->
|
|
13
|
+
def relativeBuildToApp = "platforms"
|
|
14
|
+
if (System.getProperties().appBuildPath != null) {
|
|
15
|
+
relativeBuildToApp = System.getProperties().appBuildPath
|
|
16
|
+
}
|
|
17
|
+
return relativeBuildToApp
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
def
|
|
20
|
+
def USER_PROJECT_ROOT = getProjectRoot()
|
|
21
|
+
def PLATFORMS_ANDROID = getBuildPath() + "/android"
|
|
22
|
+
def PLUGIN_NAME = "{{pluginName}}"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def dependenciesJson = file("${USER_PROJECT_ROOT}/${PLATFORMS_ANDROID}/dependencies.json")
|
|
16
27
|
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
17
28
|
def pluginData = appDependencies.find { it.name == PLUGIN_NAME }
|
|
18
29
|
def nativescriptDependencies = appDependencies.findAll{pluginData.name == it.name}
|
|
19
30
|
|
|
20
31
|
def getDepPlatformDir = { dep ->
|
|
21
|
-
file("$
|
|
32
|
+
file("$USER_PROJECT_ROOT/$PLATFORMS_ANDROID/${dep.directory}/$PLATFORMS_ANDROID")
|
|
22
33
|
}
|
|
23
34
|
|
|
35
|
+
|
|
24
36
|
def applyIncludeSettingsGradlePlugin = {
|
|
25
37
|
nativescriptDependencies.each { dep ->
|
|
26
38
|
def includeSettingsGradlePath = "${getDepPlatformDir(dep)}/include-settings.gradle"
|