Skip to content

Commit 1335dc1

Browse files
gengjiawenfacebook-github-bot
authored andcommitted
fix ci path problem on Windows (facebook#21203)
Summary: fix ci path problem on Windows pass all current ci. none [GENERAL] [INTERNAL] [CI] - fix ci path problem on Windows Pull Request resolved: facebook#21203 Differential Revision: D9943608 Pulled By: hramos fbshipit-source-id: 66e3e196a6c0015e0472851abeee32de9fef140c
1 parent 533f5ad commit 1335dc1

File tree

5 files changed

+587
-695
lines changed

5 files changed

+587
-695
lines changed

local-cli/bundle/__tests__/getAssetDestPathAndroid-test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jest.dontMock('../getAssetDestPathAndroid').dontMock('../assetPathUtils');
1414

1515
const getAssetDestPathAndroid = require('../getAssetDestPathAndroid');
1616

17+
const path = require('path');
18+
1719
describe('getAssetDestPathAndroid', () => {
1820
it('should use the right destination folder', () => {
1921
const asset = {
@@ -45,7 +47,7 @@ describe('getAssetDestPathAndroid', () => {
4547
};
4648

4749
expect(getAssetDestPathAndroid(asset, 1)).toBe(
48-
'drawable-mdpi/app_test_icon.png',
50+
path.normalize('drawable-mdpi/app_test_icon.png'),
4951
);
5052
});
5153

@@ -66,6 +68,6 @@ describe('getAssetDestPathAndroid', () => {
6668
httpServerLocation: '/assets/app/test',
6769
};
6870

69-
expect(getAssetDestPathAndroid(asset, 1)).toBe('raw/app_test_video.mp4');
71+
expect(getAssetDestPathAndroid(asset, 1)).toBe(path.normalize('raw/app_test_video.mp4'));
7072
});
7173
});

local-cli/bundle/__tests__/getAssetDestPathIOS-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
jest.dontMock('../getAssetDestPathIOS');
1414

1515
const getAssetDestPathIOS = require('../getAssetDestPathIOS');
16+
const path = require('path');
1617

1718
describe('getAssetDestPathIOS', () => {
1819
it('should build correct path', () => {
@@ -22,7 +23,7 @@ describe('getAssetDestPathIOS', () => {
2223
httpServerLocation: '/assets/test',
2324
};
2425

25-
expect(getAssetDestPathIOS(asset, 1)).toBe('assets/test/icon.png');
26+
expect(getAssetDestPathIOS(asset, 1)).toBe(path.normalize('assets/test/icon.png'));
2627
});
2728

2829
it('should consider scale', () => {
@@ -32,7 +33,7 @@ describe('getAssetDestPathIOS', () => {
3233
httpServerLocation: '/assets/test',
3334
};
3435

35-
expect(getAssetDestPathIOS(asset, 2)).toBe('assets/test/[email protected]');
36-
expect(getAssetDestPathIOS(asset, 3)).toBe('assets/test/[email protected]');
36+
expect(getAssetDestPathIOS(asset, 2)).toBe(path.normalize('assets/test/[email protected]'));
37+
expect(getAssetDestPathIOS(asset, 3)).toBe(path.normalize('assets/test/[email protected]'));
3738
});
3839
});

local-cli/link/__tests__/ios/getPlistPath.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ describe('ios::getPlistPath', () => {
2525

2626
it('should return path without Xcode $(SRCROOT)', () => {
2727
const plistPath = getPlistPath(project, '/');
28-
expect(plistPath).toBe('/Basic/Info.plist');
28+
expect(plistPath).toBe(path.normalize('/Basic/Info.plist'));
2929
});
3030
});

local-cli/link/android/patches/makeSettingsPatch.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
const path = require('path');
1111
const normalizeProjectName = require('./normalizeProjectName');
1212

13-
const isWin = process.platform === 'win32';
14-
1513
module.exports = function makeSettingsPatch(
1614
name,
1715
androidConfig,
@@ -23,16 +21,6 @@ module.exports = function makeSettingsPatch(
2321
);
2422
const normalizedProjectName = normalizeProjectName(name);
2523

26-
/*
27-
* Fix for Windows
28-
* Backslashes is the escape character and will result in
29-
* an invalid path in settings.gradle
30-
* https://github.com/rnpm/rnpm/issues/113
31-
*/
32-
if (isWin) {
33-
projectDir = projectDir.replace(/\\/g, '/');
34-
}
35-
3624
return {
3725
pattern: '\n',
3826
patch:

0 commit comments

Comments
 (0)