Skip to content

Commit

Permalink
Fix native modules linking in 0.29.1
Browse files Browse the repository at this point in the history
Summary:
Attempt to fix #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 #8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
  • Loading branch information
Kureev Alexey authored and Facebook Github Bot 5 committed Jul 16, 2016
1 parent 9e142a1 commit 3c8a2ee
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function makeImportPatch(packageImportPath) {
return {
pattern: 'import com.facebook.react.ReactActivity;',
pattern: 'import com.facebook.react.ReactApplication;',
patch: '\n' + packageImportPath,
};
};
4 changes: 2 additions & 2 deletions local-cli/rnpm/link/src/android/registerNativeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ module.exports = function registerNativeAndroidModule(
applyPatch(projectConfig.stringsPath, makeStringsPatch(params, name));

applyPatch(
projectConfig.mainActivityPath,
projectConfig.mainFilePath,
makePackagePatch(androidConfig.packageInstance, params, name)
);

applyPatch(
projectConfig.mainActivityPath,
projectConfig.mainFilePath,
makeImportPatch(androidConfig.packageImportPath)
);
};
4 changes: 2 additions & 2 deletions local-cli/rnpm/link/src/android/unregisterNativeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ module.exports = function unregisterNativeAndroidModule(
revokePatch(projectConfig.stringsPath, makeStringsPatch(params, name));

revokePatch(
projectConfig.mainActivityPath,
projectConfig.mainFilePath,
makePackagePatch(androidConfig.packageInstance, params, name)
);

revokePatch(
projectConfig.mainActivityPath,
projectConfig.mainFilePath,
makeImportPatch(androidConfig.packageImportPath)
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.17/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageImportPath = 'import some.example.project';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.17/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.18/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageImportPath = 'import some.example.project';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.18/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makeImportPatch = require('../../../../src/android/patches/0.20/makeImport
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageImportPath = 'import some.example.project';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const makePackagePatch = require('../../../../src/android/patches/0.20/makePacka
const applyPatch = require('../../../../src/android/patches/applyPatch');

const projectConfig = {
mainActivityPath: 'MainActivity.java',
mainFilePath: 'MainActivity.java',
};

const packageInstance = 'new SomeLibrary(${foo}, ${bar}, \'something\')';
Expand Down

4 comments on commit 3c8a2ee

@greenteamer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for your work, @Kureev!
Can you tell me how i can apply this changes for my existing project?

@Kureev
Copy link
Contributor

@Kureev Kureev commented on 3c8a2ee Jul 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @greenteamer! I think @grabbou is working on 0.29.2 release 👍

@greenteamer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ) ok!! thank you )

@grabbou
Copy link
Contributor

@grabbou grabbou commented on 3c8a2ee Jul 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle build failed, I've restarted, should be on npm in like an hour :) I'll tweet as soon as it's available.

Please sign in to comment.