mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge branch 'ErjanGavalji/allow-ready-apk-or-appdir-runs'
This commit is contained in:
@ -14,7 +14,9 @@ module.exports = {
|
|||||||
emuAvdName: grunt.option("avd"),
|
emuAvdName: grunt.option("avd"),
|
||||||
outFile: grunt.option("logFilePath"),
|
outFile: grunt.option("logFilePath"),
|
||||||
runtimePath: grunt.option("runtimePath"),
|
runtimePath: grunt.option("runtimePath"),
|
||||||
showEmu: grunt.option("showEmu")
|
showEmu: grunt.option("showEmu"),
|
||||||
|
runAppOnly: grunt.option("runAppOnly"),
|
||||||
|
pathToApp: grunt.option("pathToApp")
|
||||||
};
|
};
|
||||||
|
|
||||||
(function validateInput(){
|
(function validateInput(){
|
||||||
@ -30,6 +32,10 @@ module.exports = {
|
|||||||
throw new Error("Please, specify the name of the AVD to start (--avd=...).");
|
throw new Error("Please, specify the name of the AVD to start (--avd=...).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.runAppOnly && !args.pathToApp) {
|
||||||
|
throw new Error("runAppOnly called, but no path to application specified. Please, add the path via the (--pathToApp=...) parameter.");
|
||||||
|
}
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var localCfg = {
|
var localCfg = {
|
||||||
@ -40,6 +46,7 @@ module.exports = {
|
|||||||
outFile: args.outFile || "./TestRunResult.txt",
|
outFile: args.outFile || "./TestRunResult.txt",
|
||||||
frameworkArgument: args.runtimePath ? " --frameworkPath=" + args.runtimePath : "",
|
frameworkArgument: args.runtimePath ? " --frameworkPath=" + args.runtimePath : "",
|
||||||
showEmu: args.showEmu || false,
|
showEmu: args.showEmu || false,
|
||||||
|
runAppOnly: args.runAppOnly || false,
|
||||||
|
|
||||||
workingDir:".testsapprun",
|
workingDir:".testsapprun",
|
||||||
testsAppName:"TestsApp",
|
testsAppName:"TestsApp",
|
||||||
@ -54,6 +61,11 @@ module.exports = {
|
|||||||
platform: args.platform
|
platform: args.platform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localCfg.runAppOnly) {
|
||||||
|
localCfg.pathToApp = localCfg.pathToApk = args.pathToApp;
|
||||||
|
localCfg.applicationDir = "./";
|
||||||
|
}
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
clean: {
|
clean: {
|
||||||
workingDir: {
|
workingDir: {
|
||||||
@ -189,7 +201,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
startiOSApp: {
|
startiOSApp: {
|
||||||
cmd: "xcrun simctl launch " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName
|
cmd: "xcrun simctl launch " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
untar: {
|
untar: {
|
||||||
modules: {
|
modules: {
|
||||||
@ -260,42 +272,70 @@ module.exports = {
|
|||||||
"copy:simulatorLog"
|
"copy:simulatorLog"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask("doPostPlatformAddAndroid", [
|
grunt.registerTask("doPreUninstallAppAndroid", [
|
||||||
"exec:restartAdb"
|
"exec:restartAdb"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.registerTask("doPostPlatformAddiOS", [
|
grunt.registerTask("doPreUninstallAppiOS", [
|
||||||
"clean:simulatorLog"
|
"clean:simulatorLog"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("cleanup", [
|
||||||
//xcrun instruments -s
|
getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
||||||
grunt.registerTask("testsapp", [
|
"clean:workingDir"
|
||||||
"clean:workingDir",
|
|
||||||
"mkdir:workingDir",
|
|
||||||
getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
|
||||||
getPlatformSpecificTask("startEmulator{platform}"),
|
|
||||||
|
|
||||||
"exec:createApp",
|
|
||||||
"clean:originalAppDir",
|
|
||||||
"copy:testsAppToRunDir",
|
|
||||||
"clean:modules",
|
|
||||||
"untar:modules",
|
|
||||||
"copy:modulesToDir",
|
|
||||||
"clean:tempExtractedModules",
|
|
||||||
|
|
||||||
"exec:addPlatform",
|
|
||||||
getPlatformSpecificTask("copy:add{platform}Permissions"),
|
|
||||||
"shell:buildApp",
|
|
||||||
getPlatformSpecificTask("doPostPlatformAdd{platform}"),
|
|
||||||
|
|
||||||
getPlatformSpecificTask("exec:uninstallExisting{platform}App"),
|
|
||||||
getPlatformSpecificTask("exec:installNew{platform}App"),
|
|
||||||
getPlatformSpecificTask("exec:start{platform}App"),
|
|
||||||
getPlatformSpecificTask("collectLog{platform}"),
|
|
||||||
|
|
||||||
// getPlatformSpecificTask("exec:kill{platform}Emulator"),
|
|
||||||
// "clean:workingDir"
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("buildOnly", [
|
||||||
|
"exec:createApp",
|
||||||
|
"clean:originalAppDir",
|
||||||
|
"copy:testsAppToRunDir",
|
||||||
|
"clean:modules",
|
||||||
|
"untar:modules",
|
||||||
|
"copy:modulesToDir",
|
||||||
|
"clean:tempExtractedModules",
|
||||||
|
|
||||||
|
"exec:addPlatform",
|
||||||
|
getPlatformSpecificTask("copy:add{platform}Permissions"),
|
||||||
|
"shell:buildApp",
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("buildTestsApp", [
|
||||||
|
"cleanup",
|
||||||
|
"mkdir:workingDir",
|
||||||
|
"buildOnly"
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("runOnly", [
|
||||||
|
getPlatformSpecificTask("doPreUninstallApp{platform}"),
|
||||||
|
|
||||||
|
getPlatformSpecificTask("exec:uninstallExisting{platform}App"),
|
||||||
|
getPlatformSpecificTask("exec:installNew{platform}App"),
|
||||||
|
getPlatformSpecificTask("exec:start{platform}App"),
|
||||||
|
getPlatformSpecificTask("collectLog{platform}"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("runApp", [
|
||||||
|
"cleanup",
|
||||||
|
getPlatformSpecificTask("startEmulator{platform}"),
|
||||||
|
"runOnly",
|
||||||
|
"cleanup"
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
var tasksToExecute = ["runApp"];
|
||||||
|
if (!localCfg.runAppOnly) {
|
||||||
|
tasksToExecute = [
|
||||||
|
"cleanup",
|
||||||
|
"mkdir:workingDir",
|
||||||
|
getPlatformSpecificTask("startEmulator{platform}"),
|
||||||
|
"buildOnly",
|
||||||
|
"runOnly",
|
||||||
|
"cleanup"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
grunt.registerTask("testsapp", tasksToExecute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
if (grunt.cli.tasks.indexOf("testsapp") >= 0) {
|
if (grunt.cli.tasks.indexOf("testsapp") >= 0 || grunt.cli.tasks.indexOf("buildTestsApp")>= 0) {
|
||||||
var tsTester = require("./build/run-testsapp.grunt.js");
|
var tsTester = require("./build/run-testsapp.grunt.js");
|
||||||
tsTester.run(grunt);
|
tsTester.run(grunt);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user