fix: use relative paths for gradle exec invocations#36076
Closed
shivenmian wants to merge 1 commit intofacebook:mainfrom
Closed
fix: use relative paths for gradle exec invocations#36076shivenmian wants to merge 1 commit intofacebook:mainfrom
shivenmian wants to merge 1 commit intofacebook:mainfrom
Conversation
Contributor
|
Thanks for sending this over @shivenmian and for investigating this. I'll import this but we'll need some changes as I'd like to have relative paths only on Windows. I'll take care of this. |
Contributor
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
|
Hi @shivenmian, could you please log into |
af8a8a4 to
a0cb9d8
Compare
Author
|
@cipolleschi done |
cortinico
pushed a commit
to cortinico/react-native
that referenced
this pull request
Feb 7, 2023
…36076) Summary: For Android release builds on Windows, gradle release build fails if there are spaces in path (facebook#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: facebook#36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: d245b2e92e1bd4cde8f12cdb2789913bdfee70a9
Contributor
|
I'm following up here #36080 as I had to re-export this PR 👍 If the CI is green we should be good to go |
Contributor
|
@cortinico merged this pull request in bb02ccf. |
cipolleschi
pushed a commit
that referenced
this pull request
Feb 13, 2023
Summary: Pull Request resolved: #36080 For Android release builds on Windows, gradle release build fails if there are spaces in path (#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself. As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work. ## Changelog [Android][Fixed] - Used relative paths for gradle commands Pull Request resolved: #36076 Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag). Reviewed By: cipolleschi Differential Revision: D43080177 Pulled By: cortinico fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For Android release builds on Windows, gradle release build fails if there are spaces in path (#34878). This is due to gradle improperly handling arguments with spaces (this is also an open issue on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself.
As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work.
Changelog
[Android][Fixed] - Used relative paths for gradle commands
Test Plan
npx react-native run-androidbuilds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the--variant=releaseflag).