Skip to content

Commit d9efa13

Browse files
committed
fixes:
- add exception for nativescript-wikitude - make builds platform specific (only ios on mac, only android if not on mac) - update for new NG template structure - update iOS certificate (expires Aug 2019) - update output to have only one platform
1 parent 250f485 commit d9efa13

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

lib/project.service.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ const exceptions = {
8181
],
8282
"configuration_version": "1"
8383
}`
84-
}
84+
},
85+
'nativescript-wikitude': {
86+
command: 'sed -i -- \'s/defaultConfig ./defaultConfig {\\n minSdkVersion 19/g\' app/App_Resources/Android/app.gradle'
87+
},
8588
};
8689

8790
export namespace ProjectService {
@@ -159,17 +162,18 @@ export namespace ProjectService {
159162
}
160163

161164
async function testPlugin(plugin: MarketplaceService.PluginModel, options: { android?: string, ios?: string }) {
162-
const result = { android: false, ios: false };
165+
const result: { android?: boolean, ios?: boolean } = {};
166+
const isDarwin = process.platform === 'darwin';
163167
let skipBuild = false;
164168
try {
165-
skipBuild = !plugin.badges || (!plugin.badges.androidVersion && plugin.badges.iosVersion);
169+
skipBuild = isDarwin || !plugin.badges || (!plugin.badges.androidVersion && plugin.badges.iosVersion);
166170
if (!skipBuild && options.android) {
167171
result.android = !!(await _buildProject(testProject, 'android', options.android));
168172
} else {
169173
Logger.error('Skipping android build! Plugin only has ios support or no options supplied.');
170174
}
171175

172-
skipBuild = !plugin.badges || (!plugin.badges.iosVersion && plugin.badges.androidVersion);
176+
skipBuild = !isDarwin || !plugin.badges || (!plugin.badges.iosVersion && plugin.badges.androidVersion);
173177
if (!skipBuild && options.ios) {
174178
result.ios = !!(await _buildProject(testProject, 'ios', options.ios));
175179
} else {
@@ -185,7 +189,8 @@ export namespace ProjectService {
185189
Logger.log(`building project for ${platform} ...`);
186190
const cwd = path.join(testDirectory, projectName);
187191
if (platform === 'ios' && cloudEnabled) {
188-
options += ' --provision /tns-official/CodeSign/ios/Icenium_QA_Development.mobileprovision --certificate /tns-official/CodeSign/ios/iPhone\\ Developer\\ Dragon\\ Telerikov\\ \\(GNKAEXW8YQ\\).p12 --certificatePassword 1';
192+
// TODO: change this after it expires in August 2019
193+
options += ' --provision /tns-official/CodeSign/ios/Icenium_QA_Development.mobileprovision --certificate /tns-official/CodeSign/ios/iPhone\\ Developer\\ Dragon\\ Telerikov\\ \\(R58QAA9NR8\\).p12 --certificatePassword 1';
189194
}
190195
const command = cloudEnabled ? `tns cloud build ${platform} --accountId 1 ${options}` : `tns build ${platform} ${options}`;
191196
const result = await execPromise(cwd, command);
@@ -231,7 +236,7 @@ export namespace ProjectService {
231236
const name = plugin.name;
232237

233238
try {
234-
const packagePath = path.join(appRoot, 'app', 'package.json');
239+
const packagePath = path.join(appRoot, 'src', 'package.json');
235240
let packageJson = readFileSync(packagePath, 'utf8');
236241
packageJson = packageJson.replace('"android": {', `"android": {\n"requireModules": ["${name}"],`);
237242
if (packageJson.indexOf(name) === -1) {
@@ -243,7 +248,7 @@ export namespace ProjectService {
243248
}
244249

245250
try {
246-
const mainTsPath = path.join(appRoot, 'app', 'home', 'home.component.ts');
251+
const mainTsPath = path.join(appRoot, 'src', 'app', 'home', 'home.component.ts');
247252
let mainTs = readFileSync(mainTsPath, 'utf8');
248253
if (plugin.badges && plugin.badges.typings) {
249254
mainTs = `import * as testPlugin from '${name}';\n` + mainTs;
@@ -263,10 +268,12 @@ export namespace ProjectService {
263268
async function _copyTestProject(name: string) {
264269
const newPath = path.join(testDirectory, name);
265270
if (existsSync(newPath)) {
271+
Logger.log('Removing old test directory...');
266272
await _removeDirectory(newPath);
267273
}
268274

269275
ncp.limit = 16;
276+
Logger.log('Creating new test directory...');
270277
return new Promise((resolve, reject) => {
271278
ncp(path.join(testDirectory, testProject + testProjectOriginalSuffix), newPath, err => {
272279
return err ? reject(err) : resolve();

0 commit comments

Comments
 (0)