nativescript 9.0.0-alpha.8 → 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 -3
- 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 +18 -15
- 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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import groovy.json.JsonBuilder
|
|
2
|
+
|
|
3
|
+
import java.nio.charset.StandardCharsets
|
|
4
|
+
import java.nio.file.Files
|
|
5
|
+
import java.nio.file.Paths
|
|
6
|
+
import java.nio.file.Path
|
|
7
|
+
|
|
8
|
+
class AnalyticsCollector{
|
|
9
|
+
|
|
10
|
+
private final String analyticsFilePath
|
|
11
|
+
private boolean hasUseKotlinPropertyInApp = false
|
|
12
|
+
private boolean hasKotlinRuntimeClasses = false
|
|
13
|
+
|
|
14
|
+
private AnalyticsCollector(String analyticsFilePath){
|
|
15
|
+
this.analyticsFilePath = analyticsFilePath
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static AnalyticsCollector withOutputPath(String analyticsFilePath){
|
|
19
|
+
return new AnalyticsCollector(analyticsFilePath)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void markUseKotlinPropertyInApp(boolean useKotlin) {
|
|
23
|
+
hasUseKotlinPropertyInApp = useKotlin
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void writeAnalyticsFile() {
|
|
27
|
+
def jsonBuilder = new JsonBuilder()
|
|
28
|
+
def kotlinUsageData = new Object()
|
|
29
|
+
kotlinUsageData.metaClass.hasUseKotlinPropertyInApp = hasUseKotlinPropertyInApp
|
|
30
|
+
kotlinUsageData.metaClass.hasKotlinRuntimeClasses = hasKotlinRuntimeClasses
|
|
31
|
+
jsonBuilder(kotlinUsage: kotlinUsageData)
|
|
32
|
+
def prettyJson = jsonBuilder.toPrettyString()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Path statisticsFilePath = Paths.get(analyticsFilePath)
|
|
37
|
+
|
|
38
|
+
if (Files.notExists(statisticsFilePath)) {
|
|
39
|
+
Files.createDirectories(statisticsFilePath.getParent())
|
|
40
|
+
Files.createFile(statisticsFilePath)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Files.write(statisticsFilePath, prettyJson.getBytes(StandardCharsets.UTF_8))
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ext.AnalyticsCollector = AnalyticsCollector
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
2
|
+
|
|
3
|
+
class BuildToolTask extends JavaExec {
|
|
4
|
+
void setOutputs(def logger) {
|
|
5
|
+
def logFile = new File("$workingDir/${name}.log")
|
|
6
|
+
if(logFile.exists()) {
|
|
7
|
+
logFile.delete()
|
|
8
|
+
}
|
|
9
|
+
standardOutput new FileOutputStream(logFile)
|
|
10
|
+
errorOutput new FailureOutputStream(logger, logFile)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class FailureOutputStream extends OutputStream {
|
|
15
|
+
private logger
|
|
16
|
+
private File logFile
|
|
17
|
+
private currentLine = ""
|
|
18
|
+
private firstWrite = true
|
|
19
|
+
FailureOutputStream(inLogger, inLogFile) {
|
|
20
|
+
logger = inLogger
|
|
21
|
+
logFile = inLogFile
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
void write(int i) throws IOException {
|
|
26
|
+
if(firstWrite) {
|
|
27
|
+
println ""
|
|
28
|
+
firstWrite = false
|
|
29
|
+
}
|
|
30
|
+
currentLine += String.valueOf((char) i)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
void flush() {
|
|
35
|
+
if(currentLine?.trim()) {
|
|
36
|
+
logger.withStyle(Style.Failure).println currentLine.trim()
|
|
37
|
+
currentLine = ""
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
void close() {
|
|
43
|
+
if(!firstWrite && logFile.exists()) {
|
|
44
|
+
logger.withStyle(Style.Info).println "Detailed log here: ${logFile.getAbsolutePath()}\n"
|
|
45
|
+
}
|
|
46
|
+
super.close()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ext.BuildToolTask = BuildToolTask
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
2
|
+
|
|
3
|
+
import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
4
|
+
def outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
5
|
+
|
|
6
|
+
class CustomExecutionLogger extends BuildAdapter implements TaskExecutionListener {
|
|
7
|
+
private logger
|
|
8
|
+
private failedTask
|
|
9
|
+
|
|
10
|
+
CustomExecutionLogger(passedLogger) {
|
|
11
|
+
logger = passedLogger
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
void buildStarted(Gradle gradle) {
|
|
15
|
+
failedTask = null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void beforeExecute(Task task) {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void afterExecute(Task task, TaskState state) {
|
|
22
|
+
def failure = state.getFailure()
|
|
23
|
+
if(failure) {
|
|
24
|
+
failedTask = task
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void buildFinished(BuildResult result) {
|
|
29
|
+
def failure = result.getFailure()
|
|
30
|
+
if(failure) {
|
|
31
|
+
if(failedTask && (failedTask.getClass().getName().contains("BuildToolTask"))) {
|
|
32
|
+
// the error from this task is already logged
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
println ""
|
|
37
|
+
logger.withStyle(Style.FailureHeader).println failure.getMessage()
|
|
38
|
+
|
|
39
|
+
def causeException = failure.getCause()
|
|
40
|
+
while (causeException != null) {
|
|
41
|
+
failure = causeException
|
|
42
|
+
causeException = failure.getCause()
|
|
43
|
+
}
|
|
44
|
+
if(failure != causeException) {
|
|
45
|
+
logger.withStyle(Style.Failure).println failure.getMessage()
|
|
46
|
+
}
|
|
47
|
+
println ""
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
gradle.useLogger(new CustomExecutionLogger(outLogger))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Project-wide Gradle settings.
|
|
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.
|
|
17
|
+
org.gradle.jvmargs=-Xmx16384M
|
|
18
|
+
android.enableJetifier=true
|
|
19
|
+
android.useAndroidX=true
|
|
20
|
+
|
|
21
|
+
# Default versions used throughout the gradle configurations
|
|
22
|
+
NS_DEFAULT_BUILD_TOOLS_VERSION=35.0.0
|
|
23
|
+
NS_DEFAULT_COMPILE_SDK_VERSION=35
|
|
24
|
+
NS_DEFAULT_MIN_SDK_VERSION=21
|
|
25
|
+
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=8.12.1
|
|
26
|
+
|
|
27
|
+
ns_default_androidx_appcompat_version = 1.7.0
|
|
28
|
+
ns_default_androidx_exifinterface_version = 1.3.7
|
|
29
|
+
ns_default_androidx_fragment_version = 1.8.5
|
|
30
|
+
ns_default_androidx_material_version = 1.8.0
|
|
31
|
+
ns_default_androidx_multidex_version = 2.0.1
|
|
32
|
+
ns_default_androidx_transition_version = 1.5.1
|
|
33
|
+
ns_default_androidx_viewpager_version = 1.0.0
|
|
34
|
+
ns_default_asm_util_version = 9.7
|
|
35
|
+
ns_default_asm_version = 9.7
|
|
36
|
+
ns_default_bcel_version = 6.8.2
|
|
37
|
+
ns_default_commons_io_version = 2.6
|
|
38
|
+
ns_default_google_java_format_version = 1.6
|
|
39
|
+
ns_default_gson_version = 2.10.1
|
|
40
|
+
ns_default_json_version = 20180813
|
|
41
|
+
ns_default_junit_version = 4.13.2
|
|
42
|
+
ns_default_kotlin_version = 2.2.20
|
|
43
|
+
ns_default_kotlinx_metadata_jvm_version = 2.2.20
|
|
44
|
+
ns_default_mockito_core_version = 3.0.0
|
|
45
|
+
ns_default_spotbugs_version = 3.1.12
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
2
|
+
|
|
3
|
+
import java.nio.file.Paths
|
|
4
|
+
|
|
5
|
+
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
6
|
+
import groovy.json.JsonSlurper
|
|
7
|
+
import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
8
|
+
|
|
9
|
+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
10
|
+
|
|
11
|
+
buildscript {
|
|
12
|
+
|
|
13
|
+
def initialize = { ->
|
|
14
|
+
// set up our logger
|
|
15
|
+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
16
|
+
def userDir = "${rootProject.projectDir}/../.."
|
|
17
|
+
apply from: "$rootDir/gradle-helpers/user_properties_reader.gradle"
|
|
18
|
+
apply from: "$rootDir/gradle-helpers/paths.gradle"
|
|
19
|
+
rootProject.ext.userDefinedGradleProperties = getUserProperties("${getAppResourcesPath(userDir)}/Android")
|
|
20
|
+
|
|
21
|
+
loadPropertyFile("$rootDir/additional_gradle.properties")
|
|
22
|
+
|
|
23
|
+
if (rootProject.hasProperty("userDefinedGradleProperties")) {
|
|
24
|
+
rootProject.ext.userDefinedGradleProperties.each { entry ->
|
|
25
|
+
def propertyName = entry.getKey()
|
|
26
|
+
def propertyValue = entry.getValue()
|
|
27
|
+
project.ext.set(propertyName, propertyValue)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// the build script will not work with previous versions of the CLI (3.1 or earlier)
|
|
32
|
+
def dependenciesJson = file("$rootDir/dependencies.json")
|
|
33
|
+
if (!dependenciesJson.exists()) {
|
|
34
|
+
throw new BuildCancelledException("""
|
|
35
|
+
'dependencies.json' file not found. Check whether the NativeScript CLI has prepared the project beforehand,
|
|
36
|
+
and that your NativeScript version is 3.3, or a more recent one. To build an android project with the current
|
|
37
|
+
version of the {N} CLI install a previous version of the runtime package - 'tns platform add android@3.2'.
|
|
38
|
+
""")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
project.ext.extractedDependenciesDir = "${project.layout.buildDirectory.dir("exploded-dependencies").get().asFile}"
|
|
42
|
+
project.ext.cleanupAllJarsTimestamp = "${project.layout.buildDirectory.file("cleanupAllJars.timestamp").get().asFile}"
|
|
43
|
+
project.ext.extractAllJarsTimestamp = "${project.layout.buildDirectory.file("extractAllJars.timestamp").get().asFile}"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
project.ext.nativescriptDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
47
|
+
project.ext.PLATFORMS_ANDROID = "platforms/android"
|
|
48
|
+
project.ext.USER_PROJECT_ROOT = "$rootDir/../.."
|
|
49
|
+
|
|
50
|
+
project.ext.getAppPath = { ->
|
|
51
|
+
def relativePathToApp = "app"
|
|
52
|
+
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
53
|
+
def nsConfig
|
|
54
|
+
|
|
55
|
+
if (nsConfigFile.exists()) {
|
|
56
|
+
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (project.hasProperty("appPath")) {
|
|
60
|
+
// when appPath is passed through -PappPath=/path/to/app
|
|
61
|
+
// the path could be relative or absolute - either case will work
|
|
62
|
+
relativePathToApp = appPath
|
|
63
|
+
} else if (nsConfig != null && nsConfig.appPath != null) {
|
|
64
|
+
relativePathToApp = nsConfig.appPath
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
project.ext.appPath = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToApp).toAbsolutePath()
|
|
68
|
+
|
|
69
|
+
return project.ext.appPath
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
project.ext.getAppResourcesPath = { ->
|
|
73
|
+
def relativePathToAppResources
|
|
74
|
+
def absolutePathToAppResources
|
|
75
|
+
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
76
|
+
def nsConfig
|
|
77
|
+
|
|
78
|
+
if (nsConfigFile.exists()) {
|
|
79
|
+
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (project.hasProperty("appResourcesPath")) {
|
|
83
|
+
// when appResourcesPath is passed through -PappResourcesPath=/path/to/App_Resources
|
|
84
|
+
// the path could be relative or absolute - either case will work
|
|
85
|
+
relativePathToAppResources = appResourcesPath
|
|
86
|
+
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
87
|
+
} else if (nsConfig != null && nsConfig.appResourcesPath != null) {
|
|
88
|
+
relativePathToAppResources = nsConfig.appResourcesPath
|
|
89
|
+
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
90
|
+
} else {
|
|
91
|
+
absolutePathToAppResources = "${getAppPath()}/App_Resources"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
project.ext.appResourcesPath = absolutePathToAppResources
|
|
95
|
+
|
|
96
|
+
return absolutePathToAppResources
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
def applyBeforePluginGradleConfiguration = { ->
|
|
103
|
+
def appResourcesPath = getAppResourcesPath()
|
|
104
|
+
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
|
|
105
|
+
def beforePluginGradle = file(pathToBeforePluginGradle)
|
|
106
|
+
if (beforePluginGradle.exists()) {
|
|
107
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined configuration from ${beforePluginGradle}"
|
|
108
|
+
apply from: pathToBeforePluginGradle
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
def applyBuildScriptConfigurations = { ->
|
|
113
|
+
def absolutePathToAppResources = getAppResourcesPath()
|
|
114
|
+
def pathToBuildScriptGradle = "$absolutePathToAppResources/Android/rootbuildscript.gradle"
|
|
115
|
+
def buildScriptGradle = file(pathToBuildScriptGradle)
|
|
116
|
+
if (buildScriptGradle.exists()) {
|
|
117
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined root buildscript from ${buildScriptGradle}"
|
|
118
|
+
apply from: pathToBuildScriptGradle, to: buildscript
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
nativescriptDependencies.each { dep ->
|
|
122
|
+
def pathToPluginBuildScriptGradle = "$rootDir/${dep.directory}/$PLATFORMS_ANDROID/rootbuildscript.gradle"
|
|
123
|
+
def pluginBuildScriptGradle = file(pathToPluginBuildScriptGradle)
|
|
124
|
+
if (pluginBuildScriptGradle.exists()) {
|
|
125
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined rootbuildscript from dependency ${pluginBuildScriptGradle}"
|
|
126
|
+
apply from: pathToPluginBuildScriptGradle, to: buildscript
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
initialize()
|
|
132
|
+
applyBuildScriptConfigurations()
|
|
133
|
+
applyBeforePluginGradleConfiguration()
|
|
134
|
+
|
|
135
|
+
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
|
|
136
|
+
def computeBuildToolsVersion = { -> project.hasProperty("androidBuildToolsVersion") ? androidBuildToolsVersion : "${NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION}" }
|
|
137
|
+
def kotlinVersion = computeKotlinVersion()
|
|
138
|
+
def androidBuildToolsVersion = computeBuildToolsVersion()
|
|
139
|
+
|
|
140
|
+
repositories {
|
|
141
|
+
google()
|
|
142
|
+
mavenCentral()
|
|
143
|
+
}
|
|
144
|
+
dependencies {
|
|
145
|
+
classpath "com.android.tools.build:gradle:$androidBuildToolsVersion"
|
|
146
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
147
|
+
classpath "org.apache.groovy:groovy-all:4.0.21"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
allprojects {
|
|
152
|
+
repositories {
|
|
153
|
+
google()
|
|
154
|
+
mavenCentral()
|
|
155
|
+
}
|
|
156
|
+
beforeEvaluate { project ->
|
|
157
|
+
if (rootProject.hasProperty("userDefinedGradleProperties")) {
|
|
158
|
+
rootProject.ext.userDefinedGradleProperties.each { entry ->
|
|
159
|
+
def propertyName = entry.getKey()
|
|
160
|
+
def propertyValue = entry.getValue()
|
|
161
|
+
project.ext.set(propertyName, propertyValue)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
task clean (type:Delete) {
|
|
169
|
+
delete rootProject.layout.buildDirectory.get().asFile
|
|
170
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
rootProject.name = "__PROJECT_NAME__"
|
|
2
|
+
include ':app'//, ':runtime', ':runtime-binding-generator'
|
|
3
|
+
|
|
4
|
+
//project(':runtime').projectDir = new File("${System.env.ANDROID_RUNTIME_HOME}/test-app/runtime")
|
|
5
|
+
//project(':runtime-binding-generator').projectDir = new File("${System.env.ANDROID_RUNTIME_HOME}/test-app/runtime-binding-generator")
|
|
6
|
+
|
|
7
|
+
file("google-services.json").renameTo(file("./app/google-services.json"))
|
|
8
|
+
|
|
9
|
+
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
10
|
+
|
|
11
|
+
import java.nio.file.Paths
|
|
12
|
+
|
|
13
|
+
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
|
14
|
+
import groovy.json.JsonSlurper
|
|
15
|
+
import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
16
|
+
|
|
17
|
+
def USER_PROJECT_ROOT = "$rootDir/../../"
|
|
18
|
+
def outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
19
|
+
def ext = {
|
|
20
|
+
appResourcesPath = getProperty("appResourcesPath")
|
|
21
|
+
appPath = getProperty("appPath")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def getAppPath = { ->
|
|
25
|
+
def relativePathToApp = "app"
|
|
26
|
+
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
27
|
+
def nsConfig
|
|
28
|
+
|
|
29
|
+
if (nsConfigFile.exists()) {
|
|
30
|
+
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (ext.appPath) {
|
|
34
|
+
// when appPath is passed through -PappPath=/path/to/app
|
|
35
|
+
// the path could be relative or absolute - either case will work
|
|
36
|
+
relativePathToApp = ext.appPath
|
|
37
|
+
} else if (nsConfig != null && nsConfig.appPath != null) {
|
|
38
|
+
relativePathToApp = nsConfig.appPath
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return Paths.get(USER_PROJECT_ROOT).resolve(relativePathToApp).toAbsolutePath()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def getAppResourcesPath = { ->
|
|
46
|
+
def relativePathToAppResources
|
|
47
|
+
def absolutePathToAppResources
|
|
48
|
+
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
49
|
+
def nsConfig
|
|
50
|
+
|
|
51
|
+
if (nsConfigFile.exists()) {
|
|
52
|
+
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
|
|
53
|
+
}
|
|
54
|
+
if (ext.appResourcesPath) {
|
|
55
|
+
// when appResourcesPath is passed through -PappResourcesPath=/path/to/App_Resources
|
|
56
|
+
// the path could be relative or absolute - either case will work
|
|
57
|
+
relativePathToAppResources = ext.appResourcesPath
|
|
58
|
+
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
59
|
+
} else if (nsConfig != null && nsConfig.appResourcesPath != null) {
|
|
60
|
+
relativePathToAppResources = nsConfig.appResourcesPath
|
|
61
|
+
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
|
|
62
|
+
} else {
|
|
63
|
+
absolutePathToAppResources = "${getAppPath()}/App_Resources"
|
|
64
|
+
}
|
|
65
|
+
return absolutePathToAppResources
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
def applySettingsGradleConfiguration = { ->
|
|
69
|
+
def appResourcesPath = getAppResourcesPath()
|
|
70
|
+
def pathToSettingsGradle = "$appResourcesPath/Android/settings.gradle"
|
|
71
|
+
def settingsGradle = file(pathToSettingsGradle)
|
|
72
|
+
if (settingsGradle.exists()) {
|
|
73
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined configuration from ${settingsGradle}"
|
|
74
|
+
apply from: pathToSettingsGradle
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
applySettingsGradleConfiguration()
|