Skip to content

Commit

Permalink
fix ci path problem on Windows (facebook#21203)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gengjiawen authored and facebook-github-bot committed Sep 19, 2018
1 parent 533f5ad commit 1335dc1
Show file tree
Hide file tree
Showing 5 changed files with 587 additions and 695 deletions.
6 changes: 4 additions & 2 deletions local-cli/bundle/__tests__/getAssetDestPathAndroid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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'),
);
});

Expand All @@ -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'));
});
});
7 changes: 4 additions & 3 deletions local-cli/bundle/__tests__/getAssetDestPathIOS-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
jest.dontMock('../getAssetDestPathIOS');

const getAssetDestPathIOS = require('../getAssetDestPathIOS');
const path = require('path');

describe('getAssetDestPathIOS', () => {
it('should build correct path', () => {
Expand All @@ -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', () => {
Expand All @@ -32,7 +33,7 @@ describe('getAssetDestPathIOS', () => {
httpServerLocation: '/assets/test',
};

expect(getAssetDestPathIOS(asset, 2)).toBe('assets/test/[email protected]');
expect(getAssetDestPathIOS(asset, 3)).toBe('assets/test/[email protected]');
expect(getAssetDestPathIOS(asset, 2)).toBe(path.normalize('assets/test/[email protected]'));
expect(getAssetDestPathIOS(asset, 3)).toBe(path.normalize('assets/test/[email protected]'));
});
});
2 changes: 1 addition & 1 deletion local-cli/link/__tests__/ios/getPlistPath.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
});
12 changes: 0 additions & 12 deletions local-cli/link/android/patches/makeSettingsPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
const path = require('path');
const normalizeProjectName = require('./normalizeProjectName');

const isWin = process.platform === 'win32';

module.exports = function makeSettingsPatch(
name,
androidConfig,
Expand All @@ -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:
Expand Down
Loading

0 comments on commit 1335dc1

Please sign in to comment.