| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
package api |
| 16 |
|
| 17 |
import ( |
| 18 |
"testing" |
| 19 |
|
| 20 |
"android/soong/android" |
| 21 |
"android/soong/bp2build" |
| 22 |
) |
| 23 |
|
| 24 |
func runCombinedApisTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2build.Bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) { |
| 25 |
t.Helper() |
| 26 |
(&tc).ModuleTypeUnderTest = "combined_apis" |
| 27 |
(&tc).ModuleTypeUnderTestFactory = combinedApisModuleFactory |
| 28 |
bp2build.RunBp2BuildTestCase(t, registrationCtxFunc, tc) |
| 29 |
} |
| 30 |
|
| 31 |
func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { |
| 32 |
t.Helper() |
| 33 |
runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) {}) |
| 34 |
} |
| 35 |
|
| 36 |
func TestCombinedApisGeneral(t *testing.T) { |
| 37 |
runCombinedApisTestCase(t, bp2build.Bp2buildTestCase{ |
| 38 |
Description: "combined_apis, general case", |
| 39 |
Blueprint: `combined_apis { |
| 40 |
name: "foo", |
| 41 |
bootclasspath: ["bcp"], |
| 42 |
system_server_classpath: ["ssc"], |
| 43 |
} |
| 44 |
`, |
| 45 |
ExpectedBazelTargets: []string{ |
| 46 |
bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ |
| 47 |
"scope": `"public"`, |
| 48 |
"base": `":non-updatable-current.txt__BP2BUILD__MISSING__DEP"`, |
| 49 |
"deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, |
| 50 |
}), |
| 51 |
bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-current.txt", bp2build.AttrNameToString{ |
| 52 |
"scope": `"system"`, |
| 53 |
"base": `":non-updatable-system-current.txt__BP2BUILD__MISSING__DEP"`, |
| 54 |
"deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, |
| 55 |
}), |
| 56 |
bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-module-lib-current.txt", bp2build.AttrNameToString{ |
| 57 |
"scope": `"module-lib"`, |
| 58 |
"base": `":non-updatable-module-lib-current.txt__BP2BUILD__MISSING__DEP"`, |
| 59 |
"deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, |
| 60 |
}), |
| 61 |
bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-server-current.txt", bp2build.AttrNameToString{ |
| 62 |
"scope": `"system-server"`, |
| 63 |
"base": `":non-updatable-system-server-current.txt__BP2BUILD__MISSING__DEP"`, |
| 64 |
"deps": `[":ssc__BP2BUILD__MISSING__DEP"]`, |
| 65 |
}), |
| 66 |
}, |
| 67 |
}) |
| 68 |
} |