Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci path problem on Windows #21203

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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/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'));
});
});
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