Skip to content

Commit

Permalink
[7.1.0] Expose AndroidIdeInfo in android_common (#21607)
Browse files Browse the repository at this point in the history
Previously
916c3f5
exposed the provider on top-level to support IntelliJ aspects. Exposing
it over android_common, makes it possible to detect its presence in
Starlark code via `getattr(android_common, "AndroidIdeInfo")`. With this
detection it's easier to support older Bazel versions.

Without exposing it via android_common, detecting AndroidIdeInfo
presence in Bazel world is only possible using a new dependency on
@bazel_features in IntelliJ aspects.

Fixes: #21544
PiperOrigin-RevId: 613580552
Change-Id: I214024facbdc9ac7742bf98575101bd624d4a6a7
  • Loading branch information
comius authored Mar 7, 2024
1 parent 2b440b8 commit 9b39cca
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider;
import com.google.devtools.build.lib.rules.java.JavaInfo;
import com.google.devtools.build.lib.starlarkbuildapi.android.AndroidIdeInfoProviderApi;
import com.google.devtools.build.lib.starlarkbuildapi.android.AndroidSplitTransitionApi;
import com.google.devtools.build.lib.starlarkbuildapi.android.AndroidStarlarkCommonApi;
import net.starlark.java.annot.StarlarkMethod;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Sequence;

Expand Down Expand Up @@ -94,4 +96,9 @@ public void createDexMergerActions(
Sequence.cast(dexopts, String.class, "dexopts"),
dexmerger);
}

@StarlarkMethod(name = AndroidIdeInfoProviderApi.NAME, structField = true, documented = false)
public AndroidIdeInfoProvider.Provider getAndroidIdeInfoProvider() {
return AndroidIdeInfoProvider.PROVIDER;
}
}

0 comments on commit 9b39cca

Please sign in to comment.