diff options
author | 2018-02-07 09:53:09 -0800 | |
---|---|---|
committer | 2018-02-07 09:54:41 -0800 | |
commit | deda4a67f661596dfe793af75a5d50b5ef5467f2 (patch) | |
tree | 6a3a6eae9e3249c59df8db864c972ad06e793683 /src | |
parent | fd3e2e90a18b6f63b537a6531de21e714cf0d98b (diff) |
Improved invalid/unsupported NDK revision warning message.
Suggestion from @angersson on GitHub: https://github.com/bazelbuild/bazel/issues/4068#issuecomment-347627252
GITHUB: https://github.com/bazelbuild/bazel/issues/4068
RELNOTES: Improved clarity of warning message for unsupported NDK revisions.
PiperOrigin-RevId: 184852316
Diffstat (limited to 'src')
2 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java index 1e4e9b4e82..0f39042e49 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryFunction.java @@ -175,17 +175,21 @@ public class AndroidNdkRepositoryFunction extends AndroidRepositoryFunction { String warningMessage = String.format( "The revision of the Android NDK referenced by android_ndk_repository rule '%s' " - + "could not be determined (the revision string found is '%s'). Defaulting to " - + "revision %s.", - ruleName, ndkRelease.rawRelease, AndroidNdkCrosstools.LATEST_KNOWN_REVISION.getKey()); + + "could not be determined (the revision string found is '%s'). " + + "Bazel will attempt to treat the NDK as if it was r%s. This may cause " + + "compilation and linkage problems. Please download a supported NDK version.\n", + ruleName, + ndkRelease.rawRelease, + AndroidNdkCrosstools.LATEST_KNOWN_REVISION.getKey()); env.getListener().handle(Event.warn(warningMessage)); ndkMajorRevision = AndroidNdkCrosstools.LATEST_KNOWN_REVISION.getValue(); } else if (!AndroidNdkCrosstools.isKnownNDKRevision(ndkRelease)) { String warningMessage = String.format( "The major revision of the Android NDK referenced by android_ndk_repository rule " - + "'%s' is %s. The major revisions supported by Bazel are %s. Defaulting to " - + "revision %s.", + + "'%s' is %s. The major revisions supported by Bazel are %s. Bazel will attempt " + + "to treat the NDK as if it was r%s. This may cause compilation and linkage " + + "problems. Please download a supported NDK version.\n", ruleName, ndkRelease.majorRevision, AndroidNdkCrosstools.KNOWN_NDK_MAJOR_REVISIONS.keySet(), diff --git a/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryTest.java b/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryTest.java index 3518fbc216..c2bfad33eb 100644 --- a/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidNdkRepositoryTest.java @@ -102,7 +102,7 @@ public class AndroidNdkRepositoryTest extends BuildViewTestCase { eventCollector, "The revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' " + "could not be determined (the revision string found is 'not a valid release string')." - + " Defaulting to revision 14."); + + " Bazel will attempt to treat the NDK as if it was r14."); } @Test @@ -128,7 +128,7 @@ public class AndroidNdkRepositoryTest extends BuildViewTestCase { eventCollector, "The revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' " + "could not be determined (the revision string found is 'invalid package revision'). " - + "Defaulting to revision 14."); + + "Bazel will attempt to treat the NDK as if it was r14."); } @Test @@ -153,7 +153,7 @@ public class AndroidNdkRepositoryTest extends BuildViewTestCase { eventCollector, "The major revision of the Android NDK referenced by android_ndk_repository rule " + "'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]." - + " Defaulting to revision 14."); + + " Bazel will attempt to treat the NDK as if it was r14."); } @Test |