diff options
author | Rex Hoffman <rexhoffman@google.com> | 2024-01-18 00:02:05 +0000 |
---|---|---|
committer | Rex Hoffman <rexhoffman@google.com> | 2024-01-18 00:03:38 +0000 |
commit | d0d6ad6c3cc09111526c90f1c233ad91e52b25b0 (patch) | |
tree | e812180401a93a14f3ff210fefefb62bfb214d34 | |
parent | 8bdd859abda8a38a34a0f735c7c624eace0ea855 (diff) | |
download | robolectric-shadows-d0d6ad6c3cc09111526c90f1c233ad91e52b25b0.tar.gz |
Move android-all generation to /external/robolectric
Bug: 314757990
Test: CI
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3ec3407fde886602a2f62e78dcf741db266ac1fa)
Merged-In: Ib491419946bc10075965005314fd56feeec45edb
Change-Id: I91684b9c9735550bb5445373edf2ad36cef91586
-rw-r--r-- | Android.bp | 64 | ||||
-rw-r--r-- | soong/Android.bp | 32 | ||||
-rw-r--r-- | soong/robolectric.go | 101 |
3 files changed, 0 insertions, 197 deletions
diff --git a/Android.bp b/Android.bp index 9f49e7096..557df7124 100644 --- a/Android.bp +++ b/Android.bp @@ -49,70 +49,6 @@ java_library { visibility: ["//visibility:public"], } -// build.prop file created by module type defined in soong/robolectric.go -robolectric_build_props { - name: "robolectric_build_props", -} - -java_genrule_host { - name: "robolectric_framework_res", - tools: ["zip2zip"], - srcs: [":framework-res"], - out: ["robolectric_framework_res.jar"], - cmd: "$(location zip2zip) " + - "-i $(location :framework-res) " + - "-o $(location robolectric_framework_res.jar) " + - "-x classes.dex " + - "-x META-INF/**/* " + - "-0 resources.arsc", -} - -java_device_for_host { - name: "robolectric_android-all-device-deps", - libs: [ - "conscrypt-for-host", - "core-icu4j-for-host", - "core-libart-for-host", - "ext", - "framework-all", - "icu4j-icudata-jarjar", - "icu4j-icutzdata-jarjar", - "ims-common", - "libphonenumber-platform", - "okhttp-for-host", - "services", - "services.accessibility", - "telephony-common", - "android.car", - "android.car.builtin", - ], -} - -java_library_host { - name: "robolectric-host-android_all", - static_libs: [ - "robolectric_android-all-device-deps", - "robolectric_tzdata", - "robolectric_framework_res", - ], - dist: { - targets: [ - "sdk", - "win_sdk", - ], - dest: "android-all-robolectric.jar", - }, - - java_resources: [ - // Copy the build.prop - ":robolectric_build_props", - ], - visibility: [ - ":__subpackages__", - "//prebuilts/misc/common/robolectric", - ], -} - //############################################# // Assemble Robolectric_all //############################################# diff --git a/soong/Android.bp b/soong/Android.bp deleted file mode 100644 index 954cf15b8..000000000 --- a/soong/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "external_robolectric-shadows_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["external_robolectric-shadows_license"], -} - -bootstrap_go_package { - name: "soong-robolectric", - pkgPath: "android/soong/robolectric", - srcs: ["robolectric.go"], - pluginFor: ["soong_build"], - deps: [ - "soong-android", - ], -} diff --git a/soong/robolectric.go b/soong/robolectric.go deleted file mode 100644 index cadeb0fad..000000000 --- a/soong/robolectric.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2019 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package robolectric - -import ( - "fmt" - "strings" - - "android/soong/android" -) - -var pctx = android.NewPackageContext("android/soong/robolectric") - -func init() { - pctx.Import("android/soong/android") - android.RegisterModuleType("robolectric_build_props", buildPropsFactory) -} - -type buildProps struct { - android.ModuleBase - output android.WritablePath -} - -var _ android.SourceFileProducer = (*buildProps)(nil) - -func (b *buildProps) Srcs() android.Paths { - return android.Paths{b.output} -} - -func (b *buildProps) GenerateAndroidBuildActions(ctx android.ModuleContext) { - - displayID := fmt.Sprintf("robolectric %s %s", - ctx.Config().PlatformVersionName(), - ctx.Config().BuildId()) - - lines := []string{ - "# build properties autogenerated by robolectric.go", - "", - "ro.build.id=" + ctx.Config().BuildId(), - "ro.build.display.id=" + displayID, - "ro.product.name=robolectric", - "ro.product.device=robolectric", - "ro.product.board=robolectric", - "ro.product.manufacturer=robolectric", - "ro.product.brand=robolectric", - "ro.product.model=robolectric", - "ro.hardware=robolectric", - "ro.build.version.security_patch=" + ctx.Config().PlatformSecurityPatch(), - "ro.build.version.sdk=" + ctx.Config().PlatformSdkVersion().String(), - "ro.build.version.release=" + ctx.Config().PlatformVersionName(), - "ro.build.version.preview_sdk=" + ctx.Config().PlatformPreviewSdkVersion(), - // We don't have the API fingerprint available, just use the preview SDK version. - "ro.build.version.preview_sdk_fingerprint=" + ctx.Config().PlatformPreviewSdkVersion(), - "ro.build.version.codename=" + ctx.Config().PlatformSdkCodename(), - "ro.build.version.all_codenames=" + strings.Join(ctx.Config().PlatformVersionActiveCodenames(), ","), - "ro.build.version.min_supported_target_sdk=" + ctx.Config().PlatformMinSupportedTargetSdkVersion(), - "ro.build.version.base_os=" + ctx.Config().PlatformBaseOS(), - "ro.build.tags=robolectric", - "ro.build.fingerprint=robolectric", - "ro.build.characteristics=robolectric", - "", - "# for backwards-compatibility reasons, set CPUs to unknown/ARM", - "ro.product.cpu.abi=unknown", - "ro.product.cpu.abi2=unknown", - "ro.product.cpu.abilist=armeabi-v7a", - "ro.product.cpu.abilist32=armeabi-v7a,armeabi", - "ro.product.cpu.abilist64=armeabi-v7a,armeabi", - "", - "# temp fix for robolectric freezing issue b/150011638", - "persist.debug.new_insets=0", - } - - b.output = android.PathForModuleGen(ctx, "build.prop") - - rule := android.NewRuleBuilder(pctx, ctx) - - rule.Command().Text("rm").Flag("-f").Output(b.output) - for _, l := range lines { - rule.Command().Text("echo").Text("'" + l + "'").Text(">>").Output(b.output) - } - - rule.Build("build_prop", "robolectric build.prop") -} - -func buildPropsFactory() android.Module { - module := &buildProps{} - android.InitAndroidModule(module) - return module -} |