nativescript 8.7.0-rc.0 → 8.7.0-rc.2
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/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +7 -0
- package/lib/bootstrap.js +7 -1
- package/lib/color.js +3 -0
- package/lib/commands/add-platform.js +1 -0
- package/lib/commands/apple-login.js +1 -0
- package/lib/commands/appstore-list.js +1 -0
- package/lib/commands/appstore-upload.js +4 -0
- package/lib/commands/build.js +20 -3
- package/lib/commands/clean.js +22 -1
- package/lib/commands/command-base.js +1 -0
- package/lib/commands/config.js +3 -0
- package/lib/commands/create-project.js +34 -19
- package/lib/commands/debug.js +6 -1
- package/lib/commands/deploy.js +3 -2
- package/lib/commands/extensibility/install-extension.js +1 -0
- package/lib/commands/extensibility/list-extensions.js +1 -0
- package/lib/commands/extensibility/uninstall-extension.js +1 -0
- package/lib/commands/fonts.js +1 -0
- package/lib/commands/generate-assets.js +1 -0
- package/lib/commands/generate-help.js +1 -0
- package/lib/commands/generate.js +12 -2
- package/lib/commands/info.js +1 -0
- package/lib/commands/install.js +1 -0
- package/lib/commands/list-platforms.js +1 -0
- package/lib/commands/migrate.js +1 -0
- package/lib/commands/platform-clean.js +1 -0
- package/lib/commands/plugin/add-plugin.js +1 -0
- package/lib/commands/plugin/build-plugin.js +1 -0
- package/lib/commands/plugin/create-plugin.js +5 -0
- package/lib/commands/plugin/list-plugins.js +1 -0
- package/lib/commands/plugin/remove-plugin.js +2 -0
- package/lib/commands/plugin/update-plugin.js +1 -0
- package/lib/commands/post-install.js +6 -0
- package/lib/commands/prepare.js +3 -2
- package/lib/commands/preview.js +2 -0
- package/lib/commands/remove-platform.js +1 -0
- package/lib/commands/resources/resources-update.js +2 -0
- package/lib/commands/run.js +1 -0
- package/lib/commands/setup.js +1 -0
- package/lib/commands/start.js +1 -0
- package/lib/commands/test-init.js +4 -0
- package/lib/commands/test.js +9 -2
- package/lib/commands/typings.js +1 -0
- package/lib/commands/update-platform.js +5 -0
- package/lib/commands/update.js +2 -0
- package/lib/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +3 -0
- package/lib/common/codeGeneration/code-entity.js +1 -0
- package/lib/common/codeGeneration/code-printer.js +1 -0
- package/lib/common/command-params.js +1 -0
- package/lib/common/commands/analytics.js +3 -0
- package/lib/common/commands/autocompletion.js +3 -0
- package/lib/common/commands/device/device-log-stream.js +1 -0
- package/lib/common/commands/device/get-file.js +2 -0
- package/lib/common/commands/device/list-applications.js +1 -0
- package/lib/common/commands/device/list-devices.js +3 -0
- package/lib/common/commands/device/list-files.js +2 -0
- package/lib/common/commands/device/put-file.js +2 -0
- package/lib/common/commands/device/run-application.js +1 -0
- package/lib/common/commands/device/stop-application.js +1 -0
- package/lib/common/commands/device/uninstall-application.js +1 -0
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +1 -0
- package/lib/common/commands/help.js +1 -0
- package/lib/common/commands/package-manager-get.js +1 -0
- package/lib/common/commands/package-manager-set.js +1 -0
- package/lib/common/commands/post-install.js +1 -0
- package/lib/common/commands/preuninstall.js +11 -2
- package/lib/common/commands/proxy/proxy-base.js +4 -0
- package/lib/common/commands/proxy/proxy-clear.js +1 -0
- package/lib/common/commands/proxy/proxy-get.js +1 -0
- package/lib/common/commands/proxy/proxy-set.js +1 -0
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/decorators.js +48 -0
- package/lib/common/definitions/mobile.d.ts +1 -1
- package/lib/common/dispatchers.js +10 -1
- package/lib/common/errors.js +13 -3
- package/lib/common/file-system.js +13 -2
- package/lib/common/header.js +3 -0
- package/lib/common/helpers.js +89 -3
- package/lib/common/host-info.js +4 -0
- package/lib/common/http-client.js +20 -0
- package/lib/common/logger/appenders/cli-appender.js +4 -0
- package/lib/common/logger/appenders/emit-appender.js +4 -0
- package/lib/common/logger/layouts/cli-layout.js +1 -0
- package/lib/common/logger/logger.js +5 -0
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +20 -1
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
- package/lib/common/mobile/android/android-debug-bridge.js +6 -0
- package/lib/common/mobile/android/android-device-file-system.js +4 -0
- package/lib/common/mobile/android/android-device-hash-service.js +3 -0
- package/lib/common/mobile/android/android-device.js +8 -0
- package/lib/common/mobile/android/android-emulator-services.js +2 -1
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +4 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
- package/lib/common/mobile/android/logcat-helper.js +20 -1
- package/lib/common/mobile/application-manager-base.js +6 -0
- package/lib/common/mobile/device-emitter.js +4 -0
- package/lib/common/mobile/device-log-emitter.js +1 -0
- package/lib/common/mobile/device-log-provider-base.js +1 -0
- package/lib/common/mobile/device-log-provider.js +23 -0
- package/lib/common/mobile/device-platforms-constants.js +1 -0
- package/lib/common/mobile/emulator-helper.js +3 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
- package/lib/common/mobile/ios/device/ios-device.js +4 -0
- package/lib/common/mobile/ios/ios-device-base.js +1 -0
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
- package/lib/common/mobile/ios/ios-log-filter.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
- package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
- package/lib/common/mobile/log-filter.js +2 -0
- package/lib/common/mobile/logging-levels.js +1 -0
- package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
- package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
- package/lib/common/mobile/mobile-core/devices-service.js +72 -3
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +3 -1
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-helper.js +2 -1
- package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
- package/lib/common/opener.js +1 -0
- package/lib/common/os-info.js +1 -0
- package/lib/common/plist-parser.js +1 -0
- package/lib/common/project-helper.js +1 -0
- package/lib/common/prompter.js +9 -1
- package/lib/common/queue.js +1 -0
- package/lib/common/resource-loader.js +1 -0
- package/lib/common/services/auto-completion-service.js +12 -1
- package/lib/common/services/cancellation.js +2 -1
- package/lib/common/services/commands-service.js +17 -6
- package/lib/common/services/help-service.js +11 -3
- package/lib/common/services/hooks-service.js +13 -0
- package/lib/common/services/ios-notification-service.js +1 -0
- package/lib/common/services/json-file-settings-service.js +6 -0
- package/lib/common/services/lock-service.js +6 -0
- package/lib/common/services/message-contract-generator.js +1 -0
- package/lib/common/services/messages-service.js +1 -0
- package/lib/common/services/micro-templating-service.js +6 -0
- package/lib/common/services/net-service.js +3 -0
- package/lib/common/services/project-files-manager.js +5 -0
- package/lib/common/services/project-files-provider-base.js +1 -0
- package/lib/common/services/proxy-service.js +1 -0
- package/lib/common/services/qr.js +1 -0
- package/lib/common/services/settings-service.js +1 -0
- package/lib/common/services/xcode-select-service.js +1 -0
- package/lib/common/utils.js +1 -0
- package/lib/common/validators/project-name-validator.js +1 -0
- package/lib/common/validators/validation-result.js +1 -0
- package/lib/common/verify-node-version.js +8 -1
- package/lib/common/yok.js +32 -11
- package/lib/config.js +22 -1
- package/lib/constants-provider.js +1 -0
- package/lib/constants.js +58 -5
- package/lib/controllers/build-controller.js +4 -3
- package/lib/controllers/debug-controller.js +8 -3
- package/lib/controllers/deploy-controller.js +1 -0
- package/lib/controllers/migrate-controller.js +91 -3
- package/lib/controllers/platform-controller.js +9 -1
- package/lib/controllers/prepare-controller.js +15 -5
- package/lib/controllers/run-controller.js +17 -1
- package/lib/controllers/update-controller-base.js +1 -0
- package/lib/controllers/update-controller.js +11 -0
- package/lib/data/build-data.js +1 -0
- package/lib/data/controller-data-base.js +1 -0
- package/lib/data/debug-data.js +1 -0
- package/lib/data/platform-data.js +1 -0
- package/lib/data/prepare-data.js +1 -0
- package/lib/data/run-data.js +1 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
- package/lib/detached-processes/cleanup-process.js +18 -14
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +3 -2
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
- package/lib/device-sockets/ios/notification.js +3 -0
- package/lib/device-sockets/ios/socket-request-executor.js +3 -0
- package/lib/helpers/android-bundle-validator-helper.js +2 -1
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/helpers/key-command-helper.js +4 -2
- package/lib/helpers/livesync-command-helper.js +5 -2
- package/lib/helpers/network-connectivity-validator.js +1 -0
- package/lib/helpers/options-track-helper.js +3 -2
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +7 -2
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +5 -4
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +10 -1
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +11 -1
- package/lib/options.js +141 -115
- package/lib/package-installation-manager.js +8 -1
- package/lib/package-manager.js +2 -0
- package/lib/platform-command-param.js +1 -0
- package/lib/pnpm-package-manager.js +4 -1
- package/lib/project-data.js +12 -0
- package/lib/providers/project-files-provider.js +1 -0
- package/lib/resolvers/livesync-service-resolver.js +2 -1
- package/lib/services/analytics/analytics-broker-process.js +10 -6
- package/lib/services/analytics/analytics-broker.js +2 -1
- package/lib/services/analytics/analytics-service.js +29 -25
- package/lib/services/analytics/google-analytics-provider.js +13 -12
- package/lib/services/analytics-settings-service.js +5 -0
- package/lib/services/android/android-bundle-tool-service.js +1 -0
- package/lib/services/android/gradle-build-args-service.js +3 -0
- package/lib/services/android/gradle-build-service.js +1 -0
- package/lib/services/android/gradle-command-service.js +1 -0
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +28 -0
- package/lib/services/android-project-service.js +71 -4
- package/lib/services/android-resources-migration-service.js +7 -0
- package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
- package/lib/services/assets-generation/assets-generation-service.js +16 -5
- package/lib/services/build-artifacts-service.js +2 -1
- package/lib/services/build-data-service.js +2 -1
- package/lib/services/build-info-file-service.js +1 -0
- package/lib/services/cleanup-service.js +13 -9
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +21 -1
- package/lib/services/debug-data-service.js +1 -0
- package/lib/services/debug-service-base.js +7 -0
- package/lib/services/device/device-install-app-service.js +2 -1
- package/lib/services/doctor-service.js +21 -6
- package/lib/services/extensibility-service.js +8 -0
- package/lib/services/files-hash-service.js +1 -0
- package/lib/services/hmr-status-service.js +2 -0
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +5 -1
- package/lib/services/ios/export-options-plist-service.js +4 -0
- package/lib/services/ios/ios-signing-service.js +4 -0
- package/lib/services/ios/spm-service.js +10 -1
- package/lib/services/ios/xcodebuild-args-service.js +13 -4
- package/lib/services/ios/xcodebuild-command-service.js +1 -0
- package/lib/services/ios/xcodebuild-service.js +1 -0
- package/lib/services/ios-debugger-port-service.js +1 -0
- package/lib/services/ios-device-debug-service.js +1 -0
- package/lib/services/ios-entitlements-service.js +1 -0
- package/lib/services/ios-extensions-service.js +1 -0
- package/lib/services/ios-log-filter.js +20 -0
- package/lib/services/ios-native-target-service.js +6 -4
- package/lib/services/ios-project-service.js +29 -7
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +47 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +18 -2
- package/lib/services/prepare-data-service.js +2 -1
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +12 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +18 -1
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +1 -0
- package/lib/services/terminal-spinner-service.js +2 -0
- package/lib/services/test-execution-service.js +9 -2
- package/lib/services/test-initialization-service.js +4 -0
- package/lib/services/timeline-profiler-service.js +1 -0
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +6 -4
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/webpack/webpack-compiler-service.js +42 -1
- package/lib/services/xcconfig-service.js +2 -0
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +2 -1
- package/lib/tools/config-manipulation/config-transformer.js +12 -0
- package/lib/tools/node-modules/node-modules-builder.js +1 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +1 -0
- package/lib/yarn2-package-manager.js +3 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +1 -1
|
@@ -27,7 +27,40 @@ const constants_1 = require("../common/constants");
|
|
|
27
27
|
const helpers_1 = require("../common/helpers");
|
|
28
28
|
const decorators_1 = require(".././common/decorators");
|
|
29
29
|
const yok_1 = require("../common/yok");
|
|
30
|
-
|
|
30
|
+
//
|
|
31
|
+
// we sort the native dependencies topologically to make sure they are processed in the right order
|
|
32
|
+
// native dependenciess need to be sorted so the deepst dependencies are built before it's parents
|
|
33
|
+
//
|
|
34
|
+
// for example, given this dep structure (assuming these are all native dependencies that need to be built)
|
|
35
|
+
// (note: we list all dependencies at the root level, so the leaf nodes are essentially references to the root nodes)
|
|
36
|
+
//
|
|
37
|
+
// |- dep1
|
|
38
|
+
// |- dep2
|
|
39
|
+
// |- |- dep3
|
|
40
|
+
// |- |- dep4
|
|
41
|
+
// |- |- |- dep5
|
|
42
|
+
// |- dep3
|
|
43
|
+
// |- dep4
|
|
44
|
+
// |- |- dep5
|
|
45
|
+
// |- dep5
|
|
46
|
+
//
|
|
47
|
+
// It is sorted:
|
|
48
|
+
//
|
|
49
|
+
// |- dep1
|
|
50
|
+
// |- dep3
|
|
51
|
+
// |- dep5
|
|
52
|
+
// |- dep4 # depends on dep5, so dep5 must be built first, ie above ^
|
|
53
|
+
// |- |- dep5
|
|
54
|
+
// |- dep2 # depends on dep3, dep4 (and dep5 through dep4) so all of them must be built first before dep2 is built
|
|
55
|
+
// |- |- dep3
|
|
56
|
+
// |- |- dep4
|
|
57
|
+
// |- |- |- dep5
|
|
58
|
+
//
|
|
59
|
+
// for more details see: https://wikiless.org/wiki/Topological_sorting?lang=en
|
|
60
|
+
//
|
|
61
|
+
function topologicalSortNativeDependencies(dependencies, start = [], depth = 0, total = 0 // do not pass in, we calculate it in the initial run!
|
|
62
|
+
) {
|
|
63
|
+
// we set the total on the initial call - and never increment it, as it's used for esacaping the recursion
|
|
31
64
|
if (total === 0) {
|
|
32
65
|
total = dependencies.length;
|
|
33
66
|
}
|
|
@@ -41,6 +74,8 @@ function topologicalSortNativeDependencies(dependencies, start = [], depth = 0,
|
|
|
41
74
|
return sortedDeps;
|
|
42
75
|
}, start);
|
|
43
76
|
const remainingDeps = dependencies.filter((nativeDep) => !sortedDeps.includes(nativeDep));
|
|
77
|
+
// recurse if we still have remaining deps
|
|
78
|
+
// the second condition here prevents infinite recursion
|
|
44
79
|
if (remainingDeps.length && sortedDeps.length < total) {
|
|
45
80
|
return topologicalSortNativeDependencies(remainingDeps, sortedDeps, depth + 1, total);
|
|
46
81
|
}
|
|
@@ -92,7 +127,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
92
127
|
constants.APK_DIR,
|
|
93
128
|
];
|
|
94
129
|
const packageName = this.getProjectNameFromId(projectData);
|
|
95
|
-
const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, "android");
|
|
130
|
+
const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, "android" /* constants.PlatformTypes.android */);
|
|
96
131
|
this._platformData = {
|
|
97
132
|
frameworkPackageName: runtimePackage.name,
|
|
98
133
|
normalizedPlatformName: "Android",
|
|
@@ -133,7 +168,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
133
168
|
configurationFileName: constants.MANIFEST_FILE_NAME,
|
|
134
169
|
configurationFilePath: path.join(...configurationsDirectoryArr),
|
|
135
170
|
relativeToFrameworkConfigurationFilePath: path.join(constants.SRC_DIR, constants.MAIN_DIR, constants.MANIFEST_FILE_NAME),
|
|
136
|
-
fastLivesyncFileExtensions: [".jpg", ".gif", ".png", ".bmp", ".webp"],
|
|
171
|
+
fastLivesyncFileExtensions: [".jpg", ".gif", ".png", ".bmp", ".webp"], // http://developer.android.com/guide/appendix/media-formats.html
|
|
137
172
|
};
|
|
138
173
|
}
|
|
139
174
|
return this._platformData;
|
|
@@ -188,6 +223,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
188
223
|
const targetSdkVersion = androidToolsInfo && androidToolsInfo.targetSdkVersion;
|
|
189
224
|
this.$logger.trace(`Using Android SDK '${targetSdkVersion}'.`);
|
|
190
225
|
this.copy(this.getPlatformData(projectData).projectRoot, frameworkDir, "*", "-R");
|
|
226
|
+
// TODO: Check if we actually need this and if it should be targetSdk or compileSdk
|
|
191
227
|
this.cleanResValues(targetSdkVersion, projectData);
|
|
192
228
|
});
|
|
193
229
|
}
|
|
@@ -221,6 +257,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
221
257
|
}
|
|
222
258
|
interpolateData(projectData) {
|
|
223
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
// Interpolate the apilevel and package
|
|
224
261
|
this.interpolateConfigurationFile(projectData);
|
|
225
262
|
const appResourcesDirectoryPath = projectData.getAppResourcesDirectoryPath();
|
|
226
263
|
let stringsFilePath;
|
|
@@ -236,8 +273,10 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
236
273
|
const gradleSettingsFilePath = path.join(this.getPlatformData(projectData).projectRoot, "settings.gradle");
|
|
237
274
|
shell.sed("-i", /__PROJECT_NAME__/, this.getProjectNameFromId(projectData), gradleSettingsFilePath);
|
|
238
275
|
try {
|
|
276
|
+
// will replace applicationId in app/App_Resources/Android/app.gradle if it has not been edited by the user
|
|
239
277
|
const appGradleContent = this.$fs.readText(projectData.appGradlePath);
|
|
240
278
|
if (appGradleContent.indexOf(constants.PACKAGE_PLACEHOLDER_NAME) !== -1) {
|
|
279
|
+
//TODO: For compatibility with old templates. Once all templates are updated should delete.
|
|
241
280
|
shell.sed("-i", new RegExp(constants.PACKAGE_PLACEHOLDER_NAME), projectData.projectIdentifiers.android, projectData.appGradlePath);
|
|
242
281
|
}
|
|
243
282
|
}
|
|
@@ -297,6 +336,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
297
336
|
}
|
|
298
337
|
prepareProject() {
|
|
299
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
// Intentionally left empty.
|
|
300
340
|
});
|
|
301
341
|
}
|
|
302
342
|
ensureConfigurationFileInAppResources(projectData) {
|
|
@@ -314,6 +354,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
314
354
|
this.$logger.warn("No manifest found in " + originalAndroidManifestFilePath);
|
|
315
355
|
return;
|
|
316
356
|
}
|
|
357
|
+
// Overwrite the AndroidManifest from runtime.
|
|
317
358
|
if (!appResourcesDirStructureHasMigrated) {
|
|
318
359
|
this.$fs.copyFile(originalAndroidManifestFilePath, this.getPlatformData(projectData).configurationFilePath);
|
|
319
360
|
}
|
|
@@ -330,6 +371,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
330
371
|
}
|
|
331
372
|
else {
|
|
332
373
|
this.$fs.copyFile(path.join(projectAppResourcesPath, platformData.normalizedPlatformName, "*"), platformsAppResourcesPath);
|
|
374
|
+
// https://github.com/NativeScript/android-runtime/issues/899
|
|
375
|
+
// App_Resources/Android/libs is reserved to user's aars and jars, but they should not be copied as resources
|
|
333
376
|
this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "libs"));
|
|
334
377
|
}
|
|
335
378
|
const androidToolsInfo = this.$androidToolsInfo.getToolsInfo({
|
|
@@ -340,6 +383,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
340
383
|
}
|
|
341
384
|
preparePluginNativeCode(pluginData, projectData) {
|
|
342
385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
+
// build Android plugins which contain AndroidManifest.xml and/or resources
|
|
343
387
|
const pluginPlatformsFolderPath = this.getPluginPlatformsFolderPath(pluginData, AndroidProjectService.ANDROID_PLATFORM_NAME);
|
|
344
388
|
if (this.$fs.exists(pluginPlatformsFolderPath)) {
|
|
345
389
|
const options = {
|
|
@@ -365,6 +409,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
365
409
|
}
|
|
366
410
|
removePluginNativeCode(pluginData, projectData) {
|
|
367
411
|
return __awaiter(this, void 0, void 0, function* () {
|
|
412
|
+
// not implemented
|
|
368
413
|
});
|
|
369
414
|
}
|
|
370
415
|
beforePrepareAllPlugins(projectData, dependencies) {
|
|
@@ -383,6 +428,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
383
428
|
filterUniqueDependencies(dependencies) {
|
|
384
429
|
const depsDictionary = dependencies.reduce((dict, dep) => {
|
|
385
430
|
const collision = dict[dep.name];
|
|
431
|
+
// in case there are multiple dependencies to the same module, the one declared in the package.json takes precedence
|
|
386
432
|
if (!collision || collision.depth > dep.depth) {
|
|
387
433
|
dict[dep.name] = dep;
|
|
388
434
|
}
|
|
@@ -399,6 +445,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
399
445
|
name,
|
|
400
446
|
directory: path.relative(platformDir, directory),
|
|
401
447
|
dependencies: dependencies.filter((dep) => {
|
|
448
|
+
// filter out transient dependencies that don't have native dependencies
|
|
402
449
|
return (nativeDependencyData.findIndex((nativeDep) => nativeDep.name === dep) !== -1);
|
|
403
450
|
}),
|
|
404
451
|
};
|
|
@@ -406,6 +453,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
406
453
|
nativeDependencies = topologicalSortNativeDependencies(nativeDependencies);
|
|
407
454
|
const jsonContent = JSON.stringify(nativeDependencies, null, 4);
|
|
408
455
|
this.$fs.writeFile(dependenciesJsonPath, jsonContent);
|
|
456
|
+
// we sort all the dependencies to respect the topological sorting of the native dependencies
|
|
409
457
|
return dependencies.sort(function (a, b) {
|
|
410
458
|
return (nativeDependencies.findIndex((n) => n.name === a.name) -
|
|
411
459
|
nativeDependencies.findIndex((n) => n.name === b.name));
|
|
@@ -444,6 +492,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
444
492
|
}
|
|
445
493
|
checkForChanges() {
|
|
446
494
|
return __awaiter(this, void 0, void 0, function* () {
|
|
495
|
+
// Nothing android specific to check yet.
|
|
447
496
|
});
|
|
448
497
|
}
|
|
449
498
|
getDeploymentTarget(projectData) {
|
|
@@ -454,9 +503,12 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
454
503
|
shell.cp(cpArg, paths, projectRoot);
|
|
455
504
|
}
|
|
456
505
|
validatePackageName(packageName) {
|
|
506
|
+
//Make the package conform to Java package types
|
|
507
|
+
//Enforce underscore limitation
|
|
457
508
|
if (!/^[a-zA-Z]+(\.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(packageName)) {
|
|
458
509
|
this.$errors.fail(`Package name must look like: com.company.Name. Got: ${packageName}`);
|
|
459
510
|
}
|
|
511
|
+
//Class is a reserved word
|
|
460
512
|
if (/\b[Cc]lass\b/.test(packageName)) {
|
|
461
513
|
this.$errors.fail("class is a reserved word");
|
|
462
514
|
}
|
|
@@ -465,6 +517,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
465
517
|
if (projectName === "") {
|
|
466
518
|
this.$errors.fail("Project name cannot be empty");
|
|
467
519
|
}
|
|
520
|
+
//Classes in Java don't begin with numbers
|
|
468
521
|
if (/^[0-9]/.test(projectName)) {
|
|
469
522
|
this.$errors.fail("Project name must not begin with a number");
|
|
470
523
|
}
|
|
@@ -485,6 +538,19 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
485
538
|
];
|
|
486
539
|
return path.join(this.getPlatformData(projectData).projectRoot, ...resourcePath);
|
|
487
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* The purpose of this method is to delete the previously prepared user resources.
|
|
543
|
+
* The content of the `<platforms>/android/.../res` directory is based on user's resources and gradle project template from android-runtime.
|
|
544
|
+
* During preparation of the `<path to user's App_Resources>/Android` we want to clean all the users files from previous preparation,
|
|
545
|
+
* but keep the ones that were introduced during `platform add` of the android-runtime.
|
|
546
|
+
* Currently the Gradle project template contains resources only in values and values-v21 directories.
|
|
547
|
+
* So the current logic of the method is cleaning al resources from `<platforms>/android/.../res` that are not in `values.*` directories
|
|
548
|
+
* and that exist in the `<path to user's App_Resources>/Android/.../res` directory
|
|
549
|
+
* This means that if user has a resource file in values-v29 for example, builds the project and then deletes this resource,
|
|
550
|
+
* it will be kept in platforms directory. Reference issue: `https://github.com/NativeScript/nativescript-cli/issues/5083`
|
|
551
|
+
* Same is valid for files in `drawable-<resolution>` directories - in case in user's resources there's drawable-hdpi directory,
|
|
552
|
+
* which is deleted after the first build of app, it will remain in platforms directory.
|
|
553
|
+
*/
|
|
488
554
|
cleanUpPreparedResources(projectData) {
|
|
489
555
|
let resourcesDirPath = path.join(projectData.appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName);
|
|
490
556
|
if (this.$androidResourcesMigrationService.hasMigrated(projectData.appResourcesDirectoryPath)) {
|
|
@@ -510,7 +576,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
|
|
|
510
576
|
const hasUseKotlinPropertyInAppData = `hasUseKotlinPropertyInApp${analyticsDelimiter}${buildStatistics.kotlinUsage.hasUseKotlinPropertyInApp}`;
|
|
511
577
|
const hasKotlinRuntimeClassesData = `hasKotlinRuntimeClasses${analyticsDelimiter}${buildStatistics.kotlinUsage.hasKotlinRuntimeClasses}`;
|
|
512
578
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
513
|
-
action: "Using Kotlin"
|
|
579
|
+
action: "Using Kotlin" /* constants.TrackActionNames.UsingKotlin */,
|
|
514
580
|
additionalData: `${hasUseKotlinPropertyInAppData}${analyticsDelimiter}${hasKotlinRuntimeClassesData}`,
|
|
515
581
|
});
|
|
516
582
|
}
|
|
@@ -544,3 +610,4 @@ __decorate([
|
|
|
544
610
|
], AndroidProjectService.prototype, "buildProject", null);
|
|
545
611
|
exports.AndroidProjectService = AndroidProjectService;
|
|
546
612
|
yok_1.injector.register("androidProjectService", AndroidProjectService);
|
|
613
|
+
//# sourceMappingURL=android-project-service.js.map
|
|
@@ -58,6 +58,7 @@ class AndroidResourcesMigrationService {
|
|
|
58
58
|
const appResourcesMainSourceSetResourcesDestination = path.join(appMainSourceSet, constants.RESOURCES_DIR);
|
|
59
59
|
this.$fs.ensureDirectoryExists(appResourcesDestination);
|
|
60
60
|
this.$fs.ensureDirectoryExists(appMainSourceSet);
|
|
61
|
+
// create /java, /res and /assets in the App_Resources/Android/src/main directory
|
|
61
62
|
this.$fs.ensureDirectoryExists(appResourcesMainSourceSetResourcesDestination);
|
|
62
63
|
this.$fs.ensureDirectoryExists(path.join(appMainSourceSet, "java"));
|
|
63
64
|
this.$fs.ensureDirectoryExists(path.join(appMainSourceSet, constants.ASSETS_DIR));
|
|
@@ -71,20 +72,25 @@ class AndroidResourcesMigrationService {
|
|
|
71
72
|
const resourceFiles = getFiles(appResourcesFiles);
|
|
72
73
|
resourceDirectories.forEach((dir) => {
|
|
73
74
|
if (path.basename(dir) !== "libs") {
|
|
75
|
+
// don't copy /App_Resources/Android/libs into the src/main/res/libs directory
|
|
74
76
|
this.$fs.copyFile(dir, appResourcesMainSourceSetResourcesDestination);
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
79
|
+
// copy App_Resources/Android/libs to App_ResourcesNew/Android/libs
|
|
77
80
|
this.$fs.copyFile(dir, path.join(appResourcesDestination));
|
|
78
81
|
}
|
|
79
82
|
});
|
|
80
83
|
resourceFiles.forEach((file) => {
|
|
81
84
|
const fileName = path.basename(file);
|
|
82
85
|
if (fileName !== constants.MANIFEST_FILE_NAME) {
|
|
86
|
+
// don't copy AndroidManifest into /App_Resources/Android as it needs to be inside src/main/
|
|
83
87
|
this.$fs.copyFile(file, path.join(appResourcesDestination, fileName));
|
|
84
88
|
}
|
|
85
89
|
});
|
|
86
90
|
this.$fs.copyFile(path.join(originalAppResources, constants.MANIFEST_FILE_NAME), path.join(appMainSourceSet, constants.MANIFEST_FILE_NAME));
|
|
91
|
+
// rename the legacy app_resources to ANDROID_DIR_OLD
|
|
87
92
|
this.$fs.rename(originalAppResources, appResourcesBackup);
|
|
93
|
+
// move the new, updated app_resources to App_Resources/Android, as the de facto resources
|
|
88
94
|
this.$fs.rename(appResourcesDestination, originalAppResources);
|
|
89
95
|
});
|
|
90
96
|
}
|
|
@@ -102,3 +108,4 @@ AndroidResourcesMigrationService.ANDROID_DIR_TEMP = "Android-Updated";
|
|
|
102
108
|
AndroidResourcesMigrationService.ANDROID_DIR_OLD = "Android-Pre-v4";
|
|
103
109
|
exports.AndroidResourcesMigrationService = AndroidResourcesMigrationService;
|
|
104
110
|
yok_1.injector.register("androidResourcesMigrationService", AndroidResourcesMigrationService);
|
|
111
|
+
//# sourceMappingURL=android-resources-migration-service.js.map
|
|
@@ -80,3 +80,4 @@ class ApplePortalApplicationService {
|
|
|
80
80
|
}
|
|
81
81
|
exports.ApplePortalApplicationService = ApplePortalApplicationService;
|
|
82
82
|
yok_1.injector.register("applePortalApplicationService", ApplePortalApplicationService);
|
|
83
|
+
//# sourceMappingURL=apple-portal-application-service.js.map
|
|
@@ -190,10 +190,10 @@ For more details how to set up your environment, please execute "ns publish ios
|
|
|
190
190
|
const data = JSON.parse(authResponse.body);
|
|
191
191
|
const isSMS = data.trustedPhoneNumbers &&
|
|
192
192
|
data.trustedPhoneNumbers.length === 1 &&
|
|
193
|
-
data.noTrustedDevices;
|
|
193
|
+
data.noTrustedDevices; // 1 device and no trusted devices means sms was automatically sent.
|
|
194
194
|
const multiSMS = data.trustedPhoneNumbers &&
|
|
195
195
|
data.trustedPhoneNumbers.length !== 1 &&
|
|
196
|
-
data.noTrustedDevices;
|
|
196
|
+
data.noTrustedDevices; // Not handling more than 1 sms device and no trusted devices.
|
|
197
197
|
let token;
|
|
198
198
|
if (data.trustedPhoneNumbers &&
|
|
199
199
|
data.trustedPhoneNumbers.length &&
|
|
@@ -207,6 +207,7 @@ For more details how to set up your environment, please execute "ns publish ios
|
|
|
207
207
|
};
|
|
208
208
|
let url = `https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode`;
|
|
209
209
|
if (isSMS) {
|
|
210
|
+
// No trusted devices means it must be sms.
|
|
210
211
|
body.mode = "sms";
|
|
211
212
|
body.phoneNumber = {
|
|
212
213
|
id: data.trustedPhoneNumbers[0].id,
|
|
@@ -270,8 +271,9 @@ function checkBits(bits, digest) {
|
|
|
270
271
|
return result;
|
|
271
272
|
}
|
|
272
273
|
function checkBit(position, buffer) {
|
|
273
|
-
const bitOffset = position & 7;
|
|
274
|
-
const byteIndex = position >> 3;
|
|
274
|
+
const bitOffset = position & 7; // in byte
|
|
275
|
+
const byteIndex = position >> 3; // in buffer
|
|
275
276
|
const bit = (buffer[byteIndex] >> bitOffset) & 1;
|
|
276
277
|
return bit === 0;
|
|
277
278
|
}
|
|
279
|
+
//# sourceMappingURL=apple-portal-session-service.js.map
|
|
@@ -92,7 +92,7 @@ class AssetsGenerationService {
|
|
|
92
92
|
}
|
|
93
93
|
continue;
|
|
94
94
|
}
|
|
95
|
-
const operation = assetItem.resizeOperation || "resize"
|
|
95
|
+
const operation = assetItem.resizeOperation || "resize" /* Operations.Resize */;
|
|
96
96
|
let tempScale = null;
|
|
97
97
|
if (assetItem.scale) {
|
|
98
98
|
if (_.isNumber(assetItem.scale)) {
|
|
@@ -117,27 +117,36 @@ class AssetsGenerationService {
|
|
|
117
117
|
}
|
|
118
118
|
let image;
|
|
119
119
|
switch (operation) {
|
|
120
|
-
case "overlayWith"
|
|
120
|
+
case "overlayWith" /* Operations.OverlayWith */:
|
|
121
121
|
const overlayImageScale = assetItem.overlayImageScale ||
|
|
122
122
|
constants_1.AssetConstants.defaultOverlayImageScale;
|
|
123
123
|
const imageResize = Math.round(Math.min(width, height) * overlayImageScale);
|
|
124
124
|
image = yield this.resize(generationData.imagePath, imageResize, imageResize);
|
|
125
125
|
image = this.generateImage(background, width, height, outputPath, image);
|
|
126
126
|
break;
|
|
127
|
-
case "blank"
|
|
127
|
+
case "blank" /* Operations.Blank */:
|
|
128
128
|
image = this.generateImage(background, width, height, outputPath);
|
|
129
129
|
break;
|
|
130
|
-
case "resize"
|
|
130
|
+
case "resize" /* Operations.Resize */:
|
|
131
131
|
image = yield this.resize(generationData.imagePath, width, height);
|
|
132
132
|
break;
|
|
133
|
-
case "outerScale"
|
|
133
|
+
case "outerScale" /* Operations.OuterScale */:
|
|
134
|
+
// Resize image without applying scale
|
|
134
135
|
image = yield this.resize(generationData.imagePath, assetItem.width, assetItem.height);
|
|
136
|
+
// The scale will apply to the underlying layer of the generated image
|
|
135
137
|
image = this.generateImage("#00000000", width, height, outputPath, image);
|
|
136
138
|
break;
|
|
137
139
|
default:
|
|
138
140
|
throw new Error(`Invalid image generation operation: ${operation}`);
|
|
139
141
|
}
|
|
142
|
+
// This code disables the alpha chanel, as some images for the Apple App Store must not have transparency.
|
|
140
143
|
if (assetItem.rgba === false) {
|
|
144
|
+
//
|
|
145
|
+
// The original code here became broken at some time and there is an issue posted here..
|
|
146
|
+
// https://github.com/oliver-moran/jimp/issues/954
|
|
147
|
+
// But NathanaelA recommended the below change and it works so maybe that's just what we go with.
|
|
148
|
+
//
|
|
149
|
+
// image = image.rgba(false);
|
|
141
150
|
image = image.colorType(2);
|
|
142
151
|
}
|
|
143
152
|
image.write(outputPath);
|
|
@@ -151,6 +160,7 @@ class AssetsGenerationService {
|
|
|
151
160
|
});
|
|
152
161
|
}
|
|
153
162
|
generateImage(background, width, height, outputPath, overlayImage) {
|
|
163
|
+
// Typescript declarations for Jimp are not updated to define the constructor with backgroundColor so we workaround it by casting it to <any> for this case only.
|
|
154
164
|
const J = Jimp;
|
|
155
165
|
const backgroundColor = this.getRgbaNumber(background);
|
|
156
166
|
let image = new J(width, height, backgroundColor);
|
|
@@ -176,3 +186,4 @@ __decorate([
|
|
|
176
186
|
], AssetsGenerationService.prototype, "generateSplashScreens", null);
|
|
177
187
|
exports.AssetsGenerationService = AssetsGenerationService;
|
|
178
188
|
yok_1.injector.register("assetsGenerationService", AssetsGenerationService);
|
|
189
|
+
//# sourceMappingURL=assets-generation-service.js.map
|
|
@@ -75,7 +75,7 @@ class BuildArtifactsService {
|
|
|
75
75
|
if (packages.length > 1) {
|
|
76
76
|
this.$logger.warn(`More than one ${packageExtName} found in ${buildOutputPath} directory. Using the last one produced from build.`);
|
|
77
77
|
}
|
|
78
|
-
packages = _.sortBy(packages, (pkg) => pkg.time).reverse();
|
|
78
|
+
packages = _.sortBy(packages, (pkg) => pkg.time).reverse(); // We need to reverse because sortBy always sorts in ascending order
|
|
79
79
|
return packages[0];
|
|
80
80
|
}
|
|
81
81
|
getApplicationPackagesCore(candidates, validPackageNames) {
|
|
@@ -96,3 +96,4 @@ class BuildArtifactsService {
|
|
|
96
96
|
}
|
|
97
97
|
exports.BuildArtifactsService = BuildArtifactsService;
|
|
98
98
|
yok_1.injector.register("buildArtifactsService", BuildArtifactsService);
|
|
99
|
+
//# sourceMappingURL=build-artifacts-service.js.map
|
|
@@ -8,7 +8,7 @@ class BuildDataService {
|
|
|
8
8
|
this.$mobileHelper = $mobileHelper;
|
|
9
9
|
}
|
|
10
10
|
getBuildData(projectDir, platform, data) {
|
|
11
|
-
if (this.$mobileHelper.
|
|
11
|
+
if (this.$mobileHelper.isApplePlatform(platform)) {
|
|
12
12
|
return new build_data_1.IOSBuildData(projectDir, platform, data);
|
|
13
13
|
}
|
|
14
14
|
else if (this.$mobileHelper.isAndroidPlatform(platform)) {
|
|
@@ -18,3 +18,4 @@ class BuildDataService {
|
|
|
18
18
|
}
|
|
19
19
|
exports.BuildDataService = BuildDataService;
|
|
20
20
|
yok_1.injector.register("buildDataService", BuildDataService);
|
|
21
|
+
//# sourceMappingURL=build-data-service.js.map
|
|
@@ -30,7 +30,7 @@ class CleanupService {
|
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
32
32
|
cleanupProcess.send({
|
|
33
|
-
messageType: "AddCleanCommand"
|
|
33
|
+
messageType: "AddCleanCommand" /* CleanupProcessMessage.AddCleanCommand */,
|
|
34
34
|
commandInfo,
|
|
35
35
|
});
|
|
36
36
|
});
|
|
@@ -39,7 +39,7 @@ class CleanupService {
|
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
41
41
|
cleanupProcess.send({
|
|
42
|
-
messageType: "RemoveCleanCommand"
|
|
42
|
+
messageType: "RemoveCleanCommand" /* CleanupProcessMessage.RemoveCleanCommand */,
|
|
43
43
|
commandInfo,
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -48,7 +48,7 @@ class CleanupService {
|
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
50
50
|
cleanupProcess.send({
|
|
51
|
-
messageType: "AddRequest"
|
|
51
|
+
messageType: "AddRequest" /* CleanupProcessMessage.AddRequest */,
|
|
52
52
|
requestInfo,
|
|
53
53
|
});
|
|
54
54
|
});
|
|
@@ -57,7 +57,7 @@ class CleanupService {
|
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
59
59
|
cleanupProcess.send({
|
|
60
|
-
messageType: "RemoveRequest"
|
|
60
|
+
messageType: "RemoveRequest" /* CleanupProcessMessage.RemoveRequest */,
|
|
61
61
|
requestInfo,
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -66,7 +66,7 @@ class CleanupService {
|
|
|
66
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
68
68
|
cleanupProcess.send({
|
|
69
|
-
messageType: "AddDeleteFileAction"
|
|
69
|
+
messageType: "AddDeleteFileAction" /* CleanupProcessMessage.AddDeleteFileAction */,
|
|
70
70
|
filePath,
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -75,7 +75,7 @@ class CleanupService {
|
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
77
77
|
cleanupProcess.send({
|
|
78
|
-
messageType: "RemoveDeleteFileAction"
|
|
78
|
+
messageType: "RemoveDeleteFileAction" /* CleanupProcessMessage.RemoveDeleteFileAction */,
|
|
79
79
|
filePath,
|
|
80
80
|
});
|
|
81
81
|
});
|
|
@@ -84,7 +84,7 @@ class CleanupService {
|
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
86
86
|
cleanupProcess.send({
|
|
87
|
-
messageType: "AddJSFileToRequire"
|
|
87
|
+
messageType: "AddJSFileToRequire" /* CleanupProcessMessage.AddJSFileToRequire */,
|
|
88
88
|
jsCommand,
|
|
89
89
|
});
|
|
90
90
|
});
|
|
@@ -93,7 +93,7 @@ class CleanupService {
|
|
|
93
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
94
|
const cleanupProcess = yield this.getCleanupProcess();
|
|
95
95
|
cleanupProcess.send({
|
|
96
|
-
messageType: "RemoveJSFileToRequire"
|
|
96
|
+
messageType: "RemoveJSFileToRequire" /* CleanupProcessMessage.RemoveJSFileToRequire */,
|
|
97
97
|
jsCommand,
|
|
98
98
|
});
|
|
99
99
|
});
|
|
@@ -121,6 +121,8 @@ class CleanupService {
|
|
|
121
121
|
setShouldDispose(shouldDispose) {
|
|
122
122
|
this.shouldDispose = shouldDispose;
|
|
123
123
|
}
|
|
124
|
+
// TODO: Consider extracting this method to a separate service
|
|
125
|
+
// as it has the same logic as the one used in analytics-service
|
|
124
126
|
getCleanupProcess() {
|
|
125
127
|
return new Promise((resolve, reject) => {
|
|
126
128
|
const cleanupProcessArgs = this.getCleanupProcessArgs();
|
|
@@ -139,11 +141,12 @@ class CleanupService {
|
|
|
139
141
|
clearTimeout(timeoutId);
|
|
140
142
|
if (!isSettled) {
|
|
141
143
|
isSettled = true;
|
|
144
|
+
// In case we throw error here, CLI will break its execution.
|
|
142
145
|
reject(err);
|
|
143
146
|
}
|
|
144
147
|
});
|
|
145
148
|
cleanupProcess.on("message", (data) => {
|
|
146
|
-
if (data === "ProcessReadyToReceive") {
|
|
149
|
+
if (data === "ProcessReadyToReceive" /* DetachedProcessMessages.ProcessReadyToReceive */) {
|
|
147
150
|
clearTimeout(timeoutId);
|
|
148
151
|
if (!isSettled) {
|
|
149
152
|
isSettled = true;
|
|
@@ -192,3 +195,4 @@ __decorate([
|
|
|
192
195
|
], CleanupService.prototype, "getCleanupProcess", null);
|
|
193
196
|
exports.CleanupService = CleanupService;
|
|
194
197
|
yok_1.injector.register("cleanupService", CleanupService);
|
|
198
|
+
//# sourceMappingURL=cleanup-service.js.map
|
|
@@ -82,6 +82,7 @@ class CocoaPodsPlatformManager {
|
|
|
82
82
|
_.each(allPodfiles, (podfileContent) => {
|
|
83
83
|
const platformMatch = platformRowRegExp.exec(podfileContent);
|
|
84
84
|
const podfilePathMatch = podfilePathRegExp.exec(podfileContent) || [];
|
|
85
|
+
// platform without version -> select it with highest priority
|
|
85
86
|
if (platformMatch && platformMatch[0] && !platformMatch[2]) {
|
|
86
87
|
selectedPlatformData = {
|
|
87
88
|
version: null,
|
|
@@ -90,6 +91,7 @@ class CocoaPodsPlatformManager {
|
|
|
90
91
|
};
|
|
91
92
|
return false;
|
|
92
93
|
}
|
|
94
|
+
// platform with version
|
|
93
95
|
if (platformMatch && platformMatch[0] && platformMatch[2]) {
|
|
94
96
|
if (!selectedPlatformData ||
|
|
95
97
|
semver.gt(semver.coerce(platformMatch[2]), semver.coerce(selectedPlatformData.version))) {
|
|
@@ -104,6 +106,12 @@ class CocoaPodsPlatformManager {
|
|
|
104
106
|
return selectedPlatformData;
|
|
105
107
|
}
|
|
106
108
|
shouldReplacePlatformSection(projectData, oldPodfilePlatformData, currentPodfilePlatformData) {
|
|
109
|
+
// The selected platform should be replaced in the following cases:
|
|
110
|
+
// 1. When the pod file is from App_Resources and the selected platform is not from App_Resources
|
|
111
|
+
// 2. When the pod file is from App_Resources, the selected platform is also from App_Resources
|
|
112
|
+
// and the pod's version is greater than the selected one
|
|
113
|
+
// 3. When the pod file doesn't have platform's version -> `platform :ios`
|
|
114
|
+
// 4. When the pod file has a version greater than the selected platform's version
|
|
107
115
|
const appResourcesPodfilePath = path.join(projectData.getAppResourcesDirectoryPath(), "iOS", constants_1.PODFILE_NAME);
|
|
108
116
|
const isFromAppResources = oldPodfilePlatformData.path !== appResourcesPodfilePath &&
|
|
109
117
|
currentPodfilePlatformData.path === appResourcesPodfilePath;
|
|
@@ -135,3 +143,4 @@ class CocoaPodsPlatformManager {
|
|
|
135
143
|
}
|
|
136
144
|
exports.CocoaPodsPlatformManager = CocoaPodsPlatformManager;
|
|
137
145
|
yok_1.injector.register("cocoaPodsPlatformManager", CocoaPodsPlatformManager);
|
|
146
|
+
//# sourceMappingURL=cocoapods-platform-manager.js.map
|
|
@@ -44,6 +44,12 @@ class CocoaPodsService {
|
|
|
44
44
|
let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod";
|
|
45
45
|
const args = ["install"];
|
|
46
46
|
if (process.platform === "darwin" && process.arch === "arm64") {
|
|
47
|
+
// check if pod is installed as an x86_64 binary or a native arm64 one
|
|
48
|
+
// we run the following:
|
|
49
|
+
// arch -x86_64 pod --version
|
|
50
|
+
// if it's an arm64 binary, we'll get something like this as a result:
|
|
51
|
+
// arch: posix_spawnp: pod: Bad CPU type in executable
|
|
52
|
+
// in which case, we should run it natively.
|
|
47
53
|
const res = yield this.$childProcess
|
|
48
54
|
.exec("arch -x86_64 pod --version", null, {
|
|
49
55
|
showStderr: true,
|
|
@@ -57,8 +63,11 @@ class CocoaPodsService {
|
|
|
57
63
|
podTool = "arch";
|
|
58
64
|
}
|
|
59
65
|
}
|
|
66
|
+
// cocoapods print a lot of non-error information on stderr. Pipe the `stderr` to `stdout`, so we won't polute CLI's stderr output.
|
|
60
67
|
const podInstallResult = yield this.$childProcess.spawnFromEvent(podTool, args, "close", { cwd: projectRoot, stdio: ["pipe", process.stdout, process.stdout] }, { throwError: false });
|
|
61
68
|
if (podInstallResult.exitCode !== 0) {
|
|
69
|
+
// https://github.com/CocoaPods/CocoaPods/blob/92aaf0f1120d32f3487960b485fb69fcaf61486c/lib/cocoapods/resolver.rb#L498
|
|
70
|
+
// TODO add article
|
|
62
71
|
const versionResolutionHint = podInstallResult.exitCode === 31
|
|
63
72
|
? `For more information on resolving CocoaPod issues in NativeScript read.`
|
|
64
73
|
: "";
|
|
@@ -96,6 +105,7 @@ ${versionResolutionHint}`);
|
|
|
96
105
|
applyPodfileArchExclusions(projectData, platformData) {
|
|
97
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
107
|
const xcodeVersionData = yield this.$xcodeSelectService.getXcodeVersion();
|
|
108
|
+
// only apply EXCLUDED_ARCHS workaround on XCode 12
|
|
99
109
|
if (+xcodeVersionData.major !== 12) {
|
|
100
110
|
return;
|
|
101
111
|
}
|
|
@@ -114,6 +124,7 @@ end`.trim();
|
|
|
114
124
|
this.$fs.writeFile(exclusionsPodfile, exclusions);
|
|
115
125
|
}
|
|
116
126
|
yield this.applyPodfileToProject("NativeScript-CLI-Architecture-Exclusions", exclusionsPodfile, projectData, platformData);
|
|
127
|
+
// clean up
|
|
117
128
|
this.$fs.deleteFile(exclusionsPodfile);
|
|
118
129
|
});
|
|
119
130
|
}
|
|
@@ -138,6 +149,7 @@ end`.trim();
|
|
|
138
149
|
podfilePath: path.join(extensionFolderPath, name, constants.PODFILE_NAME),
|
|
139
150
|
}));
|
|
140
151
|
extensionsPodfile.forEach(({ targetName, podfilePath }) => {
|
|
152
|
+
// Remove the data between #Begin Podfile and #EndPodfile
|
|
141
153
|
const regExpToRemove = new RegExp(`${this.getExtensionPodfileHeader(podfilePath, targetName)}[\\s\\S]*?${this.getExtensionPodfileEnd()}`, "mg");
|
|
142
154
|
projectPodFileContent = projectPodFileContent.replace(regExpToRemove, "");
|
|
143
155
|
if (this.$fs.exists(podfilePath)) {
|
|
@@ -166,6 +178,7 @@ end`.trim();
|
|
|
166
178
|
? this.$fs.readText(pathToProjectPodfile).trim()
|
|
167
179
|
: "";
|
|
168
180
|
if (projectPodfileContent.indexOf(podfileContent) === -1) {
|
|
181
|
+
// Remove old occurences of the plugin from the project's Podfile.
|
|
169
182
|
this.removePodfileFromProject(moduleName, podfilePath, projectData, nativeProjectPath);
|
|
170
183
|
let finalPodfileContent = this.$fs.exists(pathToProjectPodfile)
|
|
171
184
|
? this.getPodfileContentWithoutTarget(projectData, this.$fs.readText(pathToProjectPodfile))
|
|
@@ -184,6 +197,7 @@ end`.trim();
|
|
|
184
197
|
removePodfileFromProject(moduleName, podfilePath, projectData, projectRoot) {
|
|
185
198
|
if (this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
|
|
186
199
|
let projectPodFileContent = this.$fs.readText(this.getProjectPodfilePath(projectRoot));
|
|
200
|
+
// Remove the data between #Begin Podfile and #EndPodfile
|
|
187
201
|
const regExpToRemove = new RegExp(`${this.getPluginPodfileHeader(podfilePath)}[\\s\\S]*?${this.getPluginPodfileEnd()}`, "mg");
|
|
188
202
|
projectPodFileContent = projectPodFileContent.replace(regExpToRemove, "");
|
|
189
203
|
projectPodFileContent = this.removePostInstallHook(moduleName, projectPodFileContent);
|
|
@@ -204,7 +218,7 @@ end`.trim();
|
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
220
|
getPluginPodfilePath(pluginData) {
|
|
207
|
-
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath("ios");
|
|
221
|
+
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath("ios" /* PlatformTypes.ios */);
|
|
208
222
|
const pluginPodFilePath = path.join(pluginPlatformsFolderPath, constants_1.PODFILE_NAME);
|
|
209
223
|
return pluginPodFilePath;
|
|
210
224
|
}
|
|
@@ -240,6 +254,7 @@ end`.trim();
|
|
|
240
254
|
if (_.startsWith(projectPodfileContent, podFileHeader)) {
|
|
241
255
|
projectPodfileContent = projectPodfileContent.substr(podFileHeader.length);
|
|
242
256
|
const podFileFooter = this.getPodfileFooter();
|
|
257
|
+
// Only remove the final end in case the file starts with the podFileHeader
|
|
243
258
|
if (_.endsWith(projectPodfileContent, podFileFooter)) {
|
|
244
259
|
projectPodfileContent = projectPodfileContent.substr(0, projectPodfileContent.length - podFileFooter.length);
|
|
245
260
|
}
|
|
@@ -260,6 +275,8 @@ end`.trim();
|
|
|
260
275
|
return projectPodFileContent;
|
|
261
276
|
}
|
|
262
277
|
getHookBasicFuncNameForPlugin(hookName, pluginName) {
|
|
278
|
+
// nativescript-hook and nativescript_hook should have different names, so replace all _ with ___ first and then replace all special symbols with _
|
|
279
|
+
// This will lead to a clash in case plugins are called nativescript-hook and nativescript___hook
|
|
263
280
|
const replacedPluginName = pluginName
|
|
264
281
|
.replace(/_/g, "___")
|
|
265
282
|
.replace(/[^A-Za-z0-9_]/g, "_");
|
|
@@ -273,6 +290,7 @@ end`.trim();
|
|
|
273
290
|
const newFunctionName = `${this.getHookBasicFuncNameForPlugin(hookName, pluginName)}_${newFunctions.length}`;
|
|
274
291
|
let newDefinition = `def ${newFunctionName}`;
|
|
275
292
|
const rubyFunction = { functionName: newFunctionName };
|
|
293
|
+
// firstGroup is the block parameter, secondGroup is the block parameter name.
|
|
276
294
|
if (firstGroup && secondGroup) {
|
|
277
295
|
newDefinition = `${newDefinition} (${secondGroup})`;
|
|
278
296
|
rubyFunction.functionParameters = secondGroup;
|
|
@@ -283,6 +301,7 @@ end`.trim();
|
|
|
283
301
|
return { replacedContent, newFunctions };
|
|
284
302
|
}
|
|
285
303
|
getPluginPodfileHeader(pluginPodFilePath) {
|
|
304
|
+
// escape special + from the podfile path (pnpm)
|
|
286
305
|
pluginPodFilePath = pluginPodFilePath.replace(/\+/g, "\\+");
|
|
287
306
|
return `# Begin Podfile - ${pluginPodFilePath}`;
|
|
288
307
|
}
|
|
@@ -352,3 +371,4 @@ CocoaPodsService.PODFILE_POST_INSTALL_SECTION_NAME = "post_install";
|
|
|
352
371
|
CocoaPodsService.INSTALLER_BLOCK_PARAMETER_NAME = "installer";
|
|
353
372
|
exports.CocoaPodsService = CocoaPodsService;
|
|
354
373
|
yok_1.injector.register("cocoapodsService", CocoaPodsService);
|
|
374
|
+
//# sourceMappingURL=cocoapods-service.js.map
|