@nativescript/android 8.0.0 → 8.2.0-alpha.1
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/framework/app/build.gradle +47 -131
- package/framework/app/libs/runtime-libs/nativescript-optimized-with-inspector.aar +0 -0
- package/framework/app/libs/runtime-libs/nativescript-optimized.aar +0 -0
- package/framework/app/libs/runtime-libs/nativescript-regular.aar +0 -0
- package/framework/build-tools/android-metadata-generator.jar +0 -0
- package/framework/build-tools/dts-generator.jar +0 -0
- package/framework/build-tools/jsparser/js_parser.js +1 -2
- package/framework/build-tools/static-binding-generator.jar +0 -0
- package/framework/build.gradle +111 -4
- package/framework/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/framework/gradle-helpers/paths.gradle +5 -3
- package/framework/gradle.properties +26 -0
- package/framework/settings.json +2 -2
- package/package.json +10 -5
|
@@ -23,13 +23,17 @@
|
|
|
23
23
|
|
|
24
24
|
import groovy.io.FileType
|
|
25
25
|
import groovy.json.JsonSlurper
|
|
26
|
+
import org.apache.commons.io.FileUtils
|
|
26
27
|
|
|
27
28
|
import javax.inject.Inject
|
|
28
29
|
import java.nio.file.Files
|
|
29
30
|
import java.nio.file.Paths
|
|
30
31
|
import java.nio.file.StandardCopyOption
|
|
31
32
|
import java.security.MessageDigest
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
import java.util.jar.JarEntry
|
|
35
|
+
import java.util.jar.JarFile
|
|
36
|
+
|
|
33
37
|
import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
34
38
|
|
|
35
39
|
apply plugin: "com.android.application"
|
|
@@ -41,7 +45,7 @@ def enableKotlin = (project.hasProperty("useKotlin") && project.useKotlin == "tr
|
|
|
41
45
|
|
|
42
46
|
if (enableKotlin) {
|
|
43
47
|
apply plugin: 'kotlin-android'
|
|
44
|
-
apply plugin: 'kotlin-
|
|
48
|
+
apply plugin: 'kotlin-parcelize'
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
def onlyX86 = project.hasProperty("onlyX86")
|
|
@@ -78,11 +82,11 @@ def METADATA_OUT_PATH = "$projectDir/src/main/assets/metadata"
|
|
|
78
82
|
def pluginsJarLibraries = new LinkedList<String>()
|
|
79
83
|
def allJarLibraries = new LinkedList<String>()
|
|
80
84
|
|
|
81
|
-
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "
|
|
82
|
-
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk :
|
|
83
|
-
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk :
|
|
85
|
+
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${kotlin_version}" }
|
|
86
|
+
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : COMPILE_SDK_VERSION as int }
|
|
87
|
+
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : COMPILE_SDK_VERSION as int }
|
|
84
88
|
def computeBuildToolsVersion = { ->
|
|
85
|
-
project.hasProperty("buildToolsVersion") ? buildToolsVersion :
|
|
89
|
+
project.hasProperty("buildToolsVersion") ? buildToolsVersion : BUILD_TOOLS_VERSION as String
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
def enableAnalytics = (project.hasProperty("gatherAnalyticsData") && project.gatherAnalyticsData == "true")
|
|
@@ -97,76 +101,6 @@ if (enableAnalytics) {
|
|
|
97
101
|
project.ext.selectedBuildType = project.hasProperty("release") ? "release" : "debug"
|
|
98
102
|
|
|
99
103
|
buildscript {
|
|
100
|
-
// we have moved these initializations here as we need getAppResourcesPath to search for buildscript.gradle files,
|
|
101
|
-
// but the buildscript is executed before executing anything else from the gradle file
|
|
102
|
-
def initialize = { ->
|
|
103
|
-
// the build script will not work with previous versions of the CLI (3.1 or earlier)
|
|
104
|
-
def dependenciesJson = file("$rootDir/dependencies.json")
|
|
105
|
-
if (!dependenciesJson.exists()) {
|
|
106
|
-
throw new BuildCancelledException("""
|
|
107
|
-
'dependencies.json' file not found. Check whether the NativeScript CLI has prepared the project beforehand,
|
|
108
|
-
and that your NativeScript version is 3.3, or a more recent one. To build an android project with the current
|
|
109
|
-
version of the {N} CLI install a previous version of the runtime package - 'tns platform add android@3.2'.
|
|
110
|
-
""")
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
project.ext.extractedDependenciesDir = "${project.buildDir}/exploded-dependencies"
|
|
114
|
-
project.ext.cleanupAllJarsTimestamp = "${project.buildDir}/cleanupAllJars.timestamp"
|
|
115
|
-
project.ext.extractAllJarsTimestamp = "${project.buildDir}/extractAllJars.timestamp"
|
|
116
|
-
project.ext.nativescriptDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
117
|
-
project.ext.PLATFORMS_ANDROID = "platforms/android"
|
|
118
|
-
project.ext.USER_PROJECT_ROOT = "$rootDir/../.."
|
|
119
|
-
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
120
|
-
|
|
121
|
-
project.ext.getAppPath = { ->
|
|
122
|
-
def relativePathToApp = "app"
|
|
123
|
-
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
124
|
-
def nsConfig
|
|
125
|
-
|
|
126
|
-
if (nsConfigFile.exists()) {
|
|
127
|
-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (project.hasProperty("appPath")) {
|
|
131
|
-
// when appPath is passed through -PappPath=/path/to/app
|
|
132
|
-
// the path could be relative or absolute - either case will work
|
|
133
|
-
relativePathToApp = appPath
|
|
134
|
-
} else if (nsConfig != null && nsConfig.appPath != null) {
|
|
135
|
-
relativePathToApp = nsConfig.appPath
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
project.ext.appPath = java.nio.file.Paths.get(USER_PROJECT_ROOT).resolve(relativePathToApp).toAbsolutePath()
|
|
139
|
-
|
|
140
|
-
return project.ext.appPath
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
project.ext.getAppResourcesPath = { ->
|
|
144
|
-
def relativePathToAppResources
|
|
145
|
-
def absolutePathToAppResources
|
|
146
|
-
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
147
|
-
def nsConfig
|
|
148
|
-
|
|
149
|
-
if (nsConfigFile.exists()) {
|
|
150
|
-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (project.hasProperty("appResourcesPath")) {
|
|
154
|
-
// when appResourcesPath is passed through -PappResourcesPath=/path/to/App_Resources
|
|
155
|
-
// the path could be relative or absolute - either case will work
|
|
156
|
-
relativePathToAppResources = appResourcesPath
|
|
157
|
-
absolutePathToAppResources = java.nio.file.Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
158
|
-
} else if (nsConfig != null && nsConfig.appResourcesPath != null) {
|
|
159
|
-
relativePathToAppResources = nsConfig.appResourcesPath
|
|
160
|
-
absolutePathToAppResources = java.nio.file.Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
161
|
-
} else {
|
|
162
|
-
absolutePathToAppResources = "${getAppPath()}/App_Resources"
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
project.ext.appResourcesPath = absolutePathToAppResources
|
|
166
|
-
|
|
167
|
-
return absolutePathToAppResources
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
104
|
def applyBuildScriptConfigurations = { ->
|
|
171
105
|
def absolutePathToAppResources = getAppResourcesPath()
|
|
172
106
|
def pathToBuildScriptGradle = "$absolutePathToAppResources/Android/buildscript.gradle"
|
|
@@ -185,8 +119,6 @@ version of the {N} CLI install a previous version of the runtime package - 'tns
|
|
|
185
119
|
}
|
|
186
120
|
}
|
|
187
121
|
}
|
|
188
|
-
|
|
189
|
-
initialize()
|
|
190
122
|
applyBuildScriptConfigurations()
|
|
191
123
|
}
|
|
192
124
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -266,7 +198,7 @@ android {
|
|
|
266
198
|
|
|
267
199
|
defaultConfig {
|
|
268
200
|
def manifest = new XmlSlurper().parse(file(android.sourceSets.main.manifest.srcFile))
|
|
269
|
-
def minSdkVer = manifest."uses-sdk"."@android:minSdkVersion".text() ?:
|
|
201
|
+
def minSdkVer = manifest."uses-sdk"."@android:minSdkVersion".text() ?: MIN_SDK_VERSION
|
|
270
202
|
minSdkVersion minSdkVer
|
|
271
203
|
targetSdkVersion computeTargetSdkVersion()
|
|
272
204
|
ndk {
|
|
@@ -276,9 +208,6 @@ android {
|
|
|
276
208
|
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
|
277
209
|
}
|
|
278
210
|
}
|
|
279
|
-
dexOptions {
|
|
280
|
-
jumboMode = true
|
|
281
|
-
}
|
|
282
211
|
}
|
|
283
212
|
|
|
284
213
|
compileOptions {
|
|
@@ -373,49 +302,55 @@ repositories {
|
|
|
373
302
|
}
|
|
374
303
|
|
|
375
304
|
dependencies {
|
|
376
|
-
def androidXLegacyVersion = "1.0.0"
|
|
377
|
-
if (project.hasProperty("androidXLegacy")) {
|
|
378
|
-
androidXLegacyVersion = androidXLegacy
|
|
379
|
-
}
|
|
380
305
|
|
|
381
|
-
def androidXAppCompatVersion = "
|
|
306
|
+
def androidXAppCompatVersion = "${android_x_app_compat_version}"
|
|
382
307
|
if (project.hasProperty("androidXAppCompat")) {
|
|
383
308
|
androidXAppCompatVersion = androidXAppCompat
|
|
309
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.appcompat:appcompat:$androidXAppCompatVersion"
|
|
384
310
|
}
|
|
385
311
|
|
|
386
|
-
def androidXMaterialVersion = "
|
|
312
|
+
def androidXMaterialVersion = "${android_x_material_version}"
|
|
387
313
|
if (project.hasProperty("androidXMaterial")) {
|
|
388
314
|
androidXMaterialVersion = androidXMaterial
|
|
315
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library com.google.android.material:material:$androidXMaterialVersion"
|
|
389
316
|
}
|
|
390
317
|
|
|
391
|
-
def androidXExifInterfaceVersion = "
|
|
318
|
+
def androidXExifInterfaceVersion = "${android_x_exif_interface_version}"
|
|
392
319
|
if (project.hasProperty("androidXExifInterface")) {
|
|
393
|
-
|
|
320
|
+
androidXExifInterfaceVersion = androidXExifInterface
|
|
321
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
|
|
394
322
|
}
|
|
395
323
|
|
|
396
|
-
def androidXViewPagerVersion = "
|
|
324
|
+
def androidXViewPagerVersion = "${android_x_view_pager_version}"
|
|
397
325
|
if (project.hasProperty("androidXViewPager")) {
|
|
398
326
|
androidXViewPagerVersion = androidXViewPager
|
|
327
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
|
|
399
328
|
}
|
|
400
329
|
|
|
401
|
-
def androidXFragmentVersion = "
|
|
330
|
+
def androidXFragmentVersion = "${android_x_fragment_version}"
|
|
402
331
|
if (project.hasProperty("androidXFragment")) {
|
|
403
332
|
androidXFragmentVersion = androidXFragment
|
|
333
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.fragment:fragment:$androidXFragmentVersion"
|
|
404
334
|
}
|
|
405
335
|
|
|
406
|
-
def androidXTransitionVersion = "
|
|
336
|
+
def androidXTransitionVersion = "${android_x_transition_version}"
|
|
407
337
|
if (project.hasProperty("androidXTransition")) {
|
|
408
338
|
androidXTransitionVersion = androidXTransition
|
|
339
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.transition:transition:$androidXTransitionVersion"
|
|
409
340
|
}
|
|
410
341
|
|
|
411
|
-
|
|
342
|
+
def androidXMultidexVersion = "${android_x_multidex_version}"
|
|
343
|
+
if (project.hasProperty("androidXMultidex")) {
|
|
344
|
+
androidXMultidexVersion = androidXMultidex
|
|
345
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + using android X library androidx.multidex:multidex:$androidXMultidexVersion"
|
|
346
|
+
}
|
|
412
347
|
|
|
413
|
-
implementation "androidx.multidex:multidex
|
|
414
|
-
implementation "androidx.legacy:legacy-support-v4:$androidXLegacyVersion"
|
|
348
|
+
implementation "androidx.multidex:multidex:$androidXMultidexVersion"
|
|
415
349
|
implementation "androidx.appcompat:appcompat:$androidXAppCompatVersion"
|
|
416
350
|
implementation "com.google.android.material:material:$androidXMaterialVersion"
|
|
417
351
|
implementation "androidx.exifinterface:exifinterface:$androidXExifInterfaceVersion"
|
|
418
352
|
implementation "androidx.viewpager2:viewpager2:$androidXViewPagerVersion"
|
|
353
|
+
//noinspection KtxExtensionAvailable
|
|
419
354
|
implementation "androidx.fragment:fragment:$androidXFragmentVersion"
|
|
420
355
|
implementation "androidx.transition:transition:$androidXTransitionVersion"
|
|
421
356
|
|
|
@@ -515,7 +450,7 @@ if (failOnCompilationWarningsEnabled()) {
|
|
|
515
450
|
}
|
|
516
451
|
}
|
|
517
452
|
|
|
518
|
-
tasks.whenTaskAdded({
|
|
453
|
+
tasks.whenTaskAdded({ DefaultTask currentTask ->
|
|
519
454
|
if (currentTask =~ /generate.+BuildConfig/) {
|
|
520
455
|
currentTask.finalizedBy(extractAllJars)
|
|
521
456
|
extractAllJars.finalizedBy(collectAllJars)
|
|
@@ -525,7 +460,7 @@ tasks.whenTaskAdded({ org.gradle.api.DefaultTask currentTask ->
|
|
|
525
460
|
currentTask.finalizedBy(buildMetadata)
|
|
526
461
|
}
|
|
527
462
|
if (currentTask =~ /merge.*Assets/) {
|
|
528
|
-
currentTask.
|
|
463
|
+
currentTask.dependsOn(buildMetadata)
|
|
529
464
|
}
|
|
530
465
|
if (currentTask =~ /assemble.*Debug/ || currentTask =~ /assemble.*Release/) {
|
|
531
466
|
currentTask.finalizedBy("validateAppIdMatch")
|
|
@@ -573,10 +508,10 @@ def explodeAar(File compileDependency, File outputDir) {
|
|
|
573
508
|
logger.info("explodeAar: Extracting ${compileDependency.path} -> ${outputDir.path}")
|
|
574
509
|
|
|
575
510
|
if (compileDependency.name.endsWith(".aar")) {
|
|
576
|
-
|
|
511
|
+
JarFile jar = new JarFile(compileDependency)
|
|
577
512
|
Enumeration enumEntries = jar.entries()
|
|
578
513
|
while (enumEntries.hasMoreElements()) {
|
|
579
|
-
|
|
514
|
+
JarEntry file = (JarEntry) enumEntries.nextElement()
|
|
580
515
|
if (file.name.endsWith(".jar")) {
|
|
581
516
|
def targetFile = new File(outputDir, file.name)
|
|
582
517
|
InputStream inputStream = jar.getInputStream(file)
|
|
@@ -624,34 +559,15 @@ def getMergedAssetsOutputPath() {
|
|
|
624
559
|
|
|
625
560
|
// Discover all jars and dynamically create tasks for the extraction of each of them
|
|
626
561
|
project.ext.allJars = []
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
}.artifacts.each {
|
|
638
|
-
processJar(it.file, jars)
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
def projectDependencies = config.getAllDependencies().withType(ProjectDependency)
|
|
642
|
-
def dependentProjects = projectDependencies*.dependencyProject
|
|
643
|
-
dependentProjects.findAll {
|
|
644
|
-
// if there's a project dependency search for its result jar file in the build/intermediates/runtime_library_classes folder
|
|
645
|
-
// this is the output folder in gradle 5.1.1, but it can be changed in the future versions of gradle
|
|
646
|
-
def jarDir = new File("${it.getBuildDir()}/intermediates/runtime_library_classes/${buildType.toLowerCase()}")
|
|
647
|
-
if (jarDir.exists()) {
|
|
648
|
-
jarDir.eachFileRecurse(FileType.FILES) { file ->
|
|
649
|
-
if (file.path.endsWith(".jar")) {
|
|
650
|
-
processJar(file, jars)
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
} else {
|
|
654
|
-
outLogger.withStyle(Style.Info).println "WARNING: Folder ${jarDir.path} does not exists, the dependent project's classes won't be included in the metadata"
|
|
562
|
+
allprojects {
|
|
563
|
+
afterEvaluate { project ->
|
|
564
|
+
def buildType = project.selectedBuildType
|
|
565
|
+
def jars = []
|
|
566
|
+
def artifactType = Attribute.of('artifactType', String)
|
|
567
|
+
android.applicationVariants.all { variant ->
|
|
568
|
+
if (variant.buildType.name == buildType) {
|
|
569
|
+
variant.getCompileClasspath().each { fileDependency ->
|
|
570
|
+
processJar(fileDependency, jars)
|
|
655
571
|
}
|
|
656
572
|
}
|
|
657
573
|
}
|
|
@@ -713,7 +629,7 @@ task cleanupAllJars {
|
|
|
713
629
|
// An old directory which is no longer a dependency (e.g. orphaned by a deleted plugin)
|
|
714
630
|
if (!allDests.contains(it.name)) {
|
|
715
631
|
logger.info("Task cleanupAllJars: Deleting orphaned ${it.path}")
|
|
716
|
-
|
|
632
|
+
FileUtils.deleteDirectory(it)
|
|
717
633
|
}
|
|
718
634
|
}
|
|
719
635
|
}
|
|
@@ -802,7 +718,7 @@ task buildMetadata(type: BuildToolTask) {
|
|
|
802
718
|
description "builds metadata with provided jar dependencies"
|
|
803
719
|
|
|
804
720
|
inputs.files("$MDG_JAVA_DEPENDENCIES")
|
|
805
|
-
|
|
721
|
+
|
|
806
722
|
// make MDG aware of whitelist.mdg and blacklist.mdg files
|
|
807
723
|
inputs.files(project.fileTree(dir: "$rootDir", include: "**/*.mdg"))
|
|
808
724
|
|
|
@@ -831,7 +747,7 @@ task buildMetadata(type: BuildToolTask) {
|
|
|
831
747
|
|
|
832
748
|
def generatedClasses = new LinkedList<String>()
|
|
833
749
|
for (File subDir : classesSubDirs) {
|
|
834
|
-
if (subDir.getName()
|
|
750
|
+
if (subDir.getName() == selectedBuildType) {
|
|
835
751
|
generatedClasses.add(subDir.getAbsolutePath())
|
|
836
752
|
}
|
|
837
753
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|