Skip to content

chore: merge 'release' into 'master' #4414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2cc3d0a
docs: fix help for `--copy-to` option
rosen-vladimirov Feb 15, 2019
7223754
Merge pull request #4367 from NativeScript/vladimirov/fix-copy-to-help
rosen-vladimirov Feb 15, 2019
f50f22d
feat: detect and report short imports used in application
rosen-vladimirov Feb 18, 2019
7e1f418
fix: remove duplicated platforms from project's podfile
Fatme Jan 30, 2019
d15a6da
chore: fix regexp
Fatme Feb 18, 2019
0472afb
chore: fix regexp when removing platforms section
rosen-vladimirov Feb 22, 2019
534b2db
Merge pull request #4332 from NativeScript/fatme/fix-multiple-platfor…
rosen-vladimirov Feb 22, 2019
c2f74d3
fix: validate test init before executing the test command
DimitarTachev Feb 22, 2019
0fabc39
Merge pull request #4372 from NativeScript/vladimirov/short-imports-warn
rosen-vladimirov Feb 22, 2019
49463eb
fix: process correctly podfiles without platform's version
Fatme Feb 23, 2019
60aba19
chore: add unit test for the broken case
Fatme Feb 24, 2019
4129031
fix: show warning when the platform's version in project's podfile wi…
Fatme Feb 24, 2019
408bf2f
Merge pull request #4386 from NativeScript/fatme/podfile-platfrom-war…
Feb 24, 2019
e11faaa
Merge pull request #4385 from NativeScript/fatme/fix-podfile-without-…
Feb 24, 2019
c5a8767
chore: fix pr comments
DimitarTachev Feb 25, 2019
90ba02c
Merge pull request #4381 from NativeScript/tachev/validate-test
Feb 25, 2019
7583fa9
fix: add new line at the end of the platform's section in order to re…
Fatme Feb 25, 2019
76b1580
Merge pull request #4395 from NativeScript/fatme/fix-pods-remove
Feb 26, 2019
9b5ac6a
chore: rewrite npm support tests
rosen-vladimirov Feb 25, 2019
fe8ffba
chore: rewrite create project tests
rosen-vladimirov Feb 25, 2019
a48af84
fix: ensure a single web client connected for debugging
DimitarTachev Feb 26, 2019
55c01b9
Merge pull request #4397 from NativeScript/vladimirov/improve-unit-tests
rosen-vladimirov Feb 26, 2019
926957a
Merge pull request #4396 from NativeScript/tachev/unify-debug-ios
Feb 26, 2019
a7fec56
fix: errors from `tns doctor` are not visible in CI environment
rosen-vladimirov Feb 27, 2019
49a12a2
fix: increase the debugger port timeout in order to support bigger apps
DimitarTachev Feb 27, 2019
f167357
Merge pull request #4404 from NativeScript/vladimirov/fix-CI-output
rosen-vladimirov Feb 27, 2019
97246f8
Merge pull request #4405 from NativeScript/tachev/fix-debug-timeout
Feb 27, 2019
ca2ab0a
fix: replace the lockfile package in order to depend on `modified`, i…
DimitarTachev Mar 1, 2019
12c4182
Merge pull request #4412 from NativeScript/tachev/fix-locks
Mar 1, 2019
f65b428
chore: update the yarn.lock
DimitarTachev Mar 1, 2019
d3e1fe2
Merge pull request #4413 from NativeScript/tachev/update-yarn-lock
Mar 1, 2019
68a2b7b
chore: merge 'release' into 'master'
DimitarTachev Mar 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ var travis = process.env["TRAVIS"];
var buildNumber = process.env["PACKAGE_VERSION"] || process.env["BUILD_NUMBER"] || "non-ci";

module.exports = function (grunt) {
var path = require("path");
var commonLibNodeModules = path.join("lib", "common", "node_modules");
if (require("fs").existsSync(commonLibNodeModules)) {
grunt.file.delete(commonLibNodeModules);
}
grunt.file.write(path.join("lib", "common", ".d.ts"), "");

grunt.initConfig({
copyPackageTo: process.env["CopyPackageTo"] || ".",

Expand Down Expand Up @@ -229,7 +222,7 @@ module.exports = function (grunt) {
if (travis && process.env.TRAVIS_PULL_REQUEST_BRANCH) {
return grunt.task.run("pack");
}

// Set correct version in Travis job, so the deploy will not publish strict version (for example 5.2.0).
grunt.task.run("set_package_version");
console.log(`Skipping pack step as the current build is not from PR, so it will be packed from the deploy provider.`);
Expand Down
2 changes: 1 addition & 1 deletion docs/man_pages/project/testing/build-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ General | `$ tns build android [--compileSdk <API Level>] [--key-store-path <Fil
* `--key-store-password` - Provides the password for the keystore file specified with `--key-store-path`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options.
* `--key-store-alias` - Provides the alias for the keystore file specified with `--key-store-path`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options.
* `--key-store-alias-password` - Provides the password for the alias specified with `--key-store-alias-password`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options.
* `--copy-to` - Specifies the file path where the built `.apk` will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
* `--copy-to` - Specifies the file path where the built `.apk` will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used.
* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application.
* `--env.*` - Specifies additional flags that the bundler may process. May be passed multiple times. For example: `--env.uglify --env.snapshot`.
* `--aab` - Specifies that the build will produce an Android App Bundle(`.aab`) file.
Expand Down
2 changes: 1 addition & 1 deletion docs/man_pages/project/testing/build-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ General | `$ tns build ios [--for-device] [--release] [--copy-to <File Path>] [-

* `--release` - If set, produces a release build. Otherwise, produces a debug build.
* `--for-device` - If set, produces an application package that you can deploy on device. Otherwise, produces a build that you can run only in the native iOS Simulator.
* `--copy-to` - Specifies the file path where the built `.ipa` will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
* `--copy-to` - Specifies the file path where the built `.ipa` will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used.
* `--team-id` - If used without parameter, lists all team names and ids. If used with team name or id, it will switch to automatic signing mode and configure the .xcodeproj file of your app. In this case .xcconfig should not contain any provisioning/team id flags. This team id will be further used for codesigning the app. For Xcode 9.0+, xcodebuild will be allowed to update and modify automatically managed provisioning profiles.
* `--provision` - If used without parameter, lists all eligible provisioning profiles. If used with UUID or name of your provisioning profile, it will switch to manual signing mode and configure the .xcodeproj file of your app. In this case xcconfig should not contain any provisioning/team id flags. This provisioning profile will be further used for codesigning the app.
* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application.
Expand Down
1 change: 1 addition & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $injector.require("iOSProvisionService", "./services/ios-provision-service");
$injector.require("xcconfigService", "./services/xcconfig-service");

$injector.require("cocoapodsService", "./services/cocoapods-service");
$injector.require("cocoaPodsPlatformManager", "./services/cocoapods-platform-manager");

$injector.require("projectTemplatesService", "./services/project-templates-service");
$injector.require("projectNameService", "./services/project-name-service");
Expand Down
91 changes: 68 additions & 23 deletions lib/commands/test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,75 @@
import * as helpers from "../common/helpers";

function RunKarmaTestCommandFactory(platform: string) {
return function RunKarmaTestCommand($options: IOptions, $testExecutionService: ITestExecutionService, $projectData: IProjectData, $analyticsService: IAnalyticsService, $platformEnvironmentRequirements: IPlatformEnvironmentRequirements) {
$projectData.initializeProjectData();
$analyticsService.setShouldDispose($options.justlaunch || !$options.watch);
const projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: $options.release });
this.execute = (args: string[]): Promise<void> => $testExecutionService.startKarmaServer(platform, $projectData, projectFilesConfig);
this.canExecute = (args: string[]): Promise<boolean> => canExecute({ $platformEnvironmentRequirements, $projectData, $options, platform });
this.allowedParameters = [];
};
}
abstract class TestCommandBase {
public allowedParameters: ICommandParameter[] = [];
private projectFilesConfig: IProjectFilesConfig;
protected abstract platform: string;
protected abstract $projectData: IProjectData;
protected abstract $testExecutionService: ITestExecutionService;
protected abstract $analyticsService: IAnalyticsService;
protected abstract $options: IOptions;
protected abstract $platformEnvironmentRequirements: IPlatformEnvironmentRequirements;
protected abstract $errors: IErrors;

async execute(args: string[]): Promise<void> {
await this.$testExecutionService.startKarmaServer(this.platform, this.$projectData, this.projectFilesConfig);
}

async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
this.$projectData.initializeProjectData();
this.$analyticsService.setShouldDispose(this.$options.justlaunch || !this.$options.watch);
this.projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: this.$options.release });

async function canExecute(input: { $platformEnvironmentRequirements: IPlatformEnvironmentRequirements, $projectData: IProjectData, $options: IOptions, platform: string }): Promise<boolean> {
const { $platformEnvironmentRequirements, $projectData, $options, platform } = input;
const output = await $platformEnvironmentRequirements.checkEnvironmentRequirements({
platform,
projectDir: $projectData.projectDir,
options: $options,
notConfiguredEnvOptions: {
hideSyncToPreviewAppOption: true,
hideCloudBuildOption: true
const output = await this.$platformEnvironmentRequirements.checkEnvironmentRequirements({
platform: this.platform,
projectDir: this.$projectData.projectDir,
options: this.$options,
notConfiguredEnvOptions: {
hideSyncToPreviewAppOption: true,
hideCloudBuildOption: true
}
});

const canStartKarmaServer = await this.$testExecutionService.canStartKarmaServer(this.$projectData);
if (!canStartKarmaServer) {
this.$errors.fail({
formatStr: "Error: In order to run unit tests, your project must already be configured by running $ tns test init.",
suppressCommandHelp: true,
errorCode: ErrorCodes.TESTS_INIT_REQUIRED
});
}
});

return output.canExecute;
return output.canExecute && canStartKarmaServer;
}
}

class TestAndroidCommand extends TestCommandBase implements ICommand {
protected platform = "android";

constructor(protected $projectData: IProjectData,
protected $testExecutionService: ITestExecutionService,
protected $analyticsService: IAnalyticsService,
protected $options: IOptions,
protected $platformEnvironmentRequirements: IPlatformEnvironmentRequirements,
protected $errors: IErrors) {
super();
}

}

class TestIosCommand extends TestCommandBase implements ICommand {
protected platform = "iOS";

constructor(protected $projectData: IProjectData,
protected $testExecutionService: ITestExecutionService,
protected $analyticsService: IAnalyticsService,
protected $options: IOptions,
protected $platformEnvironmentRequirements: IPlatformEnvironmentRequirements,
protected $errors: IErrors) {
super();
}

}

$injector.registerCommand("test|android", RunKarmaTestCommandFactory('android'));
$injector.registerCommand("test|ios", RunKarmaTestCommandFactory('iOS'));
$injector.registerCommand("test|android", TestAndroidCommand);
$injector.registerCommand("test|ios", TestIosCommand);
179 changes: 0 additions & 179 deletions lib/common/Gruntfile.js

This file was deleted.

8 changes: 8 additions & 0 deletions lib/common/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ declare const enum ErrorCodes {
KARMA_FAIL = 130,
UNHANDLED_REJECTION_FAILURE = 131,
DELETED_KILL_FILE = 132,
TESTS_INIT_REQUIRED = 133
}

interface IFutureDispatcher {
Expand Down Expand Up @@ -1168,6 +1169,13 @@ interface IDoctorService {
* @returns {Promise<boolean>} true if the environment is properly configured for local builds
*/
canExecuteLocalBuild(platform?: string, projectDir?: string, runtimeVersion?: string): Promise<boolean>;

/**
* Checks and notifies users for deprecated short imports in their applications.
* @param {string} projectDir Path to the application.
* @returns {void}
*/
checkForDeprecatedShortImportsInAppDir(projectDir: string): void;
}

interface IUtils {
Expand Down
4 changes: 2 additions & 2 deletions lib/common/definitions/mobile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ declare module Mobile {

interface IiOSDevice extends IDevice {
getDebugSocket(appId: string, projectName: string): Promise<any>;
destroyDebugSocket(appId: string): void;
destroyDebugSocket(appId: string): Promise<void>;
openDeviceLogStream(options?: IiOSLogStreamOptions): Promise<void>;
destroyAllSockets(): void;
destroyAllSockets(): Promise<void>;
}

interface IAndroidDevice extends IDevice {
Expand Down
3 changes: 2 additions & 1 deletion lib/common/errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as util from "util";
import * as path from "path";
import { SourceMapConsumer } from "source-map";
import { isInteractive } from "./helpers";

// we need this to overwrite .stack property (read-only in Error)
function Exception() {
Expand Down Expand Up @@ -159,7 +160,7 @@ export class Errors implements IErrors {
} catch (ex) {
const loggerLevel: string = $injector.resolve("logger").getLevel().toUpperCase();
const printCallStack = this.printCallStack || loggerLevel === "TRACE" || loggerLevel === "DEBUG";
const message = printCallStack ? resolveCallStack(ex) : `\x1B[31;1m${ex.message}\x1B[0m`;
const message = printCallStack ? resolveCallStack(ex) : isInteractive() ? `\x1B[31;1m${ex.message}\x1B[0m` : ex.message;

if (ex.printOnStdout) {
this.$injector.resolve("logger").out(message);
Expand Down
Loading