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

changes link file on Android to MainApplication.java for 0.29 update #8612

Closed
wants to merge 5 commits into from

Conversation

GantMan
Copy link
Contributor

@GantMan GantMan commented Jul 6, 2016

rnpm aka react-native link is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.

@ghost
Copy link

ghost commented Jul 6, 2016

By analyzing the blame information on this pull request, we identified @grabbou to be a potential reviewer.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jul 6, 2016
@GantMan
Copy link
Contributor Author

GantMan commented Jul 6, 2016

note, the methodology for checking the file is the latest method: http://stackoverflow.com/questions/4482686/check-synchronously-if-file-directory-exists-in-node-js

@satya164
Copy link
Contributor

satya164 commented Jul 6, 2016

cc @Kureev

@Kureev
Copy link
Contributor

Kureev commented Jul 6, 2016

Hi @GantMan! Thanks for proposing this PR! I have a few small questions in order to process it faster :)
As I see, you're checking for a MainApplication.java and "roll back" to MainActivity.java in a case if it's not found. But taking into account that rnpm is now a part of react-native cli, I don't think we have any reasons to maintain previous versions. Does it make any sense?

@GantMan
Copy link
Contributor Author

GantMan commented Jul 6, 2016

Hi @Kureev! My guess use case where someone would care is this: "I created project X in RN 0.28 and I created project Y in 0.29". I should be able to still work on my 0.28 project and even use react-native link to add new features to it. It shouldn't break functionality on my non-updated project. I might have good reason for not bringing it to 0.29 just yet.

@satya164
Copy link
Contributor

satya164 commented Jul 6, 2016

May be support old versions for few releases and then drop the support.

@GantMan
Copy link
Contributor Author

GantMan commented Jul 6, 2016

Yeah, ideal would be 3 phases.

  1. this goes through as hotfix.
  2. deprecate, and warn
  3. remove

I'm happy to help with all 3 steps.

@Kureev
Copy link
Contributor

Kureev commented Jul 7, 2016

@GantMan For your case with 0.28 & 0.29: if I understand correctly, app scaffolded by 0.28 will have a react-native@0.28 with current react-native link implementation under the hood. Same is fair for 0.29: it'll have a new 0.29 react-native with new link for MainApplication. The only controversial point is about react-native upgrade. Does it convert your MainActivity to MainApplication? If so, then I don't see a reason why we need prev. versions.

If 0.28 to 0.29 migration by using react-native upgrade wouldn't rename MainActivity to MainApplication, then we need to add it as a part of the migration (which is a desired behavior imo) or support N releases behind the last one (for react-native link).

userConfig.mainApplicationPath || `src/main/java/${packageFolder}/MainApplication.java`
);

fs.accessSync(mainApplicationPath, fs.F_OK, function(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be no callback (it's Sync):

try {
  fs.accessSync(mainApplicationPath, fs.F_OK);
} catch (e) {
  //...error
}
//...success

@satya164
Copy link
Contributor

satya164 commented Jul 7, 2016

if I understand correctly, app scaffolded by 0.28 will have a react-native@0.28 with current react-native link implementation under the hood

@Kureev is right. I forgot that the cli just forwards the commands to locally installed react-native. So we should not need check for older versions in the code.

@GantMan
Copy link
Contributor Author

GantMan commented Jul 7, 2016

I will update accordingly, you'll see code soon :)

@GantMan
Copy link
Contributor Author

GantMan commented Jul 7, 2016

@Kureev and @satya164 - Thanks for the feedback.

I wasn't sure what the userConfig variable should be, but I figured consistency with the internal name would be best. We don't want users setting userConfig.mainActivityPath and thinking that's correct.

I did a quick test, and upgrade from 0.28-> 0.29 does NOT create the application file. It's set as manual steps in the release: https://github.com/facebook/react-native/releases/tag/v0.29.0

@satya164
Copy link
Contributor

satya164 commented Jul 7, 2016

@GantMan Can you also update the commit title to reflect the actual change?

@GantMan GantMan changed the title adds check for 0.29 MainApplication.java changes link file on Android to MainApplication.java for 0.29 update Jul 7, 2016
@satya164
Copy link
Contributor

satya164 commented Jul 7, 2016

@GantMan Yes, react-native upgrade doesn't work for 0.28 -> 0.29 and it'll probably be very complex to fix this since we're using yeoman for this.

@GantMan
Copy link
Contributor Author

GantMan commented Jul 7, 2016

@satya164 - title is updated.

Hah yes, yeoman is quite tricky. Fortunately it's a separate concern. I was just checking for @Kureev as he seemed to inquire specifically on this upgrade path. Let me know if there's more on this ticket that needs attention.

@Kureev
Copy link
Contributor

Kureev commented Jul 7, 2016

I don't think there is anything else. Seems you covered everything, @GantMan 😉

@Kureev
Copy link
Contributor

Kureev commented Jul 7, 2016

So, I'm going to check it on my local machine today and if everything is fine, I'm about to merge it

@grabbou
Copy link
Contributor

grabbou commented Jul 7, 2016

Great work! I like it. Another thing is that we remove mainActivityPath now, which could potentially break plugins, but since there's no need to use main activity anymore on the Android side, I think it's fine.

@Kureev
Copy link
Contributor

Kureev commented Jul 8, 2016

@facebook-github-bot shipit

@ghost
Copy link

ghost commented Jul 8, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in c3f4d79 Jul 8, 2016
@grabbou
Copy link
Contributor

grabbou commented Jul 10, 2016

@mkonicek shall we release a 0.29.1 and also cherry-pick that into 0.30rc? @Kureev

@satya164
Copy link
Contributor

@grabbou There was a bug in InteractionManager which we should also include. cc @sahrens

@grabbou
Copy link
Contributor

grabbou commented Jul 10, 2016

@satya164 into the 0.29 or 0.30 branch?

@satya164
Copy link
Contributor

@grabbou Both

@grabbou
Copy link
Contributor

grabbou commented Jul 10, 2016

Ping me on Messagner later just in case

@satya164
Copy link
Contributor

@grabbou Will do. Waiting for @sahrens to push it into OSS. He said the fix is up internally.

@sahrens
Copy link
Contributor

sahrens commented Jul 10, 2016

Sorry, still waiting on review. If you need to patch locally, the fix is a one-liner, just change the filter call in TaskQueue#cancelTasks from .filter((queue) => queue.tasks.length > 0); to:

.filter((queue, idx) => (queue.tasks.length > 0 || idx === 0));

grabbou pushed a commit that referenced this pull request Jul 13, 2016
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes #8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
@Kureev
Copy link
Contributor

Kureev commented Jul 15, 2016

We missed one change here! Since we renamed mainActivityPath to mainFilePath, it should be also changed in the userConfig object. Want to hotfix, @GantMan?

@Kureev
Copy link
Contributor

Kureev commented Jul 15, 2016

Seems this is a real scope of the change: https://github.com/facebook/react-native/search?utf8=%E2%9C%93&q=mainActivityPath. Hopefully, it's just about

find . -name '*.js' -type f -exec sed -i '' 's/mainActivityPath/mainFilePath/g' {} +

@Kureev
Copy link
Contributor

Kureev commented Jul 15, 2016

see referenced PR for more info.

@rclai
Copy link
Contributor

rclai commented Jul 15, 2016

Glad to know I wasn't insane. When are you guys going to finish fixing this?

@GantMan
Copy link
Contributor Author

GantMan commented Jul 16, 2016

Looks good @Kureev.

@rclai - look at PR #8807

Let me know if I can help any further.

@GantMan GantMan deleted the fix_npm_link branch July 16, 2016 00:40
ghost pushed a commit that referenced this pull request Jul 16, 2016
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
grabbou pushed a commit that referenced this pull request Jul 17, 2016
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
grabbou pushed a commit that referenced this pull request Jul 21, 2016
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
grabbou pushed a commit that referenced this pull request Jul 21, 2016
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes #8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
samerce pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - facebook#8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes facebook#8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
samerce pushed a commit to iodine/react-native that referenced this pull request Aug 23, 2016
Summary:
Attempt to fix facebook#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 facebook#8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - facebook#8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes facebook#8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
Attempt to fix facebook#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 facebook#8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes facebook/react-native#8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
Attempt to fix facebook/react-native#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 facebook/react-native#8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
tungdo194 pushed a commit to tungdo194/rn-test that referenced this pull request Apr 28, 2024
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes facebook/react-native#8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
tungdo194 pushed a commit to tungdo194/rn-test that referenced this pull request Apr 28, 2024
Summary:
Attempt to fix facebook/react-native#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 facebook/react-native#8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants