nativescript 8.4.0 → 8.5.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/test-deps-versions-generated.json +1 -1
- package/lib/.d.ts +1 -0
- package/lib/bootstrap.js +1 -0
- package/lib/commands/typings.js +2 -1
- package/lib/definitions/ios.d.ts +8 -0
- package/lib/services/android-plugin-build-service.js +0 -33
- package/lib/services/android-project-service.js +1 -2
- package/lib/services/ios/spm-service.js +76 -0
- package/lib/services/ios/xcodebuild-args-service.js +4 -16
- package/lib/services/ios-project-service.js +3 -1
- package/lib/services/project-changes-service.js +3 -1
- package/package.json +2 -1
- package/vendor/gradle-plugin/build.gradle +176 -28
- package/vendor/gradle-plugin/gradle.properties +1 -16
- package/lib/common/test/definitions/mocha.d.ts +0 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
{"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.4.1","karma-coverage":"2.2.0","karma-nativescript-launcher":"0.4.0","mocha":"10.
|
|
1
|
+
{"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.4.1","karma-coverage":"2.2.0","karma-nativescript-launcher":"0.4.0","mocha":"10.2.0","karma-mocha":"2.0.1","karma-chai":"0.1.0","karma-jasmine":"4.0.2","karma-qunit":"4.1.2","@types/karma-chai":"0.1.3","@types/mocha":"10.0.1","@types/jasmine":"4.3.1","@types/qunit":"2.19.4","nyc":"15.1.0"}
|
package/lib/.d.ts
CHANGED
|
@@ -371,6 +371,7 @@
|
|
|
371
371
|
/// <reference path="services/ios-watch-app-service.ts" />
|
|
372
372
|
/// <reference path="services/ios/export-options-plist-service.ts" />
|
|
373
373
|
/// <reference path="services/ios/ios-signing-service.ts" />
|
|
374
|
+
/// <reference path="services/ios/spm-service.ts" />
|
|
374
375
|
/// <reference path="services/ios/xcodebuild-args-service.ts" />
|
|
375
376
|
/// <reference path="services/ios/xcodebuild-command-service.ts" />
|
|
376
377
|
/// <reference path="services/ios/xcodebuild-service.ts" />
|
package/lib/bootstrap.js
CHANGED
|
@@ -27,6 +27,7 @@ yok_1.injector.require("iOSProjectService", "./services/ios-project-service");
|
|
|
27
27
|
yok_1.injector.require("iOSProvisionService", "./services/ios-provision-service");
|
|
28
28
|
yok_1.injector.require("xcconfigService", "./services/xcconfig-service");
|
|
29
29
|
yok_1.injector.require("iOSSigningService", "./services/ios/ios-signing-service");
|
|
30
|
+
yok_1.injector.require("spmService", "./services/ios/spm-service");
|
|
30
31
|
yok_1.injector.require("xcodebuildArgsService", "./services/ios/xcodebuild-args-service");
|
|
31
32
|
yok_1.injector.require("xcodebuildCommandService", "./services/ios/xcodebuild-command-service");
|
|
32
33
|
yok_1.injector.require("xcodebuildService", "./services/ios/xcodebuild-service");
|
package/lib/commands/typings.js
CHANGED
|
@@ -95,7 +95,8 @@ class TypingsCommand {
|
|
|
95
95
|
this.$logger.warn("--filter flag is not supported yet.");
|
|
96
96
|
}
|
|
97
97
|
this.$fs.ensureDirectoryExists(path.resolve(this.$projectData.projectDir, "typings", "ios"));
|
|
98
|
-
|
|
98
|
+
const nsPath = path.resolve(__dirname, "../../bin/nativescript.js");
|
|
99
|
+
yield this.$childProcess.spawnFromEvent("node", [nsPath, "build", "ios"], "exit", {
|
|
99
100
|
env: Object.assign(Object.assign({}, process.env), { TNS_TYPESCRIPT_DECLARATIONS_PATH: path.resolve(this.$projectData.projectDir, "typings", "ios") }),
|
|
100
101
|
stdio: "inherit",
|
|
101
102
|
});
|
package/lib/definitions/ios.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ declare global {
|
|
|
41
41
|
): Promise<string>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
interface ISPMService {
|
|
45
|
+
applySPMPackages(platformData: IPlatformData, projectData: IProjectData);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
interface IXcodebuildArgsService {
|
|
45
49
|
getBuildForSimulatorArgs(
|
|
46
50
|
platformData: IPlatformData,
|
|
@@ -52,6 +56,10 @@ declare global {
|
|
|
52
56
|
projectData: IProjectData,
|
|
53
57
|
buildConfig: IBuildConfig
|
|
54
58
|
): Promise<string[]>;
|
|
59
|
+
getXcodeProjectArgs(
|
|
60
|
+
projectRoot: string,
|
|
61
|
+
projectData: IProjectData
|
|
62
|
+
): string[];
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
interface IXcodebuildCommandService {
|
|
@@ -101,22 +101,6 @@ class AndroidPluginBuildService {
|
|
|
101
101
|
return promise;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
getIncludeGradleCompileDependenciesScope(includeGradleFileContent) {
|
|
105
|
-
const indexOfDependenciesScope = includeGradleFileContent.indexOf("dependencies");
|
|
106
|
-
const result = [];
|
|
107
|
-
if (indexOfDependenciesScope === -1) {
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
const indexOfRepositoriesScope = includeGradleFileContent.indexOf("repositories");
|
|
111
|
-
let repositoriesScope = "";
|
|
112
|
-
if (indexOfRepositoriesScope >= 0) {
|
|
113
|
-
repositoriesScope = this.getScope("repositories", includeGradleFileContent);
|
|
114
|
-
result.push(repositoriesScope);
|
|
115
|
-
}
|
|
116
|
-
const dependenciesScope = this.getScope("dependencies", includeGradleFileContent);
|
|
117
|
-
result.push(dependenciesScope);
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
104
|
getScope(scopeName, content) {
|
|
121
105
|
const indexOfScopeName = content.indexOf(scopeName);
|
|
122
106
|
const openingBracket = "{";
|
|
@@ -253,10 +237,8 @@ class AndroidPluginBuildService {
|
|
|
253
237
|
const buildGradlePath = path.join(pluginTempDir, "build.gradle");
|
|
254
238
|
const settingsGradlePath = path.join(pluginTempDir, "settings.gradle");
|
|
255
239
|
this.$fs.copyFile(allGradleTemplateFiles, pluginTempDir);
|
|
256
|
-
this.addCompileDependencies(platformsAndroidDirPath, buildGradlePath);
|
|
257
240
|
const runtimeGradleVersions = yield this.getRuntimeGradleVersions(projectDir);
|
|
258
241
|
this.replaceGradleVersion(pluginTempDir, runtimeGradleVersions.gradleVersion);
|
|
259
|
-
this.replaceGradleAndroidPluginVersion(buildGradlePath, runtimeGradleVersions.gradleAndroidPluginVersion);
|
|
260
242
|
this.replaceFileContent(buildGradlePath, "{{pluginName}}", pluginName);
|
|
261
243
|
this.replaceFileContent(settingsGradlePath, "{{pluginName}}", pluginName);
|
|
262
244
|
});
|
|
@@ -369,27 +351,12 @@ class AndroidPluginBuildService {
|
|
|
369
351
|
const gradleWrapperPropertiesPath = path.join(pluginTempDir, "gradle", "wrapper", "gradle-wrapper.properties");
|
|
370
352
|
this.replaceFileContent(gradleWrapperPropertiesPath, gradleVersionPlaceholder, gradleVersion);
|
|
371
353
|
}
|
|
372
|
-
replaceGradleAndroidPluginVersion(buildGradlePath, version) {
|
|
373
|
-
const gradleAndroidPluginVersionPlaceholder = "{{runtimeAndroidPluginVersion}}";
|
|
374
|
-
const gradleAndroidPluginVersion = version || constants_1.AndroidBuildDefaults.GradleAndroidPluginVersion;
|
|
375
|
-
this.replaceFileContent(buildGradlePath, gradleAndroidPluginVersionPlaceholder, gradleAndroidPluginVersion);
|
|
376
|
-
}
|
|
377
354
|
replaceFileContent(filePath, content, replacement) {
|
|
378
355
|
const fileContent = this.$fs.readText(filePath);
|
|
379
356
|
const contentRegex = new RegExp(content, "g");
|
|
380
357
|
const replacedFileContent = fileContent.replace(contentRegex, replacement);
|
|
381
358
|
this.$fs.writeFile(filePath, replacedFileContent);
|
|
382
359
|
}
|
|
383
|
-
addCompileDependencies(platformsAndroidDirPath, buildGradlePath) {
|
|
384
|
-
const includeGradlePath = path.join(platformsAndroidDirPath, constants_1.INCLUDE_GRADLE_NAME);
|
|
385
|
-
if (this.$fs.exists(includeGradlePath)) {
|
|
386
|
-
const includeGradleContent = this.$fs.readText(includeGradlePath);
|
|
387
|
-
const compileDependencies = this.getIncludeGradleCompileDependenciesScope(includeGradleContent);
|
|
388
|
-
if (compileDependencies.length) {
|
|
389
|
-
this.$fs.appendFile(buildGradlePath, "\n" + compileDependencies.join("\n"));
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
360
|
copyAar(shortPluginName, pluginTempDir, aarOutputDir) {
|
|
394
361
|
const finalAarName = `${shortPluginName}-release.aar`;
|
|
395
362
|
const pathToBuiltAar = path.join(pluginTempDir, "build", "outputs", "aar", finalAarName);
|
|
@@ -126,8 +126,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
126
126
|
`${constants.APP_FOLDER_NAME}-${buildMode}${constants.APK_EXTENSION_NAME}`,
|
|
127
127
|
],
|
|
128
128
|
regexes: [
|
|
129
|
-
new RegExp(
|
|
130
|
-
new RegExp(`${packageName}-.*-(${constants_1.Configurations.Debug}|${constants_1.Configurations.Release})${constants.APK_EXTENSION_NAME}`, "i"),
|
|
129
|
+
new RegExp(`(${packageName}|${constants.APP_FOLDER_NAME})-.*-(${constants_1.Configurations.Debug}|${constants_1.Configurations.Release})(-unsigned)?${constants.APK_EXTENSION_NAME}`, "i"),
|
|
131
130
|
],
|
|
132
131
|
};
|
|
133
132
|
},
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SPMService = void 0;
|
|
13
|
+
const yok_1 = require("../../common/yok");
|
|
14
|
+
const trapezedev_project_1 = require("@rigor789/trapezedev-project");
|
|
15
|
+
class SPMService {
|
|
16
|
+
constructor($logger, $projectConfigService, $xcodebuildCommandService, $xcodebuildArgsService) {
|
|
17
|
+
this.$logger = $logger;
|
|
18
|
+
this.$projectConfigService = $projectConfigService;
|
|
19
|
+
this.$xcodebuildCommandService = $xcodebuildCommandService;
|
|
20
|
+
this.$xcodebuildArgsService = $xcodebuildArgsService;
|
|
21
|
+
}
|
|
22
|
+
getSPMPackages(projectData) {
|
|
23
|
+
const spmPackages = this.$projectConfigService.getValue("ios.experimentalSPMPackages", []);
|
|
24
|
+
return spmPackages;
|
|
25
|
+
}
|
|
26
|
+
hasSPMPackages(projectData) {
|
|
27
|
+
return this.getSPMPackages(projectData).length > 0;
|
|
28
|
+
}
|
|
29
|
+
applySPMPackages(platformData, projectData) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
try {
|
|
32
|
+
const spmPackages = this.getSPMPackages(projectData);
|
|
33
|
+
if (!spmPackages.length) {
|
|
34
|
+
this.$logger.trace("SPM: no SPM packages to apply.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const project = new trapezedev_project_1.MobileProject(platformData.projectRoot, {
|
|
38
|
+
ios: {
|
|
39
|
+
path: ".",
|
|
40
|
+
},
|
|
41
|
+
enableAndroid: false,
|
|
42
|
+
});
|
|
43
|
+
yield project.load();
|
|
44
|
+
if (!project.ios) {
|
|
45
|
+
this.$logger.trace("SPM: no iOS project found via trapeze.");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
for (const pkg of spmPackages) {
|
|
49
|
+
this.$logger.trace(`SPM: adding package ${pkg.name} to project.`, pkg);
|
|
50
|
+
yield project.ios.addSPMPackage(projectData.projectName, pkg);
|
|
51
|
+
}
|
|
52
|
+
yield project.commit();
|
|
53
|
+
yield this.resolveSPMDependencies(platformData, projectData);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
this.$logger.trace("SPM: error applying SPM packages: ", err);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
resolveSPMDependencies(platformData, projectData) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
yield this.$xcodebuildCommandService.executeCommand(this.$xcodebuildArgsService
|
|
63
|
+
.getXcodeProjectArgs(platformData.projectRoot, projectData)
|
|
64
|
+
.concat([
|
|
65
|
+
"-destination",
|
|
66
|
+
"generic/platform=iOS",
|
|
67
|
+
"-resolvePackageDependencies",
|
|
68
|
+
]), {
|
|
69
|
+
cwd: projectData.projectDir,
|
|
70
|
+
message: "Resolving SPM dependencies...",
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.SPMService = SPMService;
|
|
76
|
+
yok_1.injector.register("spmService", SPMService);
|
|
@@ -17,11 +17,6 @@ const yok_1 = require("../../common/yok");
|
|
|
17
17
|
const _ = require("lodash");
|
|
18
18
|
const DevicePlatformSdkName = "iphoneos";
|
|
19
19
|
const SimulatorPlatformSdkName = "iphonesimulator";
|
|
20
|
-
var ProductArgs;
|
|
21
|
-
(function (ProductArgs) {
|
|
22
|
-
ProductArgs["target"] = "target";
|
|
23
|
-
ProductArgs["scheme"] = "scheme";
|
|
24
|
-
})(ProductArgs || (ProductArgs = {}));
|
|
25
20
|
class XcodebuildArgsService {
|
|
26
21
|
constructor($devicePlatformsConstants, $devicesService, $fs, $iOSWatchAppService, $logger) {
|
|
27
22
|
this.$devicePlatformsConstants = $devicePlatformsConstants;
|
|
@@ -33,9 +28,7 @@ class XcodebuildArgsService {
|
|
|
33
28
|
getBuildForSimulatorArgs(platformData, projectData, buildConfig) {
|
|
34
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
30
|
let args = yield this.getArchitecturesArgs(buildConfig);
|
|
36
|
-
let productType;
|
|
37
31
|
if (this.$iOSWatchAppService.hasWatchApp(platformData, projectData)) {
|
|
38
|
-
productType = ProductArgs.scheme;
|
|
39
32
|
args = args.concat(["CODE_SIGNING_ALLOWED=NO"]);
|
|
40
33
|
}
|
|
41
34
|
else {
|
|
@@ -51,7 +44,7 @@ class XcodebuildArgsService {
|
|
|
51
44
|
])
|
|
52
45
|
.concat(this.getBuildCommonArgs(platformData, projectData, SimulatorPlatformSdkName))
|
|
53
46
|
.concat(this.getBuildLoggingArgs())
|
|
54
|
-
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData
|
|
47
|
+
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData));
|
|
55
48
|
return args;
|
|
56
49
|
});
|
|
57
50
|
}
|
|
@@ -69,7 +62,7 @@ class XcodebuildArgsService {
|
|
|
69
62
|
buildConfig.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug,
|
|
70
63
|
"-allowProvisioningUpdates",
|
|
71
64
|
]
|
|
72
|
-
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData
|
|
65
|
+
.concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData))
|
|
73
66
|
.concat(architectures)
|
|
74
67
|
.concat(this.getBuildCommonArgs(platformData, projectData, DevicePlatformSdkName))
|
|
75
68
|
.concat(this.getBuildLoggingArgs());
|
|
@@ -88,7 +81,7 @@ class XcodebuildArgsService {
|
|
|
88
81
|
return args;
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
|
-
getXcodeProjectArgs(projectRoot, projectData
|
|
84
|
+
getXcodeProjectArgs(projectRoot, projectData) {
|
|
92
85
|
const xcworkspacePath = path.join(projectRoot, `${projectData.projectName}.xcworkspace`);
|
|
93
86
|
if (this.$fs.exists(xcworkspacePath)) {
|
|
94
87
|
return [
|
|
@@ -99,12 +92,7 @@ class XcodebuildArgsService {
|
|
|
99
92
|
];
|
|
100
93
|
}
|
|
101
94
|
const xcodeprojPath = path.join(projectRoot, `${projectData.projectName}.xcodeproj`);
|
|
102
|
-
return [
|
|
103
|
-
"-project",
|
|
104
|
-
xcodeprojPath,
|
|
105
|
-
product ? "-" + product : "-target",
|
|
106
|
-
projectData.projectName,
|
|
107
|
-
];
|
|
95
|
+
return ["-project", xcodeprojPath, "-scheme", projectData.projectName];
|
|
108
96
|
}
|
|
109
97
|
getBuildLoggingArgs() {
|
|
110
98
|
return this.$logger.getLevel() === "INFO" ? ["-quiet"] : [];
|
|
@@ -36,7 +36,7 @@ const FRAMEWORK_EXTENSIONS = [".framework", ".xcframework"];
|
|
|
36
36
|
const getPlatformSdkName = (forDevice) => forDevice ? DevicePlatformSdkName : SimulatorPlatformSdkName;
|
|
37
37
|
const getConfigurationName = (release) => release ? constants_1.Configurations.Release : constants_1.Configurations.Debug;
|
|
38
38
|
class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
|
|
39
|
-
constructor($fs, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService) {
|
|
39
|
+
constructor($fs, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService, $spmService) {
|
|
40
40
|
super($fs, $projectDataService);
|
|
41
41
|
this.$childProcess = $childProcess;
|
|
42
42
|
this.$cocoapodsService = $cocoapodsService;
|
|
@@ -60,6 +60,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
60
60
|
this.$iOSNativeTargetService = $iOSNativeTargetService;
|
|
61
61
|
this.$sysInfo = $sysInfo;
|
|
62
62
|
this.$tempService = $tempService;
|
|
63
|
+
this.$spmService = $spmService;
|
|
63
64
|
this._platformsDirCache = null;
|
|
64
65
|
this._platformData = null;
|
|
65
66
|
}
|
|
@@ -504,6 +505,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
|
|
|
504
505
|
yield this.$cocoapodsService.executePodInstall(platformData.projectRoot, this.$xcprojService.getXcodeprojPath(projectData, platformData.projectRoot));
|
|
505
506
|
yield this.$cocoapodsService.mergePodXcconfigFile(projectData, platformData, opts);
|
|
506
507
|
}
|
|
508
|
+
yield this.$spmService.applySPMPackages(platformData, projectData);
|
|
507
509
|
const pbxProjPath = this.getPbxProjPath(projectData);
|
|
508
510
|
this.$iOSExtensionsService.removeExtensions({ pbxProjPath });
|
|
509
511
|
yield this.addExtensions(projectData, pluginsData);
|
|
@@ -198,7 +198,9 @@ class ProjectChangesService {
|
|
|
198
198
|
getProjectFileStrippedHash(projectDir, platformData) {
|
|
199
199
|
const projectFilePath = path.join(projectDir, constants_1.PACKAGE_JSON_FILE_NAME);
|
|
200
200
|
const projectFileContents = this.$fs.readJson(projectFilePath);
|
|
201
|
-
|
|
201
|
+
const relevantProperties = ["dependencies"];
|
|
202
|
+
const projectFileStrippedContents = _.pick(projectFileContents, relevantProperties);
|
|
203
|
+
return (0, helpers_1.getHash)(JSON.stringify(projectFileStrippedContents));
|
|
202
204
|
}
|
|
203
205
|
isProjectFileChanged(projectDir, platformData) {
|
|
204
206
|
const projectFileStrippedContentsHash = this.getProjectFileStrippedHash(projectDir, platformData);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nativescript",
|
|
3
3
|
"preferGlobal": true,
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.5.0-dev.0",
|
|
5
5
|
"author": "NativeScript <support@nativescript.org>",
|
|
6
6
|
"description": "Command-line interface for building NativeScript projects",
|
|
7
7
|
"bin": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@nativescript/doctor": "2.0.9",
|
|
61
61
|
"@nativescript/schematics-executor": "0.0.2",
|
|
62
62
|
"@rigor789/resolve-package-path": "^1.0.5",
|
|
63
|
+
"@rigor789/trapezedev-project": "^7.1.0",
|
|
63
64
|
"axios": "^0.21.1",
|
|
64
65
|
"byline": "5.0.0",
|
|
65
66
|
"chalk": "4.1.0",
|
|
@@ -7,38 +7,72 @@ apply plugin: 'com.android.library'
|
|
|
7
7
|
apply plugin: 'kotlin-android'
|
|
8
8
|
apply plugin: 'kotlin-parcelize'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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()}"
|
|
19
29
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
buildscript {
|
|
33
|
+
def GRADLE_PROPERTIES_FILENAME = "gradle.properties"
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
def getFile = { dir, filename ->
|
|
36
|
+
File file = new File("$dir$File.separator$filename")
|
|
37
|
+
file?.exists() ? file : null
|
|
26
38
|
}
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
def getPropertyFile = { dir ->
|
|
41
|
+
return getFile(dir, GRADLE_PROPERTIES_FILENAME)
|
|
42
|
+
}
|
|
43
|
+
def getUserProperties = { dir ->
|
|
44
|
+
def file = getPropertyFile(dir)
|
|
45
|
+
if (!file) {
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
31
48
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
project.ext.PLUGIN_NAME = "{{pluginName}}"
|
|
49
|
+
Properties properties = new Properties()
|
|
50
|
+
properties.load(file.newInputStream())
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
return properties
|
|
53
|
+
}
|
|
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
|
+
}
|
|
74
|
+
}
|
|
75
|
+
def getAppPath = { ->
|
|
42
76
|
def relativePathToApp = "app"
|
|
43
77
|
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
44
78
|
def nsConfig
|
|
@@ -59,8 +93,7 @@ buildscript {
|
|
|
59
93
|
|
|
60
94
|
return project.ext.appPath
|
|
61
95
|
}
|
|
62
|
-
|
|
63
|
-
project.ext.getAppResourcesPath = { ->
|
|
96
|
+
def getAppResourcesPath = { ->
|
|
64
97
|
def relativePathToAppResources
|
|
65
98
|
def absolutePathToAppResources
|
|
66
99
|
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")
|
|
@@ -87,6 +120,95 @@ buildscript {
|
|
|
87
120
|
return absolutePathToAppResources
|
|
88
121
|
}
|
|
89
122
|
|
|
123
|
+
def initialize = { ->
|
|
124
|
+
// set up our logger
|
|
125
|
+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
126
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t ~initialize"
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
project.ext.USER_PROJECT_ROOT = "$rootDir/../../.."
|
|
130
|
+
project.ext.PLATFORMS_ANDROID = "platforms/android"
|
|
131
|
+
project.ext.PLUGIN_NAME = "{{pluginName}}"
|
|
132
|
+
|
|
133
|
+
def userDir = "$USER_PROJECT_ROOT"
|
|
134
|
+
rootProject.ext.userDefinedGradleProperties = getUserProperties("${getAppResourcesPath()}/Android")
|
|
135
|
+
|
|
136
|
+
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/gradle.properties")
|
|
137
|
+
loadPropertyFile("$USER_PROJECT_ROOT/${project.ext.PLATFORMS_ANDROID}/additional_gradle.properties")
|
|
138
|
+
|
|
139
|
+
if (rootProject.hasProperty("userDefinedGradleProperties")) {
|
|
140
|
+
rootProject.ext.userDefinedGradleProperties.each { entry ->
|
|
141
|
+
def propertyName = entry.getKey()
|
|
142
|
+
def propertyValue = entry.getValue()
|
|
143
|
+
project.ext.set(propertyName, propertyValue)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
def getDepPlatformDir = { dep ->
|
|
148
|
+
file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/${dep.directory}/$PLATFORMS_ANDROID")
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Set up styled logger
|
|
152
|
+
project.ext.getDepPlatformDir = getDepPlatformDir
|
|
153
|
+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// the build script will not work with previous versions of the CLI (3.1 or earlier)
|
|
157
|
+
def dependenciesJson = file("${project.ext.USER_PROJECT_ROOT}/${project.ext.PLATFORMS_ANDROID}/dependencies.json")
|
|
158
|
+
def appDependencies = new JsonSlurper().parseText(dependenciesJson.text)
|
|
159
|
+
def pluginData = appDependencies.find { it.name == project.ext.PLUGIN_NAME }
|
|
160
|
+
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
|
+
}
|
|
211
|
+
}
|
|
90
212
|
def applyBuildScriptConfigurations = { ->
|
|
91
213
|
def absolutePathToAppResources = getAppResourcesPath()
|
|
92
214
|
def pathToBuildScriptGradle = "$absolutePathToAppResources/Android/buildscript.gradle"
|
|
@@ -112,8 +234,25 @@ buildscript {
|
|
|
112
234
|
apply from: pathToPluginBuildScriptGradle, to: buildscript
|
|
113
235
|
}
|
|
114
236
|
}
|
|
237
|
+
|
|
238
|
+
initialize()
|
|
115
239
|
applyBuildScriptConfigurations()
|
|
116
240
|
|
|
241
|
+
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
|
|
242
|
+
def computeBuildToolsVersion = { -> project.hasProperty("androidBuildToolsVersion") ? androidBuildToolsVersion : "${NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION}" }
|
|
243
|
+
def kotlinVersion = computeKotlinVersion()
|
|
244
|
+
def androidBuildToolsVersion = computeBuildToolsVersion()
|
|
245
|
+
|
|
246
|
+
repositories {
|
|
247
|
+
google()
|
|
248
|
+
mavenCentral()
|
|
249
|
+
}
|
|
250
|
+
dependencies {
|
|
251
|
+
classpath "com.android.tools.build:gradle:$androidBuildToolsVersion"
|
|
252
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
253
|
+
classpath "org.codehaus.groovy:groovy-all:3.0.8"
|
|
254
|
+
}
|
|
255
|
+
|
|
117
256
|
}
|
|
118
257
|
|
|
119
258
|
def pluginDependencies
|
|
@@ -156,6 +295,7 @@ android {
|
|
|
156
295
|
nativescriptDependencies.each { dep ->
|
|
157
296
|
def includeGradlePath = "${getDepPlatformDir(dep)}/include.gradle"
|
|
158
297
|
if (file(includeGradlePath).exists()) {
|
|
298
|
+
outLogger.withStyle(Style.SuccessHeader).println "\t + applying plugin include.gradle from dependency ${includeGradlePath}"
|
|
159
299
|
apply from: includeGradlePath
|
|
160
300
|
}
|
|
161
301
|
}
|
|
@@ -171,6 +311,10 @@ android {
|
|
|
171
311
|
versionCode 1
|
|
172
312
|
versionName "1.0"
|
|
173
313
|
}
|
|
314
|
+
lintOptions {
|
|
315
|
+
checkReleaseBuilds false
|
|
316
|
+
abortOnError false
|
|
317
|
+
}
|
|
174
318
|
}
|
|
175
319
|
|
|
176
320
|
|
|
@@ -187,9 +331,13 @@ def applyBeforePluginGradleConfiguration() {
|
|
|
187
331
|
task addDependenciesFromNativeScriptPlugins {
|
|
188
332
|
nativescriptDependencies.each { dep ->
|
|
189
333
|
def aarFiles = fileTree(dir: getDepPlatformDir(dep), include: ["**/*.aar"])
|
|
334
|
+
def currentDirname = file(project.buildscript.sourceFile).getParentFile().getName()
|
|
190
335
|
aarFiles.each { aarFile ->
|
|
191
336
|
def length = aarFile.name.length() - 4
|
|
192
337
|
def fileName = aarFile.name[0..<length]
|
|
338
|
+
if(fileName == currentDirname) {
|
|
339
|
+
return
|
|
340
|
+
}
|
|
193
341
|
outLogger.withStyle(Style.SuccessHeader).println "\t + adding aar plugin dependency: " + aarFile.getAbsolutePath()
|
|
194
342
|
project.dependencies.add("implementation", [name: fileName, ext: "aar"])
|
|
195
343
|
}
|
|
@@ -1,19 +1,4 @@
|
|
|
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
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Type definitions for mocha 1.9.0
|
|
2
|
-
// Project: http://visionmedia.github.io/mocha/
|
|
3
|
-
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
|
|
4
|
-
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
|
5
|
-
|
|
6
|
-
interface Mocha {
|
|
7
|
-
// Setup mocha with the given setting options.
|
|
8
|
-
setup(options: MochaSetupOptions): Mocha;
|
|
9
|
-
|
|
10
|
-
//Run tests and invoke `fn()` when complete.
|
|
11
|
-
run(callback?: () => void): void;
|
|
12
|
-
|
|
13
|
-
// Set reporter as function
|
|
14
|
-
reporter(reporter: () => void): Mocha;
|
|
15
|
-
|
|
16
|
-
// Set reporter, defaults to "dot"
|
|
17
|
-
reporter(reporter: string): Mocha;
|
|
18
|
-
|
|
19
|
-
// Enable growl support.
|
|
20
|
-
growl(): Mocha;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface MochaSetupOptions {
|
|
24
|
-
//milliseconds to wait before considering a test slow
|
|
25
|
-
slow?: number;
|
|
26
|
-
|
|
27
|
-
// timeout in milliseconds
|
|
28
|
-
timeout?: number;
|
|
29
|
-
|
|
30
|
-
// ui name "bdd", "tdd", "exports" etc
|
|
31
|
-
ui?: string;
|
|
32
|
-
|
|
33
|
-
//array of accepted globals
|
|
34
|
-
globals?: any[];
|
|
35
|
-
|
|
36
|
-
// reporter instance (function or string), defaults to `mocha.reporters.Dot`
|
|
37
|
-
reporter?: any;
|
|
38
|
-
|
|
39
|
-
// bail on the first test failure
|
|
40
|
-
bail?: Boolean;
|
|
41
|
-
|
|
42
|
-
// ignore global leaks
|
|
43
|
-
ignoreLeaks?: Boolean;
|
|
44
|
-
|
|
45
|
-
// grep string or regexp to filter tests with
|
|
46
|
-
grep?: any;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare module mocha {
|
|
50
|
-
interface Done {
|
|
51
|
-
(error?: Error): void;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare var describe: {
|
|
56
|
-
(description: string, spec: () => void): void;
|
|
57
|
-
only(description: string, spec: () => void): void;
|
|
58
|
-
skip(description: string, spec: () => void): void;
|
|
59
|
-
timeout(ms: number): void;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
declare var it: {
|
|
63
|
-
(expectation: string, assertion?: () => void): void;
|
|
64
|
-
(expectation: string, assertion?: (done: mocha.Done) => void): void;
|
|
65
|
-
only(expectation: string, assertion?: () => void): void;
|
|
66
|
-
only(expectation: string, assertion?: (done: mocha.Done) => void): void;
|
|
67
|
-
skip(expectation: string, assertion?: () => void): void;
|
|
68
|
-
skip(expectation: string, assertion?: (done: mocha.Done) => void): void;
|
|
69
|
-
timeout(ms: number): void;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
declare function before(action: () => void): void;
|
|
73
|
-
|
|
74
|
-
declare function before(action: (done: mocha.Done) => void): void;
|
|
75
|
-
|
|
76
|
-
declare function after(action: () => void): void;
|
|
77
|
-
|
|
78
|
-
declare function after(action: (done: mocha.Done) => void): void;
|
|
79
|
-
|
|
80
|
-
declare function beforeEach(action: () => void): void;
|
|
81
|
-
|
|
82
|
-
declare function beforeEach(action: (done: mocha.Done) => void): void;
|
|
83
|
-
|
|
84
|
-
declare function afterEach(action: () => void): void;
|
|
85
|
-
|
|
86
|
-
declare function afterEach(action: (done: mocha.Done) => void): void;
|