Merge pull request #2178 from NativeScript/cankov/re-org
Reorganize the repo
3
.gitignore
vendored
@ -38,3 +38,6 @@ TestRunResult.txt
|
||||
tns-core-modules.base.d.ts
|
||||
tns-core-modules.d.ts
|
||||
tns-core-modules.es6.d.ts
|
||||
|
||||
tests/platforms/
|
||||
tests/lib/
|
||||
|
@ -40,7 +40,7 @@ before_script:
|
||||
script:
|
||||
- jdk_switcher use oraclejdk8
|
||||
- grunt default &&
|
||||
FULL_PACKAGE_VERSION=`node -e 'console.log(require("./bin/dist/modules/package.json").version);'` &&
|
||||
FULL_PACKAGE_VERSION=`node -e 'console.log(require("./bin/dist/tns-core-modules/package.json").version);'` &&
|
||||
(cd build/platform-declarations && grunt) &&
|
||||
echo no | npm install nativescript@next -g > /dev/null &&
|
||||
grunt buildOnlyTestsApp --platform=Android --modulesPath=./bin/dist/$PACKAGE_NAME-$FULL_PACKAGE_VERSION.tgz --runtimeVersion=$RUNTIMEVERSION --emuPId=.*emulator.* --avd=$AVD_NAME --showEmu=false > /dev/null &&
|
||||
|
@ -58,7 +58,7 @@ module.exports = {
|
||||
pathToApp: "./platforms/ios/build/emulator/TestsApp.app",
|
||||
deployedAppName:"org.nativescript.TestsApp",
|
||||
mainActivityName:"com.tns.NativeScriptActivity",
|
||||
pathToCompiledTests: "bin/dist/apps/tests",
|
||||
pathToCompiledTests: "bin/dist/tests/app",
|
||||
simulatorSysLog: pathModule.join(process.env.HOME, "Library/Logs/CoreSimulator", args.emuAvdName, "/system.log"),
|
||||
platform: args.platform
|
||||
}
|
||||
@ -199,12 +199,10 @@ module.exports = {
|
||||
},
|
||||
startiOSApp: {
|
||||
cmd: "xcrun simctl launch " + localCfg.emuAvdName + " org.nativescript." + localCfg.testsAppName
|
||||
}
|
||||
},
|
||||
untar: {
|
||||
modules: {
|
||||
src: localCfg.modulesPath,
|
||||
dest: pathModule.join(localCfg.applicationDir, "node_modules")
|
||||
},
|
||||
"npm-i-modules": {
|
||||
cmd: "npm i " + pathModule.relative(localCfg.applicationDir, localCfg.modulesPath),
|
||||
cwd: localCfg.applicationDir
|
||||
}
|
||||
},
|
||||
shell: {
|
||||
@ -297,7 +295,7 @@ module.exports = {
|
||||
"clean:originalAppDir",
|
||||
"copy:testsAppToRunDir",
|
||||
"clean:modules",
|
||||
"untar:modules",
|
||||
"exec:npm-i-modules",
|
||||
"copy:modulesToDir",
|
||||
"clean:tempExtractedModules",
|
||||
|
||||
|
@ -1,13 +1,43 @@
|
||||
"use strict";
|
||||
var ts = require("typescript");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var arg1 = process.argv.length > 2 ? process.argv[2] : "";
|
||||
var isIncremental = arg1.indexOf("i") >= 0;
|
||||
if (isIncremental) {
|
||||
console.log("incremental");
|
||||
}
|
||||
function compile(fileNames, options) {
|
||||
console.time("program");
|
||||
var program = ts.createProgram(fileNames, options);
|
||||
console.timeEnd("program");
|
||||
var sourceFiles = program.getSourceFiles().filter(function (f) { return f.fileName.lastIndexOf(".d.ts") !== f.fileName.length - 5; });
|
||||
// sourceFiles.forEach(sf => console.log(" - " + sf.fileName));
|
||||
var emitResults = [];
|
||||
var allDiagnostics = [];
|
||||
sourceFiles.forEach(function (srcFile) { return emitResults.push(program.emit(srcFile)); });
|
||||
console.time("transpile");
|
||||
if (isIncremental) {
|
||||
sourceFiles = sourceFiles.filter(function (srcFile) {
|
||||
try {
|
||||
var tsName = srcFile.fileName;
|
||||
var jsName = path.join(path.dirname(tsName), path.basename(tsName, ".ts")) + ".js";
|
||||
var tsTime = fs.statSync(tsName).mtime.getTime();
|
||||
var jsTime = fs.statSync(jsName).mtime.getTime();
|
||||
return jsTime < tsTime;
|
||||
}
|
||||
catch (e) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
sourceFiles.forEach(function (srcFile) {
|
||||
console.log(" - " + srcFile.fileName);
|
||||
emitResults.push(program.emit(srcFile));
|
||||
});
|
||||
}
|
||||
else {
|
||||
sourceFiles.forEach(function (srcFile) { return emitResults.push(program.emit(srcFile)); });
|
||||
}
|
||||
console.timeEnd("transpile");
|
||||
console.time("diagnostics");
|
||||
sourceFiles.forEach(function (srcFile) { return allDiagnostics = allDiagnostics.concat(ts.getPreEmitDiagnostics(program, srcFile)); });
|
||||
emitResults.forEach(function (er) { return allDiagnostics = allDiagnostics.concat(er.diagnostics); });
|
||||
allDiagnostics.forEach(function (diagnostic) {
|
||||
@ -18,6 +48,7 @@ function compile(fileNames, options) {
|
||||
var code = diagnostic.code;
|
||||
console.log(diagnostic.file.fileName + "(" + (line + 1) + "," + (character + 1) + "): TS" + code + ": " + message);
|
||||
});
|
||||
console.timeEnd("diagnostics");
|
||||
var exitCode = emitResults.some(function (er) { return er.emitSkipped; }) ? 1 : 0;
|
||||
console.log("Process exiting with code " + exitCode + ".");
|
||||
process.exit(exitCode);
|
||||
|
@ -1,17 +1,51 @@
|
||||
import * as ts from "typescript";
|
||||
declare var process, require;
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
var arg1 = process.argv.length > 2 ? process.argv[2] : "";
|
||||
|
||||
var isIncremental = arg1.indexOf("i") >= 0;
|
||||
if (isIncremental) {
|
||||
console.log("incremental");
|
||||
}
|
||||
|
||||
function compile(fileNames: string[], options: ts.CompilerOptions) {
|
||||
console.time("program");
|
||||
var program = ts.createProgram(fileNames, options);
|
||||
|
||||
console.timeEnd("program");
|
||||
var sourceFiles = program.getSourceFiles().filter(f => f.fileName.lastIndexOf(".d.ts") !== f.fileName.length - 5);
|
||||
// sourceFiles.forEach(sf => console.log(" - " + sf.fileName));
|
||||
|
||||
var emitResults = [];
|
||||
var allDiagnostics = [];
|
||||
|
||||
sourceFiles.forEach(srcFile => emitResults.push(program.emit(srcFile)));
|
||||
console.time("transpile");
|
||||
if (isIncremental) {
|
||||
sourceFiles = sourceFiles.filter(srcFile => {
|
||||
try {
|
||||
var tsName = srcFile.fileName;
|
||||
var jsName = path.join(path.dirname(tsName), path.basename(tsName, ".ts")) + ".js";
|
||||
|
||||
var tsTime = fs.statSync(tsName).mtime.getTime();
|
||||
var jsTime = fs.statSync(jsName).mtime.getTime();
|
||||
|
||||
return jsTime < tsTime;
|
||||
} catch(e) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
sourceFiles.forEach(srcFile => {
|
||||
console.log(" - " + srcFile.fileName);
|
||||
emitResults.push(program.emit(srcFile));
|
||||
});
|
||||
} else {
|
||||
sourceFiles.forEach(srcFile => emitResults.push(program.emit(srcFile)));
|
||||
}
|
||||
console.timeEnd("transpile");
|
||||
|
||||
console.time("diagnostics");
|
||||
sourceFiles.forEach(srcFile => allDiagnostics = allDiagnostics.concat(ts.getPreEmitDiagnostics(program, srcFile)));
|
||||
emitResults.forEach(er => allDiagnostics = allDiagnostics.concat(er.diagnostics));
|
||||
|
||||
@ -23,6 +57,7 @@ function compile(fileNames: string[], options: ts.CompilerOptions) {
|
||||
var code = diagnostic.code;
|
||||
console.log(diagnostic.file.fileName + "(" + (line + 1) + "," + (character + 1) + "): TS" + code + ": " + message);
|
||||
});
|
||||
console.timeEnd("diagnostics");
|
||||
|
||||
var exitCode = emitResults.some(er => er.emitSkipped) ? 1 : 0;
|
||||
|
||||
|
237
gruntfile.js
@ -1,6 +1,7 @@
|
||||
var tsconfig = require('./tsconfig.json');
|
||||
var shelljs = require("shelljs");
|
||||
var path = require("path");
|
||||
var fs=require("fs");
|
||||
|
||||
module.exports = function(grunt) {
|
||||
if (grunt.option('profile')) {
|
||||
@ -14,9 +15,6 @@ module.exports = function(grunt) {
|
||||
return;
|
||||
}
|
||||
|
||||
var fs=require("fs");
|
||||
var pathModule=require("path");
|
||||
|
||||
var tsLintOption = grunt.option('runtslint');
|
||||
var skipTsLint = tsLintOption == 'false' || tsLintOption == false;
|
||||
if (tsLintOption == null) {
|
||||
@ -42,6 +40,7 @@ module.exports = function(grunt) {
|
||||
};
|
||||
|
||||
var updateModulesPackageDef = function(content, srcPath) {
|
||||
console.log("Patch: " + srcPath);
|
||||
return updatePackageDef(content, function(contentAsObject) {
|
||||
contentAsObject.version = localCfg.packageVersion;
|
||||
if (localCfg.commitSHA) {
|
||||
@ -122,38 +121,40 @@ module.exports = function(grunt) {
|
||||
|
||||
var getSubDirs = function(dir) {
|
||||
return shelljs.ls(dir).filter(function (subDir) {
|
||||
return shelljs.test('-d', pathModule.join(dir, subDir));
|
||||
return shelljs.test('-d', path.join(dir, subDir));
|
||||
});
|
||||
};
|
||||
|
||||
var getApps = function() {
|
||||
var allApps = getSubDirs(localCfg.srcAppsDir);
|
||||
if (grunt.option('test-app-only')) {
|
||||
allApps = allApps.filter(function(appName) {
|
||||
return appName === 'tests';
|
||||
allApps = allApps.filter(function(app) {
|
||||
return app === 'tests';
|
||||
});
|
||||
}
|
||||
return allApps;
|
||||
};
|
||||
|
||||
var outDir = tsconfig.compilerOptions.outDir || "./bin/dist";
|
||||
var localCfg = {
|
||||
srcDir: ".",
|
||||
srcAppsDir: "./apps",
|
||||
srcAppsTests: "./apps/tests",
|
||||
packageJsonFilePath: "./package.json",
|
||||
outDir: "./bin/dist",
|
||||
srcAppsTestsDir: "./tests/app",
|
||||
packageJsonFilePath: "./tns-core-modules/package.json",
|
||||
outArticlesDir: "./bin/dist/articles",
|
||||
outModulesDir: tsconfig.compilerOptions.outDir || "./bin/dist/modules",
|
||||
outDir: outDir,
|
||||
outTnsCoreModules: path.join(outDir, "tns-core-modules"),
|
||||
outAppsDir: "./bin/dist/apps",
|
||||
outTsAppsDir: "./bin/dist/ts-apps",
|
||||
outAppsTestsDir: "./bin/dist/tests/app",
|
||||
outTsAppsTestsDir: "./bin/dist/ts-tests/app",
|
||||
outTsAppsDir: "./bin/dist/ts-apps/app",
|
||||
outApiRefDir: "./bin/dist/apiref"
|
||||
};
|
||||
|
||||
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
|
||||
nodeTestEnv.NODE_PATH = localCfg.outModulesDir;
|
||||
|
||||
localCfg.nodeTestsDir = pathModule.join(localCfg.outModulesDir, 'node-tests');
|
||||
nodeTestEnv.NODE_PATH = localCfg.outTnsCoreModules
|
||||
|
||||
localCfg.nodeTestsDir = path.join(localCfg.outDir, 'node-tests');
|
||||
|
||||
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
|
||||
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
|
||||
@ -161,18 +162,20 @@ module.exports = function(grunt) {
|
||||
localCfg.typeScriptSrc = tsconfig.filesGlob;
|
||||
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function(item) { return /^!/.test(item); });
|
||||
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
|
||||
"!ios.d.ts",
|
||||
"!android17.d.ts",
|
||||
"!libjs.d.ts"
|
||||
"!tns-core-modules/ios.d.ts",
|
||||
"!tns-core-modules/android17.d.ts",
|
||||
"!tns-core-modules/libjs.d.ts",
|
||||
"!tests/node_modules/"
|
||||
]);
|
||||
localCfg.srcTsdFiles = [
|
||||
"**/*.d.ts",
|
||||
"!apps/**",
|
||||
"!tests/**",
|
||||
"!node-tests/**",
|
||||
"!org.nativescript.widgets.d.ts",
|
||||
"!android17.d.ts",
|
||||
"!tns-core-modules/org.nativescript.widgets.d.ts",
|
||||
"!tns-core-modules/android17.d.ts",
|
||||
"!**/*.android.d.ts",
|
||||
"!ios.d.ts",
|
||||
"!tns-core-modules/ios.d.ts",
|
||||
"!**/*.ios.d.ts"
|
||||
].concat(localCfg.defaultExcludes);
|
||||
|
||||
@ -181,9 +184,9 @@ module.exports = function(grunt) {
|
||||
tsOptions.removeComments = !grunt.option('leavecomments') || '';
|
||||
tsOptions.compiler = "node_modules/typescript/bin/tsc";
|
||||
tsOptions.failOnTypeErrors = true;
|
||||
tsOptions.outDir = localCfg.outModulesDir;
|
||||
tsOptions.outDir = localCfg.outDir;
|
||||
var removeCommentsArgument = tsOptions.removeComments ? " --removeComments" : "";
|
||||
tsOptions.additionalFlags = "--outDir " + localCfg.outModulesDir + removeCommentsArgument;
|
||||
tsOptions.additionalFlags = "--outDir " + localCfg.outDir + removeCommentsArgument;
|
||||
|
||||
grunt.initConfig({
|
||||
localCfg : localCfg,
|
||||
@ -199,13 +202,13 @@ module.exports = function(grunt) {
|
||||
"_references.js",
|
||||
"**/*.map"
|
||||
],
|
||||
cwd: localCfg.outModulesDir
|
||||
cwd: localCfg.outDir
|
||||
},
|
||||
nodeTests: {
|
||||
src: localCfg.nodeTestsDir,
|
||||
},
|
||||
builtModules: {
|
||||
src: localCfg.outModulesDir
|
||||
src: localCfg.outDir
|
||||
},
|
||||
externalModules: {
|
||||
expand: true,
|
||||
@ -214,9 +217,6 @@ module.exports = function(grunt) {
|
||||
force: true
|
||||
},
|
||||
},
|
||||
readyAppFiles: {
|
||||
src: [localCfg.outModulesDir + "/apps/**"]
|
||||
},
|
||||
articles: {
|
||||
src: [ localCfg.outArticlesDir ]
|
||||
},
|
||||
@ -228,26 +228,26 @@ module.exports = function(grunt) {
|
||||
jsLibs: {
|
||||
expand: true,
|
||||
src: [
|
||||
"js-libs/**/*.js",
|
||||
"fetch/**/*.js",
|
||||
"css/**/*.js",
|
||||
"css-value/**/*.js",
|
||||
"tns-core-modules/js-libs/**/*.js",
|
||||
"tns-core-modules/fetch/**/*.js",
|
||||
"tns-core-modules/css/**/*.js",
|
||||
"tns-core-modules/css-value/**/*.js",
|
||||
],
|
||||
dest: localCfg.outModulesDir,
|
||||
dest: localCfg.outDir,
|
||||
cwd: localCfg.srcDir
|
||||
},
|
||||
articleMDs: {
|
||||
expand: true,
|
||||
src: [ "**/*.md" ],
|
||||
dest: localCfg.outArticlesDir,
|
||||
cwd: localCfg.srcAppsTests
|
||||
cwd: localCfg.srcAppsTestsDir
|
||||
},
|
||||
license: {
|
||||
expand: true,
|
||||
src: [
|
||||
"./LICENSE",
|
||||
],
|
||||
dest: "<%= localCfg.outModulesDir %>/",
|
||||
dest: localCfg.outTnsCoreModules,
|
||||
cwd: localCfg.srcDir
|
||||
},
|
||||
appLicense: {
|
||||
@ -269,7 +269,7 @@ module.exports = function(grunt) {
|
||||
"!ios.d.ts",
|
||||
"!**/*.ios.d.ts",
|
||||
].concat(localCfg.defaultExcludes),
|
||||
dest: localCfg.outModulesDir + "/",
|
||||
dest: localCfg.outDir + "/",
|
||||
expand: true,
|
||||
options: {
|
||||
process: filterTypeScriptFiles
|
||||
@ -277,8 +277,9 @@ module.exports = function(grunt) {
|
||||
},
|
||||
modulesPackageDef: {
|
||||
expand: true,
|
||||
src: localCfg.packageJsonFilePath,
|
||||
dest: localCfg.outModulesDir + "/",
|
||||
src: path.basename(localCfg.packageJsonFilePath),
|
||||
cwd: path.dirname(localCfg.packageJsonFilePath),
|
||||
dest: localCfg.outTnsCoreModules + "/",
|
||||
options: {
|
||||
process: updateModulesPackageDef
|
||||
}
|
||||
@ -303,7 +304,7 @@ module.exports = function(grunt) {
|
||||
"!node_modules/**/*.*",
|
||||
"!" + localCfg.outDir + "/**/*.*"
|
||||
],
|
||||
dest: localCfg.outModulesDir + "/"
|
||||
dest: localCfg.outDir + "/"
|
||||
},
|
||||
rawAppsFiles: {
|
||||
expand: true,
|
||||
@ -311,20 +312,33 @@ module.exports = function(grunt) {
|
||||
"**/*.*",
|
||||
"**/*",
|
||||
"!**/*.map",
|
||||
"!**/*.ts"
|
||||
"!**/*.ts"
|
||||
],
|
||||
dest: localCfg.outAppsDir,
|
||||
cwd: localCfg.srcAppsDir,
|
||||
dot: true
|
||||
},
|
||||
rawTestsFiles: {
|
||||
expand: true,
|
||||
src: [
|
||||
"**/*.*",
|
||||
"**/*",
|
||||
"!**/*.map",
|
||||
"!**/*.ts"
|
||||
],
|
||||
dest: localCfg.outAppsTestsDir,
|
||||
cwd: localCfg.srcAppsTestsDir,
|
||||
dot: true
|
||||
},
|
||||
readyAppFiles: {
|
||||
expand: true,
|
||||
src: ["./**/*.*"],
|
||||
dest: localCfg.outAppsDir + "/",
|
||||
cwd: localCfg.outModulesDir + "/apps/",
|
||||
options: {
|
||||
process: processAppFile
|
||||
}
|
||||
cwd: localCfg.outDir + "/apps/",
|
||||
// WARNING: Why not insert BOMs in .png files?
|
||||
// options: {
|
||||
// process: processAppFile
|
||||
// }
|
||||
},
|
||||
readyTsAppFiles: {
|
||||
expand: true,
|
||||
@ -332,6 +346,12 @@ module.exports = function(grunt) {
|
||||
dest: localCfg.outTsAppsDir + "/",
|
||||
cwd: localCfg.srcAppsDir
|
||||
},
|
||||
readyTsAppsTestsFiles: {
|
||||
expand: true,
|
||||
src: ["./**/*.*", "!./**/*.map"],
|
||||
dest: localCfg.outTsAppsTestsDir + "/",
|
||||
cwd: localCfg.srcAppsTestsDir
|
||||
},
|
||||
readyPackages: {
|
||||
expand: true,
|
||||
src: ["./**/*.tgz"],
|
||||
@ -348,7 +368,7 @@ module.exports = function(grunt) {
|
||||
'!node_modules/**/*',
|
||||
'!node-tests/**/*',
|
||||
],
|
||||
cwd: localCfg.outModulesDir,
|
||||
cwd: localCfg.outDir,
|
||||
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
|
||||
}
|
||||
},
|
||||
@ -358,8 +378,8 @@ module.exports = function(grunt) {
|
||||
tsconfig: 'tsconfig.json',
|
||||
passThrough: true,
|
||||
},
|
||||
outDir: localCfg.outModulesDir,
|
||||
dest: localCfg.outModulesDir,
|
||||
outDir: localCfg.outDir,
|
||||
dest: localCfg.outDir,
|
||||
options: tsOptions
|
||||
},
|
||||
"build-inplace": {
|
||||
@ -373,14 +393,14 @@ module.exports = function(grunt) {
|
||||
},
|
||||
buildNodeTests: {
|
||||
src: [
|
||||
'js-libs/easysax/**/*.ts',
|
||||
'module.d.ts',
|
||||
'xml/**/*.ts',
|
||||
'node-tests/**/*.ts',
|
||||
'es-collections.d.ts',
|
||||
],
|
||||
outDir: localCfg.outModulesDir,
|
||||
dest: localCfg.outModulesDir,
|
||||
'tns-core-modules/js-libs/easysax/**/*.ts',
|
||||
'tns-core-modules/module.d.ts',
|
||||
'tns-core-modules/xml/**/*.ts',
|
||||
'tns-core-modules/es-collections.d.ts',
|
||||
'node-tests/**/*.ts',
|
||||
],
|
||||
outDir: localCfg.outDir,
|
||||
dest: localCfg.outDir,
|
||||
options: tsOptions
|
||||
},
|
||||
buildDts: {
|
||||
@ -389,21 +409,22 @@ module.exports = function(grunt) {
|
||||
'!org.nativescript.widgets.d.ts',
|
||||
'!**/*.android.d.ts',
|
||||
'!node_modules/**/*',
|
||||
'!tests/node_modules/**/*.*',
|
||||
'!bin/**/*',
|
||||
'!apps/**/*',
|
||||
'!android17.d.ts',
|
||||
'!ios.d.ts',
|
||||
],
|
||||
outDir: localCfg.outModulesDir,
|
||||
dest: localCfg.outModulesDir,
|
||||
outDir: localCfg.outDir,
|
||||
dest: localCfg.outDir,
|
||||
options: tsOptions
|
||||
},
|
||||
testCombinedDts: {
|
||||
src: [
|
||||
pathModule.join(localCfg.outModulesDir, 'tns-core-modules.d.ts'),
|
||||
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
|
||||
],
|
||||
outDir: localCfg.outModulesDir,
|
||||
dest: localCfg.outModulesDir,
|
||||
outDir: localCfg.outDir,
|
||||
dest: localCfg.outDir,
|
||||
options: tsOptions
|
||||
}
|
||||
},
|
||||
@ -420,7 +441,7 @@ module.exports = function(grunt) {
|
||||
exec: {
|
||||
packModules: {
|
||||
cmd: "npm pack",
|
||||
cwd: localCfg.outModulesDir + "/"
|
||||
cwd: localCfg.outTnsCoreModules + "/"
|
||||
},
|
||||
packApp: {
|
||||
cmd: "npm pack",
|
||||
@ -430,7 +451,7 @@ module.exports = function(grunt) {
|
||||
cmd: "grunt simplemocha:node"
|
||||
},
|
||||
injectArticleSnippets: {
|
||||
cmd: "node node_modules/markdown-snippet-injector/index.js --root=<%= localCfg.srcAppsTests %> --docsroot=<%= localCfg.outArticlesDir %>"
|
||||
cmd: "node node_modules/markdown-snippet-injector/index.js --root=<%= localCfg.srcAppsTestsDir %> --docsroot=<%= localCfg.outArticlesDir %>"
|
||||
}
|
||||
},
|
||||
multidest: {
|
||||
@ -440,9 +461,11 @@ module.exports = function(grunt) {
|
||||
var apps = getApps();
|
||||
var targetDirs = [];
|
||||
apps.forEach(function(item){
|
||||
targetDirs.push(pathModule.join(localCfg.outAppsDir, item));
|
||||
targetDirs.push(pathModule.join(localCfg.outTsAppsDir, item));
|
||||
targetDirs.push(path.join(localCfg.outAppsDir, item));
|
||||
targetDirs.push(path.join(localCfg.outTsAppsDir, item));
|
||||
});
|
||||
targetDirs.push(localCfg.outAppsTestsDir);
|
||||
targetDirs.push(localCfg.outTsAppsTestsDir);
|
||||
return targetDirs;
|
||||
}()
|
||||
}
|
||||
@ -462,7 +485,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
env: {
|
||||
nodeTests: {
|
||||
NODE_PATH: localCfg.outModulesDir,
|
||||
NODE_PATH: nodeTestEnv.NODE_PATH,
|
||||
}
|
||||
},
|
||||
typedoc: {
|
||||
@ -492,16 +515,16 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks("grunt-simple-mocha");
|
||||
grunt.loadNpmTasks('grunt-typedoc');
|
||||
|
||||
var cloneTasks = function(originalTasks, taskNameSuffix) {
|
||||
var cloneTasks = function(originalTasks, app) {
|
||||
var clonedTasks = [];
|
||||
for(var i=0; i<originalTasks.length; i++) {
|
||||
var originalTask = originalTasks[i];
|
||||
|
||||
var taskCfg = grunt.util._.clone(grunt.config(originalTask.name));
|
||||
var taskName = grunt.util._.clone(originalTask.name);
|
||||
taskName[1] = taskName[1] + "_" + taskNameSuffix;
|
||||
taskName[1] = taskName[1] + "_" + app;
|
||||
|
||||
originalTask.specializeCfg(taskCfg, taskNameSuffix);
|
||||
originalTask.specializeCfg(taskCfg, app);
|
||||
|
||||
clonedTasks.push({name: taskName, cfg: taskCfg});
|
||||
}
|
||||
@ -519,7 +542,7 @@ module.exports = function(grunt) {
|
||||
var dtsLines = dtsFiles.map(function(dtsFile) {
|
||||
return '/// <reference path="' + dtsFile + '" />';
|
||||
});
|
||||
var combinedDtsPath = pathModule.join(outDir, outFile);
|
||||
var combinedDtsPath = path.join(outDir, outFile);
|
||||
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
|
||||
}
|
||||
function generateModulesDts(outDir) {
|
||||
@ -536,10 +559,11 @@ module.exports = function(grunt) {
|
||||
var es6Excludes = nonES6Files.map(function(file) {
|
||||
return '!' + file;
|
||||
})
|
||||
var dtsFiles = grunt.file.expand({cwd: outDir}, [
|
||||
var dtsFiles = grunt.file.expand({cwd: localCfg.outTnsCoreModules }, [
|
||||
"**/*.d.ts",
|
||||
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
|
||||
"!apps/**",
|
||||
"!tests/**",
|
||||
"!ts-apps/**",
|
||||
"!node-tests/**",
|
||||
"!org.nativescript.widgets.d.ts",
|
||||
@ -549,39 +573,55 @@ module.exports = function(grunt) {
|
||||
"!**/*.ios.d.ts",
|
||||
"!tns-core-modules.d.ts",
|
||||
"!tns-core-modules.es6.d.ts",
|
||||
"!tns-core-modules.base.d.ts",
|
||||
"!tns-core-modules.base.d.ts"
|
||||
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
|
||||
dtsFiles.sort();
|
||||
|
||||
writeDtsFile(dtsFiles, outDir, 'tns-core-modules.base.d.ts');
|
||||
writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts');
|
||||
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
|
||||
writeDtsFile(es6Files, outDir, 'tns-core-modules.es6.d.ts');
|
||||
writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts');
|
||||
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
|
||||
writeDtsFile(allFiles, outDir, 'tns-core-modules.d.ts');
|
||||
writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts');
|
||||
};
|
||||
|
||||
grunt.registerTask("processEachApp", function(outAppsDir, pkgAppNameSuffix){
|
||||
var allApps = getApps();
|
||||
if (grunt.option('test-app-only')) {
|
||||
allApps = allApps.filter(function(appName) {
|
||||
return appName === 'tests';
|
||||
});
|
||||
}
|
||||
|
||||
grunt.registerTask("processTestsApp", function(outTestsAppDir, pkgAppNameSuffix) {
|
||||
var tasks = [
|
||||
{
|
||||
name: ["copy", "appPackageDef"],
|
||||
specializeCfg: function (cfg, currentAppName) {
|
||||
outAppDir = pathModule.join(outAppsDir, currentAppName);
|
||||
var pkgFilePath = pathModule.join(outAppDir, "package.json");
|
||||
cfg.src = pkgFilePath;
|
||||
cfg.dest = outAppDir;
|
||||
cfg.appName = currentAppName + (pkgAppNameSuffix || "");
|
||||
specializeCfg: function (cfg, app) {
|
||||
cfg.src = path.join(outTestsAppDir, "package.json");
|
||||
cfg.dest = outTestsAppDir;
|
||||
cfg.appName = "tests" + (pkgAppNameSuffix || "");
|
||||
}
|
||||
},
|
||||
{
|
||||
name: ["exec", "packApp"],
|
||||
specializeCfg: function(cfg, currentAppName) {
|
||||
cfg.cwd = pathModule.join(outAppsDir, currentAppName);
|
||||
specializeCfg: function(cfg, app) {
|
||||
cfg.cwd = outTestsAppDir;
|
||||
}
|
||||
}
|
||||
];
|
||||
var clonedTasks = cloneTasks(tasks, "tests");
|
||||
enqueueTasks(clonedTasks);
|
||||
});
|
||||
|
||||
grunt.registerTask("processEachApp", function(outAppsDir, pkgAppNameSuffix){
|
||||
var allApps = getApps();
|
||||
var tasks = [
|
||||
{
|
||||
name: ["copy", "appPackageDef"],
|
||||
specializeCfg: function (cfg, app) {
|
||||
outAppDir = path.join(outAppsDir, app);
|
||||
var pkgFilePath = path.join(outAppDir, "package.json");
|
||||
cfg.src = pkgFilePath;
|
||||
cfg.dest = outAppDir;
|
||||
cfg.appName = app + (pkgAppNameSuffix || "");
|
||||
}
|
||||
},
|
||||
{
|
||||
name: ["exec", "packApp"],
|
||||
specializeCfg: function(cfg, app) {
|
||||
cfg.cwd = path.join(outAppsDir, app);
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -598,6 +638,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask("collect-apps-raw-files", [
|
||||
"copy:rawAppsFiles",
|
||||
"copy:rawTestsFiles",
|
||||
"multidest:copyLicenseFiles"
|
||||
]);
|
||||
|
||||
@ -631,8 +672,7 @@ module.exports = function(grunt) {
|
||||
"copy:builtModules"
|
||||
]);
|
||||
grunt.registerTask("distribute-apps-files", [
|
||||
"copy:readyAppFiles",
|
||||
"clean:readyAppFiles"
|
||||
"copy:readyAppFiles"
|
||||
]);
|
||||
grunt.registerTask("check-packagejson-boms", function() {
|
||||
function hasBOM(filepath) {
|
||||
@ -654,17 +694,18 @@ module.exports = function(grunt) {
|
||||
grunt.fail.fatal("\n" + errors.join("\n"));
|
||||
});
|
||||
grunt.registerTask("distribute-ts-apps-files", [
|
||||
"copy:readyTsAppFiles"
|
||||
"copy:readyTsAppFiles",
|
||||
"copy:readyTsAppsTestsFiles"
|
||||
]);
|
||||
grunt.registerTask("herdArticles", function() {
|
||||
var moveSinglesUp = function(dir) {
|
||||
var objs = fs.readdirSync(dir);
|
||||
for (var i=0; i<objs.length; i++) {
|
||||
var obj = objs[i];
|
||||
var fullPath = pathModule.join(dir, obj);
|
||||
var fullPath = path.join(dir, obj);
|
||||
if (objs.length == 1) {
|
||||
var parentDir = pathModule.dirname(dir);
|
||||
var newPath = pathModule.join(parentDir, obj);
|
||||
var parentDir = path.dirname(dir);
|
||||
var newPath = path.join(parentDir, obj);
|
||||
fs.renameSync(fullPath, newPath);
|
||||
fs.rmdirSync(dir);
|
||||
} else {
|
||||
@ -680,17 +721,20 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, "."));
|
||||
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outModulesDir));
|
||||
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outDir));
|
||||
//aliasing pack-modules for backwards compatibility
|
||||
grunt.registerTask("pack-modules", [
|
||||
"compile-modules",
|
||||
"node-tests",
|
||||
"copy:modulesPackageDef",
|
||||
"exec:packModules"
|
||||
]);
|
||||
grunt.registerTask("pack-apps", [
|
||||
"processTestsApp:" + localCfg.outAppsTestsDir,
|
||||
"processEachApp:" + localCfg.outAppsDir
|
||||
]);
|
||||
grunt.registerTask("pack-ts-apps", [
|
||||
"processTestsApp:" + localCfg.outTsAppsTestsDir + ":-ts",
|
||||
"processEachApp:" + localCfg.outTsAppsDir + ":-ts"
|
||||
]);
|
||||
grunt.registerTask("get-ready-packages", [
|
||||
@ -711,7 +755,6 @@ module.exports = function(grunt) {
|
||||
"check-packagejson-boms",
|
||||
"compile-ts",
|
||||
"collect-modules-raw-files",
|
||||
"copy:modulesPackageDef",
|
||||
"copy:definitionFiles",
|
||||
"copy:jsLibs",
|
||||
"generate-tns-core-modules-dts",
|
||||
|
32
package.json
@ -1,26 +1,4 @@
|
||||
{
|
||||
"name": "tns-core-modules",
|
||||
"description": "Telerik NativeScript Core Modules",
|
||||
"version": "2.1.0",
|
||||
"homepage":"https://www.nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/NativeScript/NativeScript"
|
||||
},
|
||||
"files": [
|
||||
"**/*.d.ts",
|
||||
"**/*.js",
|
||||
"!android17.d.ts",
|
||||
"!ios.d.ts",
|
||||
"!bin/",
|
||||
"!apps/",
|
||||
"!build/",
|
||||
"!node-tests/",
|
||||
"!declarations.android.d.ts",
|
||||
"!declarations.ios.d.ts",
|
||||
"!gruntfile.js",
|
||||
"!org.nativescript.widgets.d.ts"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"chai": "3.2.0",
|
||||
@ -43,15 +21,5 @@
|
||||
"time-grunt": "1.3.0",
|
||||
"tslint": "3.4.0",
|
||||
"typescript": "1.8.2"
|
||||
},
|
||||
"typings": "tns-core-modules.d.ts",
|
||||
"dependencies": {
|
||||
"tns-core-modules-widgets": "next"
|
||||
},
|
||||
"nativescript": {
|
||||
"platforms": {
|
||||
"ios": "2.0.0",
|
||||
"android": "2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
41
tests/app/App_Resources/Android/AndroidManifest.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="__PACKAGE__"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="17"
|
||||
android:targetSdkVersion="__APILEVEL__"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:name="com.tns.NativeScriptApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="com.tns.NativeScriptActivity"
|
||||
android:label="@string/title_activity_kimera"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.tns.ErrorReportActivity"/>
|
||||
</application>
|
||||
</manifest>
|
15
tests/app/App_Resources/Android/app.gradle
Normal file
@ -0,0 +1,15 @@
|
||||
// Add your native dependencies here:
|
||||
|
||||
// Uncomment to add recyclerview-v7 dependency
|
||||
//dependencies {
|
||||
// compile 'com.android.support:recyclerview-v7:+'
|
||||
//}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
generatedDensities = []
|
||||
}
|
||||
aaptOptions {
|
||||
additionalParameters "--no-version-vectors"
|
||||
}
|
||||
}
|
BIN
tests/app/App_Resources/Android/drawable-hdpi/icon.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
tests/app/App_Resources/Android/drawable-ldpi/icon.png
Executable file
After Width: | Height: | Size: 6.0 KiB |
BIN
tests/app/App_Resources/Android/drawable-mdpi/icon.png
Executable file
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 26 KiB |
BIN
tests/app/App_Resources/iOS/Default-568h@2x.png
Executable file
After Width: | Height: | Size: 62 KiB |
BIN
tests/app/App_Resources/iOS/Default-667h@2x.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
tests/app/App_Resources/iOS/Default-736h@3x.png
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape-568h@2x.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape-667h@2x.png
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape.png
Executable file
After Width: | Height: | Size: 61 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape@2x.png
Executable file
After Width: | Height: | Size: 187 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape@3x.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
tests/app/App_Resources/iOS/Default-Portrait.png
Executable file
After Width: | Height: | Size: 60 KiB |
BIN
tests/app/App_Resources/iOS/Default-Portrait@2x.png
Executable file
After Width: | Height: | Size: 182 KiB |
BIN
tests/app/App_Resources/iOS/Default.png
Executable file
After Width: | Height: | Size: 20 KiB |
BIN
tests/app/App_Resources/iOS/Default@2x.png
Executable file
After Width: | Height: | Size: 61 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small-50.png
Executable file
After Width: | Height: | Size: 31 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small-50@2x.png
Executable file
After Width: | Height: | Size: 36 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small.png
Executable file
After Width: | Height: | Size: 29 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small@2x.png
Executable file
After Width: | Height: | Size: 31 KiB |
71
tests/app/App_Resources/iOS/Info.plist
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.png</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>icon-40</string>
|
||||
<string>icon-60</string>
|
||||
<string>icon-72</string>
|
||||
<string>icon-76</string>
|
||||
<string>Icon-Small</string>
|
||||
<string>Icon-Small-50</string>
|
||||
</array>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
5
tests/app/App_Resources/iOS/build.xcconfig
Normal file
@ -0,0 +1,5 @@
|
||||
// You can add custom settings here
|
||||
// for example you can uncomment the following line to force distribution code signing
|
||||
// CODE_SIGN_IDENTITY = iPhone Distribution
|
||||
// ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
// ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets;
|
BIN
tests/app/App_Resources/iOS/icon-40.png
Executable file
After Width: | Height: | Size: 30 KiB |
BIN
tests/app/App_Resources/iOS/icon-40@2x.png
Executable file
After Width: | Height: | Size: 34 KiB |
BIN
tests/app/App_Resources/iOS/icon-60.png
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
tests/app/App_Resources/iOS/icon-60@2x.png
Executable file
After Width: | Height: | Size: 39 KiB |
BIN
tests/app/App_Resources/iOS/icon-72.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
tests/app/App_Resources/iOS/icon-72@2x.png
Executable file
After Width: | Height: | Size: 41 KiB |
BIN
tests/app/App_Resources/iOS/icon-76.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
tests/app/App_Resources/iOS/icon-76@2x.png
Executable file
After Width: | Height: | Size: 43 KiB |
BIN
tests/app/App_Resources/iOS/icon.png
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
tests/app/App_Resources/iOS/icon@2x.png
Executable file
After Width: | Height: | Size: 38 KiB |
2
tests/app/App_Resources/package.json
Normal file
@ -0,0 +1,2 @@
|
||||
{ "name" : "app-resources",
|
||||
"main" : "dummy.js" }
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |