-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Fixes hasProperty returning true even when there's an empty getter. #14811
Conversation
Fixes: #14810 Problem described in more detail here: https://stackoverflow.com/questions/43967489/could-not-get-unknown-property-repositoryurl-for-project
@SudoPlz I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Closing because no reviewers have been found is not a good reason to close this. |
Summary: We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project. ```` To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property. Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set: ```` def getRepositoryUrl() { if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl')) return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } ```` Then I ran gradle with "repositoryUrl" set like this (passing the property): ```` ./gradlew -PrepositoryUrl=blah assembleDebug ```` As expected, it detected that "repositoryUrl" was set and threw an exception: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > blah ```` The same issue has been reported before - #14811, #14810 Minor changes in the Android build script Closes #18075 Differential Revision: D7077788 Pulled By: hramos fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
Summary: We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project. ```` To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property. Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set: ```` def getRepositoryUrl() { if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl')) return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } ```` Then I ran gradle with "repositoryUrl" set like this (passing the property): ```` ./gradlew -PrepositoryUrl=blah assembleDebug ```` As expected, it detected that "repositoryUrl" was set and threw an exception: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > blah ```` The same issue has been reported before - facebook#14811, facebook#14810 Minor changes in the Android build script Closes facebook#18075 Differential Revision: D7077788 Pulled By: hramos fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
Summary: We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project. ```` To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property. Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set: ```` def getRepositoryUrl() { if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl')) return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } ```` Then I ran gradle with "repositoryUrl" set like this (passing the property): ```` ./gradlew -PrepositoryUrl=blah assembleDebug ```` As expected, it detected that "repositoryUrl" was set and threw an exception: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > blah ```` The same issue has been reported before - facebook#14811, facebook#14810 Minor changes in the Android build script Closes facebook#18075 Differential Revision: D7077788 Pulled By: hramos fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
Summary: We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project. ```` To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property. Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set: ```` def getRepositoryUrl() { if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl')) return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } ```` Then I ran gradle with "repositoryUrl" set like this (passing the property): ```` ./gradlew -PrepositoryUrl=blah assembleDebug ```` As expected, it detected that "repositoryUrl" was set and threw an exception: ```` * What went wrong: A problem occurred configuring project ':ContextMenuAndroid'. > Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'. > A problem occurred configuring project ':ReactAndroid'. > blah ```` The same issue has been reported before - facebook#14811, facebook#14810 Minor changes in the Android build script Closes facebook#18075 Differential Revision: D7077788 Pulled By: hramos fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
Fixes: #14810
Problem described in more detail here: https://stackoverflow.com/questions/43967489/could-not-get-unknown-property-repositoryurl-for-project