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:
parent
70fe990778
commit
29ab9d1e7a
|
@ -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,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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\')';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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\')';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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\')';
|
||||||
|
|
Loading…
Reference in New Issue