Fix native modules linking in 0.29.1

Summary:
Attempt to fix https://github.com/facebook/react-native/pull/8612

We re-named `mainActivityPath` by `mainFilePath` in the `link` code, but we forgot to rename config parameters. Currently, link is broken.

- [x] `react-native link` should work for react-native 0.29+
Closes https://github.com/facebook/react-native/pull/8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
This commit is contained in:
Kureev Alexey 2016-07-16 10:52:38 -07:00 committed by Mike Grabowski
parent 70fe990778
commit 29ab9d1e7a
9 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
module.exports = function makeImportPatch(packageImportPath) { module.exports = function makeImportPatch(packageImportPath) {
return { return {
pattern: 'import com.facebook.react.ReactActivity;', pattern: 'import com.facebook.react.ReactApplication;',
patch: '\n' + packageImportPath, patch: '\n' + packageImportPath,
}; };
}; };

View File

@ -27,12 +27,12 @@ module.exports = function registerNativeAndroidModule(
applyPatch(projectConfig.stringsPath, makeStringsPatch(params, name)); applyPatch(projectConfig.stringsPath, makeStringsPatch(params, name));
applyPatch( applyPatch(
projectConfig.mainActivityPath, projectConfig.mainFilePath,
makePackagePatch(androidConfig.packageInstance, params, name) makePackagePatch(androidConfig.packageInstance, params, name)
); );
applyPatch( applyPatch(
projectConfig.mainActivityPath, projectConfig.mainFilePath,
makeImportPatch(androidConfig.packageImportPath) makeImportPatch(androidConfig.packageImportPath)
); );
}; };

View File

@ -36,12 +36,12 @@ module.exports = function unregisterNativeAndroidModule(
revokePatch(projectConfig.stringsPath, makeStringsPatch(params, name)); revokePatch(projectConfig.stringsPath, makeStringsPatch(params, name));
revokePatch( revokePatch(
projectConfig.mainActivityPath, projectConfig.mainFilePath,
makePackagePatch(androidConfig.packageInstance, params, name) makePackagePatch(androidConfig.packageInstance, params, name)
); );
revokePatch( revokePatch(
projectConfig.mainActivityPath, projectConfig.mainFilePath,
makeImportPatch(androidConfig.packageImportPath) makeImportPatch(androidConfig.packageImportPath)
); );
}; };

View File

@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.17/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageImportPath = 'import some.example.project'; const packageImportPath = 'import some.example.project';

View File

@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.17/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')'; const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';

View File

@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.18/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageImportPath = 'import some.example.project'; const packageImportPath = 'import some.example.project';

View File

@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.18/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')'; const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';

View File

@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.20/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageImportPath = 'import some.example.project'; const packageImportPath = 'import some.example.project';

View File

@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.20/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch'); const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = { const projectConfig = {
mainActivityPath: 'MainActivity.java', mainFilePath: 'MainActivity.java',
}; };
const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')'; const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';