fix ci path problem on Windows (#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: https://github.com/facebook/react-native/pull/21203

Differential Revision: D9943608

Pulled By: hramos

fbshipit-source-id: 66e3e196a6c0015e0472851abeee32de9fef140c
This commit is contained in:
gengjiawen 2018-09-19 10:42:05 -07:00 committed by Facebook Github Bot
parent ea124a044c
commit 58fe324163
5 changed files with 578 additions and 686 deletions

View File

@ -14,6 +14,8 @@ jest.dontMock('../getAssetDestPathAndroid').dontMock('../assetPathUtils');
const getAssetDestPathAndroid = require('../getAssetDestPathAndroid');
const path = require('path');
describe('getAssetDestPathAndroid', () => {
it('should use the right destination folder', () => {
const asset = {
@ -45,7 +47,7 @@ describe('getAssetDestPathAndroid', () => {
};
expect(getAssetDestPathAndroid(asset, 1)).toBe(
'drawable-mdpi/app_test_icon.png',
path.normalize('drawable-mdpi/app_test_icon.png'),
);
});
@ -66,6 +68,6 @@ describe('getAssetDestPathAndroid', () => {
httpServerLocation: '/assets/app/test',
};
expect(getAssetDestPathAndroid(asset, 1)).toBe('raw/app_test_video.mp4');
expect(getAssetDestPathAndroid(asset, 1)).toBe(path.normalize('raw/app_test_video.mp4'));
});
});

View File

@ -13,6 +13,7 @@
jest.dontMock('../getAssetDestPathIOS');
const getAssetDestPathIOS = require('../getAssetDestPathIOS');
const path = require('path');
describe('getAssetDestPathIOS', () => {
it('should build correct path', () => {
@ -22,7 +23,7 @@ describe('getAssetDestPathIOS', () => {
httpServerLocation: '/assets/test',
};
expect(getAssetDestPathIOS(asset, 1)).toBe('assets/test/icon.png');
expect(getAssetDestPathIOS(asset, 1)).toBe(path.normalize('assets/test/icon.png'));
});
it('should consider scale', () => {
@ -32,7 +33,7 @@ describe('getAssetDestPathIOS', () => {
httpServerLocation: '/assets/test',
};
expect(getAssetDestPathIOS(asset, 2)).toBe('assets/test/icon@2x.png');
expect(getAssetDestPathIOS(asset, 3)).toBe('assets/test/icon@3x.png');
expect(getAssetDestPathIOS(asset, 2)).toBe(path.normalize('assets/test/icon@2x.png'));
expect(getAssetDestPathIOS(asset, 3)).toBe(path.normalize('assets/test/icon@3x.png'));
});
});

View File

@ -25,6 +25,6 @@ describe('ios::getPlistPath', () => {
it('should return path without Xcode $(SRCROOT)', () => {
const plistPath = getPlistPath(project, '/');
expect(plistPath).toBe('/Basic/Info.plist');
expect(plistPath).toBe(path.normalize('/Basic/Info.plist'));
});
});

View File

@ -10,8 +10,6 @@
const path = require('path');
const normalizeProjectName = require('./normalizeProjectName');
const isWin = process.platform === 'win32';
module.exports = function makeSettingsPatch(
name,
androidConfig,
@ -23,16 +21,6 @@ module.exports = function makeSettingsPatch(
);
const normalizedProjectName = normalizeProjectName(name);
/*
* Fix for Windows
* Backslashes is the escape character and will result in
* an invalid path in settings.gradle
* https://github.com/rnpm/rnpm/issues/113
*/
if (isWin) {
projectDir = projectDir.replace(/\\/g, '/');
}
return {
pattern: '\n',
patch:

1237
yarn.lock

File diff suppressed because it is too large Load Diff