Skip to content

Commit

Permalink
Check that custom package is not null in android_local_test before pu…
Browse files Browse the repository at this point in the history
…tting it into the robolectric properties file.

This is incidentally what Starlark android_local_test does: https://github.com/bazelbuild/rules_android/blob/0c605a44587219016248ff5702331c88b805cc01/rules/android_local_test/impl.bzl#L199

Fixes #21632.

PiperOrigin-RevId: 615451196
Change-Id: I98adef9be42d89e25188f3d9204b466e780e2945
  • Loading branch information
ahumesky authored and copybara-github committed Mar 13, 2024
1 parent 9aef517 commit 2ce6ace
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.rules.android;

import static com.google.common.base.Strings.nullToEmpty;
import static com.google.devtools.build.lib.rules.java.DeployArchiveBuilder.Compression.COMPRESSED;

import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -162,9 +163,9 @@ public ConfiguredTarget create(RuleContext ruleContext)
Substitution.of("%android_merged_resources%", "jar:file:" + resourcesLocation + "!/res"));
substitutions.add(
Substitution.of("%android_merged_assets%", "jar:file:" + resourcesLocation + "!/assets"));
substitutions.add(
Substitution.of(
"%android_custom_package%", resourceApk.getValidatedResources().getJavaPackage()));

String customPackage = resourceApk.getValidatedResources().getJavaPackage();
substitutions.add(Substitution.of("%android_custom_package%", nullToEmpty(customPackage)));

substitutions.add(
Substitution.of(
Expand Down

0 comments on commit 2ce6ace

Please sign in to comment.