Skip to content

Commit c651089

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 3975f1a + 5042306 commit c651089

File tree

6 files changed

+68
-79
lines changed

6 files changed

+68
-79
lines changed

lib/controllers/migrate-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class MigrateController
184184
{
185185
packageName: "@nativescript/angular",
186186
minVersion: "10.0.0",
187-
desiredVersion: "^14.0.0",
187+
desiredVersion: "~14.2.0",
188188
async shouldMigrateAction(
189189
dependency: IMigrationDependency,
190190
projectData: IProjectData,
@@ -1293,7 +1293,7 @@ export class MigrateController
12931293

12941294
private async migrateNativeScriptAngular(): Promise<IMigrationDependency[]> {
12951295
const minVersion = "10.0.0";
1296-
const desiredVersion = "~14.1.0";
1296+
const desiredVersion = "~14.2.0";
12971297

12981298
const dependencies: IMigrationDependency[] = [
12991299
{

lib/services/android-plugin-build-service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
374374
);
375375
const allGradleTemplateFiles = path.join(gradleTemplatePath, "*");
376376
const buildGradlePath = path.join(pluginTempDir, "build.gradle");
377-
377+
const settingsGradlePath = path.join(pluginTempDir, "settings.gradle");
378+
378379
this.$fs.copyFile(allGradleTemplateFiles, pluginTempDir);
379380
const runtimeGradleVersions = await this.getRuntimeGradleVersions(
380381
projectDir
@@ -384,6 +385,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
384385
runtimeGradleVersions.gradleVersion
385386
);
386387
this.replaceFileContent(buildGradlePath, "{{pluginName}}", pluginName);
388+
this.replaceFileContent(settingsGradlePath, "{{pluginName}}", pluginName);
387389
}
388390

389391
private async getRuntimeGradleVersions(
@@ -719,6 +721,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
719721
"-p",
720722
pluginBuildSettings.pluginDir,
721723
"assembleRelease",
724+
`-PtempBuild=true`,
722725
`-PcompileSdk=android-${pluginBuildSettings.androidToolsInfo.compileSdkVersion}`,
723726
`-PbuildToolsVersion=${pluginBuildSettings.androidToolsInfo.buildToolsVersion}`,
724727
`-PappPath=${this.$projectData.getAppDirectoryPath()}`,

lib/services/android/gradle-build-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export class GradleBuildService
3434
if(buildData.emulator) {
3535
devices = devices.filter(d=>d.isEmulator);
3636
}
37-
const abis = devices.map(d=>d.deviceInfo.abis[0]);
38-
if (abis.length > 0) {
37+
const abis = devices.map(d=>d.deviceInfo.abis.filter(a=>!!a && a.length)[0]).filter(a=>!!a);
38+
if (abis.length > 0 && buildTaskArgs.findIndex(b=>b.startsWith('-PabiFilters')) === -1) {
3939
buildTaskArgs.push(`-PabiFilters=${abis.join(',')}`);
4040
}
4141
}

lib/services/platform-environment-requirements.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ export class PlatformEnvironmentRequirements
152152
darwin: "macos",
153153
} as any)[process.platform];
154154

155+
const anchor = platform ? `#${os}-${platform.toLowerCase()}` : ''
156+
155157
return (
156158
`Verify that your environment is configured according to the system requirements described at\n` +
157-
`https://docs.nativescript.org/environment-setup.html#${os}-${platform.toLowerCase()}.`
159+
`https://docs.nativescript.org/environment-setup.html${anchor}.`
158160
);
159161
}
160162

vendor/gradle-plugin/build.gradle

Lines changed: 33 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ buildscript {
7272
logger.warn "\t + failed to load gradle properties from \"$path\". Error is: ${ex.getMessage()}"
7373
}
7474
}
75-
def getAppPath = { ->
75+
76+
77+
project.ext.getAppPath = { ->
7678
def relativePathToApp = "app"
7779
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
7880
def nsConfig
@@ -93,7 +95,7 @@ buildscript {
9395

9496
return project.ext.appPath
9597
}
96-
def getAppResourcesPath = { ->
98+
project.ext.getAppResourcesPath = { ->
9799
def relativePathToAppResources
98100
def absolutePathToAppResources
99101
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
@@ -112,14 +114,25 @@ buildscript {
112114
relativePathToAppResources = nsConfig.appResourcesPath
113115
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
114116
} else {
115-
absolutePathToAppResources = "${getAppPath()}/App_Resources"
117+
absolutePathToAppResources = "${project.ext.getAppPath()}/App_Resources"
116118
}
117119

118120
project.ext.appResourcesPath = absolutePathToAppResources
119121

120122
return absolutePathToAppResources
121123
}
122124

125+
project.ext.applyBeforePluginGradleConfiguration = { ->
126+
def appResourcesPath = project.ext.getAppResourcesPath()
127+
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
128+
def beforePluginGradle = file(pathToBeforePluginGradle)
129+
if (beforePluginGradle.exists()) {
130+
outLogger.withStyle(Style.SuccessHeader).println "\t ~ applying user-defined configuration from ${beforePluginGradle}"
131+
apply from: pathToBeforePluginGradle
132+
}
133+
}
134+
135+
123136
def initialize = { ->
124137
// set up our logger
125138
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
@@ -131,7 +144,7 @@ buildscript {
131144
project.ext.PLUGIN_NAME = "{{pluginName}}"
132145

133146
def userDir = "$USER_PROJECT_ROOT"
134-
rootProject.ext.userDefinedGradleProperties = getUserProperties("${getAppResourcesPath()}/Android")
147+
rootProject.ext.userDefinedGradleProperties = getUserProperties("${project.ext.getAppResourcesPath()}/Android")
135148

136149
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/gradle.properties")
137150
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/additional_gradle.properties")
@@ -158,59 +171,9 @@ buildscript {
158171
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
159172
def pluginData = appDependencies.find { it.name == project.ext.PLUGIN_NAME }
160173
project.ext.nativescriptDependencies = appDependencies.findAll{pluginData.dependencies.contains(it.name)}.plus([pluginData])
161-
162-
project.ext.getAppResourcesPath = { ->
163-
def relativePathToAppResources
164-
def absolutePathToAppResources
165-
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
166-
def nsConfig
167-
168-
if (nsConfigFile.exists()) {
169-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
170-
}
171-
172-
if (project.hasProperty("appResourcesPath")) {
173-
// when appResourcesPath is passed through -PappResourcesPath=/path/to/App_Resources
174-
// the path could be relative or absolute - either case will work
175-
relativePathToAppResources = appResourcesPath
176-
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
177-
} else if (nsConfig != null && nsConfig.appResourcesPath != null) {
178-
relativePathToAppResources = nsConfig.appResourcesPath
179-
absolutePathToAppResources = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToAppResources).toAbsolutePath()
180-
} else {
181-
absolutePathToAppResources = "${getAppPath()}/App_Resources"
182-
}
183-
184-
project.ext.appResourcesPath = absolutePathToAppResources
185-
186-
return absolutePathToAppResources
187-
}
188-
189-
190-
project.ext.getAppPath = { ->
191-
def relativePathToApp = "app"
192-
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
193-
def nsConfig
194-
195-
if (nsConfigFile.exists()) {
196-
nsConfig = new JsonSlurper().parseText(nsConfigFile.getText("UTF-8"))
197-
}
198-
199-
if (project.hasProperty("appPath")) {
200-
// when appPath is passed through -PappPath=/path/to/app
201-
// the path could be relative or absolute - either case will work
202-
relativePathToApp = appPath
203-
} else if (nsConfig != null && nsConfig.appPath != null) {
204-
relativePathToApp = nsConfig.appPath
205-
}
206-
207-
project.ext.appPath = Paths.get(USER_PROJECT_ROOT).resolve(relativePathToApp).toAbsolutePath()
208-
209-
return project.ext.appPath
210-
}
211174
}
212175
def applyBuildScriptConfigurations = { ->
213-
def absolutePathToAppResources = getAppResourcesPath()
176+
def absolutePathToAppResources = project.ext.getAppResourcesPath()
214177
def pathToBuildScriptGradle = "$absolutePathToAppResources/Android/buildscript.gradle"
215178
def buildScriptGradle = file(pathToBuildScriptGradle)
216179
if (buildScriptGradle.exists()) {
@@ -225,6 +188,12 @@ buildscript {
225188
outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined buildscript from dependency ${pluginBuildScriptGradle}"
226189
apply from: pathToPluginBuildScriptGradle, to: buildscript
227190
}
191+
// def pathToPluginProjectBuildScriptGradle = "${getDepPlatformDir(dep)}/project-buildscript.gradle"
192+
// def pluginProjectBuildScriptGradle = file(pathToPluginProjectBuildScriptGradle)
193+
// if (pluginProjectBuildScriptGradle.exists()) {
194+
// outLogger.withStyle(Style.SuccessHeader).println "\t + applying user-defined project-buildscript from dependency ${pluginProjectBuildScriptGradle}"
195+
// apply from: pathToPluginProjectBuildScriptGradle, to: project
196+
// }
228197
}
229198

230199
def pathToPluginBuildScriptGradle = "$rootDir/buildscript.gradle"
@@ -236,6 +205,7 @@ buildscript {
236205
}
237206

238207
initialize()
208+
project.ext.applyBeforePluginGradleConfiguration()
239209
applyBuildScriptConfigurations()
240210

241211
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
@@ -283,12 +253,6 @@ allprojects {
283253
}
284254
}
285255

286-
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 31 }
287-
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : 31 as int }
288-
def computeBuildToolsVersion = { ->
289-
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "31.0.0"
290-
}
291-
292256
android {
293257
def applyPluginGradleConfigurations = { ->
294258
nativescriptDependencies.each { dep ->
@@ -299,7 +263,14 @@ android {
299263
}
300264
}
301265
}
302-
applyBeforePluginGradleConfiguration()
266+
267+
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? project.compileSdk : 31 }
268+
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? project.targetSdk : 31 as int }
269+
def computeBuildToolsVersion = { ->
270+
project.hasProperty("buildToolsVersion") ? project.buildToolsVersion : "31.0.0"
271+
}
272+
273+
project.ext.applyBeforePluginGradleConfiguration()
303274
applyPluginGradleConfigurations()
304275

305276
compileSdkVersion computeCompileSdkVersion()
@@ -321,17 +292,6 @@ android {
321292
}
322293
}
323294

324-
325-
def applyBeforePluginGradleConfiguration() {
326-
def appResourcesPath = getAppResourcesPath()
327-
def pathToBeforePluginGradle = "$appResourcesPath/Android/before-plugins.gradle"
328-
def beforePluginGradle = file(pathToBeforePluginGradle)
329-
if (beforePluginGradle.exists()) {
330-
outLogger.withStyle(Style.SuccessHeader).println "\t ~ applying user-defined configuration from ${beforePluginGradle}"
331-
apply from: pathToBeforePluginGradle
332-
}
333-
}
334-
335295
task addDependenciesFromNativeScriptPlugins {
336296
nativescriptDependencies.each { dep ->
337297
def aarFiles = fileTree(dir: getDepPlatformDir(dep), include: ["**/*.aar"])
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1+
import groovy.json.JsonSlurper
12

3+
def USER_PROJECT_ROOT = "$rootDir/../../../"
4+
def PLATFORMS_ANDROID = "platforms/android"
5+
def PLUGIN_NAME = "{{pluginName}}"
6+
7+
def dependenciesJson = file("${USER_PROJECT_ROOT}/${PLATFORMS_ANDROID}/dependencies.json")
8+
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
9+
def pluginData = appDependencies.find { it.name == PLUGIN_NAME }
10+
def nativescriptDependencies = appDependencies.findAll{pluginData.name == it.name}
11+
12+
def getDepPlatformDir = { dep ->
13+
file("$USER_PROJECT_ROOT/$PLATFORMS_ANDROID/${dep.directory}/$PLATFORMS_ANDROID")
14+
}
15+
16+
def applyIncludeSettingsGradlePlugin = {
17+
nativescriptDependencies.each { dep ->
18+
def includeSettingsGradlePath = "${getDepPlatformDir(dep)}/include-settings.gradle"
19+
if (file(includeSettingsGradlePath).exists()) {
20+
apply from: includeSettingsGradlePath
21+
}
22+
}
23+
}
24+
25+
applyIncludeSettingsGradlePlugin()

0 commit comments

Comments
 (0)