Files
react-native/local-cli/rnpm/link/src/android/registerNativeModule.js
T
Kureev Alexey 1e1d34a236 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
2016-07-21 09:54:38 +02:00

39 lines
1.2 KiB
JavaScript

const fs = require('fs');
const getReactVersion = require('../getReactNativeVersion');
const getPrefix = require('./getPrefix');
const applyPatch = require('./patches/applyPatch');
const makeStringsPatch = require('./patches/makeStringsPatch');
const makeSettingsPatch = require(`./patches/makeSettingsPatch`);
const makeBuildPatch = require(`./patches/makeBuildPatch`);
module.exports = function registerNativeAndroidModule(
name,
androidConfig,
params,
projectConfig
) {
const buildPatch = makeBuildPatch(name);
const prefix = getPrefix(getReactVersion(projectConfig.folder));
const makeImportPatch = require(`./${prefix}/makeImportPatch`);
const makePackagePatch = require(`./${prefix}/makePackagePatch`);
applyPatch(
projectConfig.settingsGradlePath,
makeSettingsPatch(name, androidConfig, projectConfig)
);
applyPatch(projectConfig.buildGradlePath, buildPatch);
applyPatch(projectConfig.stringsPath, makeStringsPatch(params, name));
applyPatch(
projectConfig.mainFilePath,
makePackagePatch(androidConfig.packageInstance, params, name)
);
applyPatch(
projectConfig.mainFilePath,
makeImportPatch(androidConfig.packageImportPath)
);
};