jdeps_test.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Copyright 2018 Google Inc. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package java
  15. import (
  16. "reflect"
  17. "testing"
  18. "android/soong/android"
  19. )
  20. func TestCollectJavaLibraryPropertiesAddLibsDeps(t *testing.T) {
  21. expected := []string{"Foo", "Bar"}
  22. module := LibraryFactory().(*Library)
  23. module.properties.Libs = append(module.properties.Libs, expected...)
  24. dpInfo := &android.IdeInfo{}
  25. module.IDEInfo(dpInfo)
  26. if !reflect.DeepEqual(dpInfo.Deps, expected) {
  27. t.Errorf("Library.IDEInfo() Deps = %v, want %v", dpInfo.Deps, expected)
  28. }
  29. }
  30. func TestCollectJavaLibraryPropertiesAddStaticLibsDeps(t *testing.T) {
  31. expected := []string{"Foo", "Bar"}
  32. module := LibraryFactory().(*Library)
  33. module.properties.Static_libs = append(module.properties.Static_libs, expected...)
  34. dpInfo := &android.IdeInfo{}
  35. module.IDEInfo(dpInfo)
  36. if !reflect.DeepEqual(dpInfo.Deps, expected) {
  37. t.Errorf("Library.IDEInfo() Deps = %v, want %v", dpInfo.Deps, expected)
  38. }
  39. }
  40. func TestCollectJavaLibraryPropertiesAddScrs(t *testing.T) {
  41. expected := []string{"Foo", "Bar"}
  42. module := LibraryFactory().(*Library)
  43. module.expandIDEInfoCompiledSrcs = append(module.expandIDEInfoCompiledSrcs, expected...)
  44. dpInfo := &android.IdeInfo{}
  45. module.IDEInfo(dpInfo)
  46. if !reflect.DeepEqual(dpInfo.Srcs, expected) {
  47. t.Errorf("Library.IDEInfo() Srcs = %v, want %v", dpInfo.Srcs, expected)
  48. }
  49. }
  50. func TestCollectJavaLibraryPropertiesAddAidlIncludeDirs(t *testing.T) {
  51. expected := []string{"Foo", "Bar"}
  52. module := LibraryFactory().(*Library)
  53. module.deviceProperties.Aidl.Include_dirs = append(module.deviceProperties.Aidl.Include_dirs, expected...)
  54. dpInfo := &android.IdeInfo{}
  55. module.IDEInfo(dpInfo)
  56. if !reflect.DeepEqual(dpInfo.Aidl_include_dirs, expected) {
  57. t.Errorf("Library.IDEInfo() Aidl_include_dirs = %v, want %v", dpInfo.Aidl_include_dirs, expected)
  58. }
  59. }
  60. func TestCollectJavaLibraryPropertiesAddJarjarRules(t *testing.T) {
  61. expected := "Jarjar_rules.txt"
  62. module := LibraryFactory().(*Library)
  63. module.expandJarjarRules = android.PathForTesting(expected)
  64. dpInfo := &android.IdeInfo{}
  65. module.IDEInfo(dpInfo)
  66. if dpInfo.Jarjar_rules[0] != expected {
  67. t.Errorf("Library.IDEInfo() Jarjar_rules = %v, want %v", dpInfo.Jarjar_rules[0], expected)
  68. }
  69. }