Skip to content

Commit 21cac17

Browse files
committed
Fix (publish): Remove binary-plist and use simple-plist instead
In case when produced Info.plist is not a binary file, `tns publish ios` command fails because `bplist-parser` is not able to parse non-binary plist files. This PR replaces `bplist-parser` module with `sample-plist` that is able to parse binary and non-binary files. Fixes #3470
1 parent 4948f83 commit 21cac17

7 files changed

+7
-16
lines changed

lib/definitions/simple-plist.d.ts

-4
This file was deleted.

lib/services/ios-project-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import * as plist from "plist";
1313
import { IOSProvisionService } from "./ios-provision-service";
1414
import { IOSEntitlementsService } from "./ios-entitlements-service";
1515
import { XCConfigService } from "./xcconfig-service";
16-
import * as simplePlist from "simple-plist";
1716
import * as mobileprovision from "ios-mobileprovision-finder";
1817
import { SpawnOptions } from "child_process";
1918
import { BUILD_XCCONFIG_FILE_NAME } from "../constants";
@@ -51,6 +50,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
5150
private $xcode: IXcode,
5251
private $iOSEntitlementsService: IOSEntitlementsService,
5352
private $platformEnvironmentRequirements: IPlatformEnvironmentRequirements,
53+
private $plistParser: IPlistParser,
5454
private $sysInfo: ISysInfo,
5555
private $xCConfigService: XCConfigService) {
5656
super($fs, $projectDataService);
@@ -1045,7 +1045,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10451045
this.$errors.failWithoutHelp("The bundle at %s does not contain an Info.plist file.", libraryPath);
10461046
}
10471047

1048-
const plistJson = simplePlist.readFileSync(infoPlistPath);
1048+
const plistJson = this.$plistParser.parseFileSync(infoPlistPath);
10491049
const packageType = plistJson["CFBundlePackageType"];
10501050

10511051
if (packageType !== "FMWK") {

lib/services/itmstransporter-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class ITMSTransporterService implements IITMSTransporterService {
1010
private _itunesConnectApplications: IiTunesConnectApplication[] = null;
1111
private _bundleIdentifier: string = null;
1212

13-
constructor(private $bplistParser: IBinaryPlistParser,
13+
constructor(private $plistParser: IPlistParser,
1414
private $childProcess: IChildProcess,
1515
private $errors: IErrors,
1616
private $fs: IFileSystem,
@@ -135,8 +135,8 @@ export class ITMSTransporterService implements IITMSTransporterService {
135135
}
136136
const appFile = path.join(payloadDir, allApps[0]);
137137

138-
const plistObject = await this.$bplistParser.parseFile(path.join(appFile, INFO_PLIST_FILE_NAME));
139-
const bundleId = plistObject && plistObject[0] && plistObject[0].CFBundleIdentifier;
138+
const plistObject = await this.$plistParser.parseFile(path.join(appFile, INFO_PLIST_FILE_NAME));
139+
const bundleId = plistObject && plistObject.CFBundleIdentifier;
140140
if (!bundleId) {
141141
this.$errors.failWithoutHelp(`Unable to determine bundle identifier from ${ipaFileFullPath}.`);
142142
}

npm-shrinkwrap.json

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
],
3232
"dependencies": {
3333
"@types/ora": "1.3.2",
34-
"bplist-parser": "0.1.0",
3534
"bufferpack": "0.0.6",
3635
"byline": "4.2.1",
3736
"chalk": "1.1.0",

test/ios-project-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function createTestInjector(projectPath: string, projectName: string): IInjector
120120
testInjector.register("settingsService", SettingsService);
121121
testInjector.register("httpClient", {});
122122
testInjector.register("platformEnvironmentRequirements", {});
123+
testInjector.register("plistParser", {});
123124

124125
return testInjector;
125126
}

0 commit comments

Comments
 (0)