-
Notifications
You must be signed in to change notification settings - Fork 1
/
JavaLibrary.bp
1080 lines (976 loc) · 32.4 KB
/
JavaLibrary.bp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (C) 2007 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.
//
// Definitions for building the Android core library and associated tests.
//
// The Android core library provides low-level APIs for use by the rest of the
// Android software stack. It is made up of various parts, some of which can be
// found in libcore/ and other parts that can be found in various external/
// directories.
//
// libcore has some sub-directories that follow a common structure:
// e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni,
// support, xml, xmlpull.
//
// The structure of these is generally:
//
// src/
// main/ # To be shipped on every device.
// java/ # Java source for library code.
// native/ # C/C++ source for library code.
// resources/ # Support files.
// test/ # Built only on demand, for testing.
// java/ # Java source for tests.
// native/ # C/C++ source for tests (rare).
// resources/ # Support files.
//
// All subdirectories are optional.
build = [
"openjdk_java_files.bp",
"non_openjdk_java_files.bp",
]
// The Java files and their associated resources.
filegroup {
name: "core-luni-resources",
visibility: [
"//libcore:__subpackages__",
],
path: "luni/src/main/java/",
srcs: [
"luni/src/main/java/java/util/logging/logging.properties",
"luni/src/main/java/java/security/security.properties",
],
}
filegroup {
name: "core-ojluni-resources",
visibility: [
"//libcore:__subpackages__",
],
path: "ojluni/src/main/resources/",
srcs: [
"ojluni/src/main/resources/**/*",
],
}
core_resources = [
":core-luni-resources",
":core-ojluni-resources",
]
// The source files that go into core-oj.
filegroup {
name: "core_oj_java_files",
visibility: [
"//libcore:__subpackages__",
],
srcs: [":openjdk_java_files"],
}
// OpenJDK source is not annotated with @hide so we need this separate
// filegroup for just the parts that contribute to the API.
filegroup {
name: "core_oj_api_files",
srcs: [":openjdk_javadoc_files"],
}
// The source files that go into core-libart.
filegroup {
name: "core_libart_java_files",
visibility: [
"//libcore:__subpackages__",
],
srcs: [
":non_openjdk_java_files",
],
}
// Some parts of libart are not annotated with @hide so we need this separate
// filegroup for just the parts that contribute to the API.
filegroup {
name: "core_libart_api_files",
srcs: [
":non_openjdk_javadoc_files",
],
}
// The set of files for the ART module that contribute to one or more API
// surfaces. This includes files that are in the public API as well as those
// that are not but which have been marked up with @hide plus one or more of
// the API defining annotations.
//
// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
// annotated by applying annotations to the .annotated.java stubs files in
// ojluni/annotated/mmodules and rather than in the original source. See the comments
// in openjdk_java_files.bp for more details.
filegroup {
name: "art_module_api_files",
visibility: [
"//libcore:__subpackages__",
],
srcs: [
":apache-xml_api_files",
":bouncycastle_java_files",
":core_oj_api_files",
":core_libart_api_files",
":okhttp_api_files",
":openjdk_mmodule_extra_files",
],
}
java_defaults {
name: "libcore_java_defaults",
javacflags: [
//"-Xlint:all",
//"-Xlint:-serial,-deprecation,-unchecked",
],
dxflags: ["--core-library"],
errorprone: {
javacflags: [
"-Xep:MissingOverride:OFF", // Ignore missing @Override.
"-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
],
},
min_sdk_version: "31",
}
//
// Build for the target (device).
//
// A target used to bootstrap compilation for the core library.
//
// See core-all-system-modules for more details.
java_library {
name: "core-all",
defaults: ["libcore_java_defaults"],
srcs: [
// Use the source code for the I18N module intra core API as using the
// compiled version does not work due to limitations in either soong or the javac
// toolchain. See http://b/142056316 for more details.
":i18n.module.intra.core.api{.public.stubs.source}",
":core_oj_java_files",
":core_libart_java_files",
":openjdk_lambda_stub_files",
":openjdk_generated_annotation_stub_files",
":app-compat-annotations-source",
// Use the okhttp source too to allow libcore code to reference it
// directly.
":okhttp_impl_files",
],
sdk_version: "none",
system_modules: "none",
patch_module: "java.base",
openjdk9: {
srcs: ["luni/src/module/java/module-info.java"],
},
java_resources: core_resources,
java_version: "1.9",
installable: false,
plugins: [
"compat-changeid-annotation-processor",
"unsupportedappusage-annotation-processor",
],
libs: [
"conscrypt.module.intra.core.api",
],
}
platform_compat_config {
name: "libcore-platform-compat-config",
src: ":core-all",
visibility: [
"//art/build/apex",
"//art/build/sdk",
],
}
// A system modules definition for use by core library targets only. It only
// contains the core-all jar, which contains the classes that end up in core-oj,
// core-libart as well as the lambda stubs needed to compile Java lambda code.
// It does not contain other parts of core library like conscrypt, bouncycastle,
// etc. This system_modules definition is used to bootstrap compilation for
// other parts of the core library like core-oj, core-libart, conscrypt,
// bouncycastle, etc. It is also used to compile Libcore tests, as well as ART
// Java tests (run-tests).
java_system_modules {
name: "core-all-system-modules",
// Visibility is deliberately restricted to a small set of build modules that
// the core library team control.
visibility: [
"//art/test:__subpackages__",
"//external/apache-harmony:__subpackages__",
"//external/apache-xml",
"//external/okhttp",
"//libcore:__subpackages__",
],
libs: ["core-all"],
}
// Contains the parts of core library associated with OpenJDK.
java_library {
name: "core-oj",
visibility: [
"//art/build/apex",
"//art/build/sdk",
"//external/wycheproof",
"//libcore/benchmarks",
"//packages/modules/ArtPrebuilt",
],
apex_available: [
"com.android.art",
"com.android.art.debug",
],
defaults: ["libcore_java_defaults"],
installable: true,
hostdex: true,
srcs: [":core_oj_java_files"],
java_resources: core_resources,
sdk_version: "none",
system_modules: "core-all-system-modules",
patch_module: "java.base",
jacoco: {
exclude_filter: [
"java.lang.Class",
"java.lang.Long",
"java.lang.Number",
"java.lang.Object",
"java.lang.String",
"java.lang.invoke.MethodHandle",
"java.lang.ref.Reference",
"java.lang.reflect.Proxy",
"java.util.AbstractMap",
"java.util.HashMap",
"java.util.HashMap$Node",
"java.util.Map",
],
},
notice: "ojluni/NOTICE",
hiddenapi_additional_annotations: [
"core-oj-hiddenapi-annotations",
],
}
// Contains parts of core library not associated with OpenJDK. Contains not
// just java.*, javax.* code but also android.system.* and various internal
// libcore.* packages.
java_library {
name: "core-libart",
visibility: [
"//art/build/apex",
"//art/build/sdk",
"//external/robolectric-shadows",
"//external/wycheproof",
"//libcore/benchmarks",
"//frameworks/layoutlib",
"//packages/modules/ArtPrebuilt",
],
apex_available: [
"com.android.art",
"com.android.art.debug",
],
defaults: ["libcore_java_defaults"],
installable: true,
hostdex: true,
srcs: [":core_libart_java_files"],
java_version: "1.9",
sdk_version: "none",
system_modules: "core-all-system-modules",
patch_module: "java.base",
jacoco: {
exclude_filter: [
"java.lang.DexCache",
"dalvik.system.ClassExt",
],
},
target: {
hostdex: {
required: [
// Files used to simulate the /system, runtime APEX and tzdata
// APEX dir structure on host.
"icu_tzdata.dat_host_tzdata_apex",
"tzdata_host",
"tzdata_host_tzdata_apex",
"tzlookup.xml_host_tzdata_apex",
"tz_version_host",
"tz_version_host_tzdata_apex",
],
},
darwin: {
enabled: false,
},
},
}
// Provided solely to contribute information about which hidden parts of the
// core-oj API are used by apps.
//
// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are
// added to the source that is compiled directly into the bootjar and the build
// system extracts the information about UnsupportedAppUsage directly from
// there.
//
// This approach of having separate annotated source and a separate build
// target was taken for ojluni to avoid having to maintain local patches in the
// ojluni source for UnsupportedAppUsage annotations as that would make it more
// difficult to pull down changes from upstream.
//
java_library {
name: "core-oj-hiddenapi-annotations",
// Do not allow this to be accessed from outside this directory.
visibility: ["//visibility:private"],
defaults: ["libcore_java_defaults"],
compile_dex: true,
srcs: [":openjdk_hiddenapi_javadoc_files"],
sdk_version: "none",
system_modules: "core-all-system-modules",
patch_module: "java.base",
plugins: ["unsupportedappusage-annotation-processor"],
}
java_defaults {
name: "core_lambda_stubs_defaults",
defaults: ["libcore_java_defaults"],
hostdex: true,
sdk_version: "none",
system_modules: "core-all-system-modules",
patch_module: "java.base",
notice: "ojluni/NOTICE",
installable: false,
include_srcs: true,
}
// Creates a jar that exists to satisfy javac when compiling source code that
// contains lambdas. This contains all classes / methods required by javac
// when generating invoke-dynamic lambda implementation code, even those that
// are also in the public SDK API from API level 26 onwards.
java_library {
name: "core-lambda-stubs",
visibility: ["//visibility:public"],
defaults: ["core_lambda_stubs_defaults"],
srcs: [
":openjdk_lambda_stub_files",
":openjdk_lambda_duplicate_stub_files",
],
// This jar is packaged as part of the SDK, use -target 8 so that it works
// with old JDKs.
java_version: "1.8",
}
// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
// because those classes are also part of the core library public SDK API
// (since API level 26).
java_library {
name: "core-lambda-stubs-for-system-modules",
visibility: [
"//libcore/mmodules/core_platform_api",
],
defaults: ["core_lambda_stubs_defaults"],
srcs: [
":openjdk_lambda_stub_files",
],
include_srcs: true,
}
// Creates a jar that exists to satisfy javac when compiling source code that
// contains @Generated annotations, which are produced by some code generation
// tools (notably dagger) but aren't part of the Android API.
// See http://b/123891440.
java_library {
name: "core-generated-annotation-stubs",
visibility: [
"//libcore/mmodules/core_platform_api",
],
defaults: ["libcore_java_defaults"],
srcs: [
":openjdk_generated_annotation_stub_files",
],
hostdex: true,
sdk_version: "none",
system_modules: "core-all-system-modules",
patch_module: "java.base",
notice: "ojluni/NOTICE",
installable: false,
include_srcs: true,
}
// Builds libcore test rules
java_library_static {
name: "core-test-rules",
visibility: [
"//art/build/sdk",
"//cts/tests/tests/util",
"//external/conscrypt",
"//external/conscrypt/apex/tests",
"//frameworks/base/location/tests/locationtests",
"//frameworks/base/core/tests/coretests",
"//frameworks/base/wifi/tests",
"//packages/modules/Wifi/framework/tests",
],
hostdex: true,
srcs: [
"dalvik/test-rules/src/main/**/*.java",
"test-rules/src/main/**/*.java",
],
static_libs: ["junit"],
sdk_version: "none",
system_modules: "core-all-system-modules",
}
// Builds platform_compat test rules
java_library_static {
name: "core-compat-test-rules",
visibility: [
"//art/build/sdk",
"//frameworks/base/tests/PlatformCompatGating/test-rules",
],
srcs: [
"luni/src/main/java/android/compat/**/*.java",
"test-rules/src/platform_compat/**/*.java",
"luni/src/main/java/libcore/api/CorePlatformApi.java",
"luni/src/main/java/libcore/api/IntraCoreApi.java",
],
static_libs: [
"junit",
"guava",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
// This builds classes that are in the java.base Java module:
patch_module: "java.base",
hostdex: true,
}
// Builds the core-tests-support library used by various tests.
java_library_static {
name: "core-tests-support",
visibility: [
"//art/build/sdk",
"//cts/apps/CtsVerifier",
"//cts/tests/tests/keystore",
"//cts/tests/tests/net",
"//cts/tests/tests/net/api23Test",
"//external/apache-harmony",
"//frameworks/base/core/tests/coretests",
"//libcore/benchmarks",
"//packages/apps/KeyChain/tests",
"//system/timezone/distro/core",
"//packages/modules/Connectivity/tests/cts/net",
"//packages/modules/Connectivity/tests/cts/net/api23Test",
],
hostdex: true,
srcs: ["support/src/test/java/**/*.java"],
sdk_version: "core_platform",
libs: ["junit"],
static_libs: [
"bouncycastle-unbundled",
"bouncycastle-bcpkix-unbundled",
"bouncycastle-ocsp-unbundled",
],
}
// Builds the jsr166-tests library.
java_test {
name: "jsr166-tests",
visibility: [
"//art/build/sdk",
"//cts/tests/libcore/jsr166",
],
srcs: ["jsr166-tests/src/test/java/**/*.java"],
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"junit",
],
}
// A filegroup that provides access to a source file for a toolchain test that
// checks Java 9 language features are handled properly by JarJar.
filegroup {
name: "core-java-9-language-features-source",
srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"],
visibility: ["//libcore/luni/src/test/java9language"],
}
genrule {
name: "core-tests-smali-dex",
srcs: ["luni/src/test/java/**/*.smali"],
cmd: "$(location smali) ass --api 28 -o $(out) $(in)",
out: ["core-tests-smali.dex"],
tools: ["smali"],
}
filegroup {
name: "core-ojtests-javax-resources",
// Set path to keep the resources and .class files in the same directory in the jar file.
path: "ojluni/src",
srcs: ["ojluni/src/test/javax/**/*"],
exclude_srcs: ["ojluni/src/test/javax/**/*.java"],
}
// Builds the core-tests library.
java_test {
name: "core-tests",
visibility: [
"//art/build/sdk",
"//cts/tests/libcore/luni",
],
defaults: ["libcore_java_defaults"],
hostdex: true,
srcs: [
"dalvik/src/test/java/**/*.java",
"dalvik/test-rules/src/test/java/**/*.java",
"dom/src/test/java/**/*.java",
"harmony-tests/src/test/java/**/*.java",
"json/src/test/java/**/*.java",
"luni/src/test/java/**/*.java",
"test-rules/src/test/java/**/*.java",
"xml/src/test/java/**/*.java",
],
exclude_srcs: [
"harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java",
"luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
"luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
"luni/src/test/java/libcore/javax/crypto/**/*.java",
"luni/src/test/java/libcore/javax/net/ssl/**/*.java",
"luni/src/test/java/org/apache/harmony/crypto/**/*.java",
],
java_resource_dirs: [
"*/src/test/java",
"*/src/test/resources",
],
exclude_java_resource_dirs: [
"ojluni/src/test/java",
"ojluni/src/test/javax",
"ojluni/src/test/resources",
],
java_resources: [
":annotations-test",
":filesystemstest",
":parameter-metadata-test",
":core-tests-smali-dex",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"okhttp",
"bouncycastle",
],
static_libs: [
"core-compat-test-rules",
"core-java-9-language-tests",
"core-test-rules",
"core-tests-support",
"junit-params",
"libcore-crypto-tests",
"mockftpserver",
"mockito-target",
"mockwebserver",
"nist-pkix-tests",
"slf4j-jdk14",
"sqlite-jdbc",
"truth-prebuilt-jar",
],
errorprone: {
javacflags: [
"-Xep:TryFailThrowable:ERROR",
"-Xep:ComparisonOutOfRange:ERROR",
],
},
test_config: "AndroidTest-core-tests.xml",
}
java_test {
name: "libcore-crypto-tests",
visibility: [
"//art/build/sdk",
"//external/conscrypt/apex/tests",
],
srcs: [
"harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java",
"luni/src/test/java/libcore/javax/crypto/**/*.java",
"luni/src/test/java/libcore/javax/net/ssl/**/*.java",
"luni/src/test/java/org/apache/harmony/crypto/**/*.java",
],
exclude_srcs: [
"luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/SealedObjectTest.java",
],
java_resource_dirs: [
"luni/src/test/java",
"luni/src/test/resources",
"support/src/test/java",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
static_libs: [
"core-test-rules",
"core-tests-support",
"junit-params",
"mockito-target",
],
}
// Builds the core-ojtests library that contains test code from OpenJDK.
java_test {
name: "core-ojtests",
defaults: ["libcore_java_defaults"],
hostdex: true,
srcs: [
"ojluni/src/test/java/**/*.java",
"ojluni/src/test/javax/**/*.java",
],
java_resource_dirs: [
"ojluni/src/test/java",
"ojluni/src/test/resources",
],
java_resources: [
":core-ojtests-javax-resources",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"okhttp",
"bouncycastle",
],
static_libs: [
"junit",
"testng",
],
// ojluni/src/test/java/util/stream/{bootlib,boottest}
// contains tests that are in packages from java.base;
// By default, OpenJDK 9's javac will only compile such
// code if it's declared to also be in java.base at
// compile time.
//
// For now, we use patch_module to put all sources
// and dependencies from this make target into java.base;
// other source directories in this make target are in
// packages not from java.base; if this becomes a problem
// in future, this could be addressed eg. by splitting
// boot{lib,test} out into a separate make target,
// deleting those tests or moving them to a different
// package.
patch_module: "java.base",
}
// Builds the core-ojtests-public library. Excludes any private API tests.
// Like core-ojtests but smaller.
java_test {
name: "core-ojtests-public",
visibility: [
"//art/build/sdk",
"//cts/tests/libcore/ojluni",
],
defaults: ["libcore_java_defaults"],
srcs: [
"ojluni/src/test/java/**/*.java",
"ojluni/src/test/javax/**/*.java",
],
// Filter out the following:
// 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
// and won't actually run, and
// 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
// excluding them means we don't need patch_module: "java.base"
exclude_srcs: [
"**/DeserializeMethodTest.java",
"**/SerializedLambdaTest.java",
"ojluni/src/test/java/util/stream/boot*/**/*",
],
java_resource_dirs: [
"ojluni/src/test/java",
"ojluni/src/test/resources",
// Include source code as part of JAR
"ojluni/src/test/dist",
],
java_resources: [
":core-ojtests-javax-resources",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
libs: [
"bouncycastle",
"junit",
"okhttp",
"testng",
],
}
// Exports annotated stubs source files in ojluni/annotations/sdk to make them
// available to metalava. Used for nullability annotations in OpenJDK source.
droiddoc_exported_dir {
name: "ojluni-annotated-sdk-stubs",
path: "ojluni/annotations/sdk",
}
droiddoc_exported_dir {
name: "ojluni-annotated-nullability-stubs",
path: "ojluni/annotations/sdk/nullability",
}
// Exports annotated stubs source files in ojluni/annotations/mmodules to make
// them available to metalava. Used for core platform API and intra-core API
// annotations in OpenJDK source.
droiddoc_exported_dir {
name: "ojluni-annotated-mmodule-stubs",
visibility: [
"//libcore/mmodules/core_platform_api",
"//libcore/mmodules/intracoreapi",
],
path: "ojluni/annotations/mmodule",
}
// A file containing the list of tags that are "known" to us from the OpenJdk
// source code and so should not cause an error or warning.
filegroup {
name: "known-oj-tags",
visibility: [
"//frameworks/base",
],
srcs: [
"known_oj_tags.txt",
],
}
// A special set of stubs containing the minimal set of self consistent
// classes for which a system module can be created. Every system module must
// contain the java.lang classes so the set was constructed by starting with
// the java.lang classes and then adding their transitive dependencies without
// splitting packages. So, if one class from a package is used then all classes
// in that package were added to the set.
//
// Needed for java-current-stubs-system-modules.
droidstubs {
name: "java-current-stubs-source",
srcs: [
":core_oj_api_files",
":core_libart_api_files",
],
java_version: "1.9",
installable: false,
sdk_version: "none",
system_modules: "none",
args: "--stub-packages java.*:javax.*:org.w3c.dom.*:org.xml.sax.*",
}
java_library {
name: "java.current.stubs",
srcs: [":java-current-stubs-source"],
errorprone: {
javacflags: [
"-Xep:MissingOverride:OFF",
],
},
patch_module: "java.base",
sdk_version: "none",
system_modules: "none",
}
// A special set of system modules needed to build art.module.public.api
// that contain nullability annotations when targeting java language level 1.9
// and above.
java_system_modules {
name: "java-current-stubs-system-modules",
libs: [
// Minimal set of classes required for a system module.
"java.current.stubs",
// The nullability annotations used by the generated stubs.
"stub-annotations",
],
}
// http://b/129765390 Rewrite links to "platform" or "technotes" folders
// which are siblings (and thus outside of) {@docRoot}.
//
// We have to escape \ as \\ and $ as $$ here because they get resolved by
// different layers of the build tooling. The arguments are wrapped in '' so
// that the shell doesn't add yet another level of escaping.
rewrite_openjdk_doc_args = "--replace-documentation " +
// packages whose descendants to apply replacement to (all packages from
// libcore/ojluni/src/main/java that contribute to documentation).
"com.sun:java:javax:jdk.net:sun " +
// regex of the string to replace
"'(<a\\s+href\\s?=[\\*\\s]*\")(?:(?:\\{@docRoot\\}/\\.\\./)|(?:(?:\\.\\./)+))((?:platform|technotes).+)\">' " +
// replacement (with $1, $2 backreferences to the regex groups)
"'$$1https://docs.oracle.com/javase/8/docs/$$2\">' "
// Define the public SDK API provided by the ART module.
java_sdk_library {
name: "art.module.public.api",
visibility: [
"//art/build/sdk",
"//frameworks/base",
"//frameworks/base/api",
],
srcs: [
":core_oj_api_files",
":core_libart_api_files",
],
libs: [
// Provide access to I18N constants that are used to initialize
// constants in the public API. i.e. to allow the value of the
// java.text.CollectionElementIterator.NULLORDER to be initialized from
// android.icu.text.CollationElementIterator.NULLORDER.
"i18n.module.intra.core.api.stubs",
],
java_version: "1.9",
public: {
enabled: true,
},
api_only: true,
droiddoc_options: [
rewrite_openjdk_doc_args,
"--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ",
],
// Emit nullability annotations from the source to the stub files.
annotations_enabled: true,
merge_annotations_dirs: [
"metalava-manual",
"ojluni-annotated-sdk-stubs",
],
doctag_files: [
":known-oj-tags",
],
errorprone: {
javacflags: [
"-Xep:MissingOverride:OFF",
],
},
patch_module: "java.base",
sdk_version: "none",
system_modules: "java-current-stubs-system-modules",
// The base name for the artifacts that are automatically published to the
// dist and which end up in one of the sub-directories of prebuilts/sdk.
// As long as this matches the name of the artifacts in prebuilts/sdk then
// the API will be checked for compatibility against the latest released
// version of the API.
dist_stem: "art",
}
// Used when compiling higher-level code against art.module.public.api.stubs.
//
// This is only intended for use within core libraries and must not be used
// from outside.
java_system_modules {
name: "art-module-public-api-stubs-system-modules",
visibility: [
"//art/build/sdk",
"//external/conscrypt",
"//external/icu/android_icu4j",
"//external/wycheproof",
],
libs: [
"art.module.public.api.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
// This one is not on device but it's needed when javac compiles code
// containing @Generated annotations produced by some code generation
// tools.
// See http://b/123891440.
"core-generated-annotation-stubs",
// Ensure that core libraries that depend on the public API can access
// the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
// annotations.
"art.module.api.annotations.for.system.modules",
// Make nullability annotations available when compiling public stubs.
// They are provided as a separate library because while the
// annotations are not themselves part of the public API provided by
// this module they are used in the stubs.
"stub-annotations",
],
}
// A stubs target containing the parts of the public SDK API provided by the
// core library.
//
// Don't use this directly, use "sdk_version: core_current".
java_library {
name: "core.current.stubs",
visibility: ["//visibility:public"],
static_libs: [
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"i18n.module.public.api.stubs",
],
sdk_version: "none",
system_modules: "none",
dist: {
targets: [
"sdk",
"win_sdk",
],
},
}
// Distributed with the SDK for turning into system modules to compile apps
// against.
java_library {
name: "core-current-stubs-for-system-modules",
visibility: ["//development/sdk"],
static_libs: [
"core.current.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
// This one is not on device but it's needed when javac compiles code
// containing @Generated annotations produced by some code generation
// tools.
// See http://b/123891440.
"core-generated-annotation-stubs",
],
sdk_version: "none",
system_modules: "none",
dist: {
dest: "core-for-system-modules.jar",
targets: [
"sdk",
"win_sdk",
],
},
}
// Used when compiling higher-level code against core.current.stubs.
java_system_modules {