Merge "Remove unused java testing methods" am: 4aa7faf487
am: 3971c45155
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1658077 Change-Id: Ie437167d5e6a58fa4457729170e57f677ff0ccfc
This commit is contained in:
commit
9b05c66ed6
|
@ -33,12 +33,12 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
RegisterJavaBuildComponents(android.InitRegistrationContext)
|
||||
registerJavaBuildComponents(android.InitRegistrationContext)
|
||||
|
||||
RegisterJavaSdkMemberTypes()
|
||||
}
|
||||
|
||||
func RegisterJavaBuildComponents(ctx android.RegistrationContext) {
|
||||
func registerJavaBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("java_defaults", DefaultsFactory)
|
||||
|
||||
ctx.RegisterModuleType("java_library", LibraryFactory)
|
||||
|
|
|
@ -74,23 +74,6 @@ func testJavaError(t *testing.T, pattern string, bp string) (*android.TestContex
|
|||
return result.TestContext, result.Config
|
||||
}
|
||||
|
||||
// testJavaErrorWithConfig is a legacy way of running tests of java modules that expect errors.
|
||||
//
|
||||
// See testJava for an explanation as to how to stop using this deprecated method.
|
||||
//
|
||||
// deprecated
|
||||
func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config) (*android.TestContext, android.Config) {
|
||||
t.Helper()
|
||||
// This must be done on the supplied config and not as part of the fixture because any changes to
|
||||
// the fixture's config will be ignored when RunTestWithConfig replaces it.
|
||||
pathCtx := android.PathContextForTesting(config)
|
||||
dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
|
||||
result := prepareForJavaTest.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
||||
RunTestWithConfig(t, config)
|
||||
return result.TestContext, result.Config
|
||||
}
|
||||
|
||||
// testJavaWithFS runs tests using the prepareForJavaTest
|
||||
//
|
||||
// See testJava for an explanation as to how to stop using this deprecated method.
|
||||
|
|
|
@ -160,28 +160,6 @@ func FixtureWithPrebuiltApis(release2Modules map[string][]string) android.Fixtur
|
|||
)
|
||||
}
|
||||
|
||||
func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) android.Config {
|
||||
bp += GatherRequiredDepsForTest()
|
||||
|
||||
mockFS := android.MockFS{}
|
||||
|
||||
cc.GatherRequiredFilesForTest(mockFS)
|
||||
|
||||
for k, v := range fs {
|
||||
mockFS[k] = v
|
||||
}
|
||||
|
||||
if env == nil {
|
||||
env = make(map[string]string)
|
||||
}
|
||||
if env["ANDROID_JAVA8_HOME"] == "" {
|
||||
env["ANDROID_JAVA8_HOME"] = "jdk8"
|
||||
}
|
||||
config := android.TestArchConfig(buildDir, env, bp, mockFS)
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
func prebuiltApisFilesForLibs(apiLevels []string, sdkLibs []string) map[string][]byte {
|
||||
fs := make(map[string][]byte)
|
||||
for _, level := range apiLevels {
|
||||
|
@ -200,19 +178,6 @@ func prebuiltApisFilesForLibs(apiLevels []string, sdkLibs []string) map[string][
|
|||
return fs
|
||||
}
|
||||
|
||||
// Register build components provided by this package that are needed by tests.
|
||||
//
|
||||
// In particular this must register all the components that are used in the `Android.bp` snippet
|
||||
// returned by GatherRequiredDepsForTest()
|
||||
//
|
||||
// deprecated: Use test fixtures instead, e.g. PrepareForTestWithJavaBuildComponents
|
||||
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
||||
registerRequiredBuildComponentsForTest(ctx)
|
||||
|
||||
// Make sure that any tool related module types needed by dexpreopt have been registered.
|
||||
dexpreopt.RegisterToolModulesForTest(ctx)
|
||||
}
|
||||
|
||||
// registerRequiredBuildComponentsForTest registers the build components used by
|
||||
// PrepareForTestWithJavaDefaultModules.
|
||||
//
|
||||
|
@ -228,7 +193,7 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||
RegisterDexpreoptBootJarsComponents(ctx)
|
||||
RegisterDocsBuildComponents(ctx)
|
||||
RegisterGenRuleBuildComponents(ctx)
|
||||
RegisterJavaBuildComponents(ctx)
|
||||
registerJavaBuildComponents(ctx)
|
||||
RegisterPrebuiltApisBuildComponents(ctx)
|
||||
RegisterRuntimeResourceOverlayBuildComponents(ctx)
|
||||
RegisterSdkLibraryBuildComponents(ctx)
|
||||
|
@ -236,23 +201,6 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||
RegisterSystemModulesBuildComponents(ctx)
|
||||
}
|
||||
|
||||
// Gather the module definitions needed by tests that depend upon code from this package.
|
||||
//
|
||||
// Returns an `Android.bp` snippet that defines the modules that are needed by this package.
|
||||
//
|
||||
// deprecated: Use test fixtures instead, e.g. PrepareForTestWithJavaDefaultModules
|
||||
func GatherRequiredDepsForTest() string {
|
||||
bp := gatherRequiredDepsForTest()
|
||||
|
||||
// For class loader context and <uses-library> tests.
|
||||
bp += dexpreopt.CompatLibDefinitionsForTest()
|
||||
|
||||
// Make sure that any tools needed for dexpreopting are defined.
|
||||
bp += dexpreopt.BpToolModulesForTest()
|
||||
|
||||
return bp
|
||||
}
|
||||
|
||||
// gatherRequiredDepsForTest gathers the module definitions used by
|
||||
// PrepareForTestWithJavaDefaultModules.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue