• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5
6// The `copyAdditionalJctfCommonFiles` task copies files common to all JCTF test
7// cases into an intermediate directory which is then passed to gradle as a
8// source set.
9//
10// Details:
11//
12// The JCTF source tree consists of individual test cases and other sources
13// common to all test cases. The latter is compiled into a single jar file.
14//
15// The problem is the many common source files are scattered under the same
16// directory where the test cases are and gradle has no simple way to add
17// individual files to a source set.
18//
19// That's why we first copy over the common files into an intermediate directory
20// then pass gradle the source set as a single directory.
21
22task copyAdditionalJctfCommonFiles(type: Copy) {
23    def prefix = 'LibTests/src/com/google/jctf/test/lib/java'
24    def inputDir = 'third_party/jctf'
25    def outputDir = 'build/additionalJctfCommonFiles'
26    doFirst {
27        delete outputDir
28    }
29
30    // All the files containing "@Test" and also the files located in a directory where there is "@Test"
31    // file will be compiled into individual, per-test dex files.
32    // Here we need the files not containing "@Test" which are not siblings of "@Test" files. We compile
33    // them into a common jar file which will be added into each test's dex file.
34    //
35    // The following list is compiled with this script:
36    //
37    // # create list of directories that contain non-"@Test" files but do not contain "@Test" files
38    // dirlist=$(comm -23 \
39    // <(grep -rL "@Test" "third_party/jctf/LibTests/src/com/google/jctf/test/lib" --include=*.java | sed 's;/[^/]*\.java$;;' | sort | uniq) \
40    // <(grep -rl "@Test" "third_party/jctf/LibTests/src/com/google/jctf/test/lib" --include=*.java | sed 's;/[^/]*\.java$;;' | sort | uniq))
41    //
42    // # all the java files from these dirs
43    // (for d in $dirlist; do ls -1 $d/*.java; done) \
44    //   | sort | sed 's,.*test/lib/java/,,' | sed -E "s/(.*)/'\1',/"
45    def files = [
46        'lang/annotation/Annotation/AllTypesAntn2.java',
47        'lang/annotation/Annotation/AllTypesAntn.java',
48        'lang/Character/CharacterData.java',
49        'lang/Character/CharacterUtils.java',
50        'lang/Character/Subset/TestSubset.java',
51        'lang/Class/ClassAnnotationsData.java',
52        'lang/ClassLoader/EmptyCertificate.java',
53        'lang/ClassLoader/EmptyClassLoader.java',
54        'lang/ClassLoader/setPackageAssertionStatusLjava_lang_StringZ/pckg1/pckg11/C01.java',
55        'lang/ClassLoader/setPackageAssertionStatusLjava_lang_StringZ/pckg1/pckg11/pckg111/C01.java',
56        'lang/ClassLoader/setPackageAssertionStatusLjava_lang_StringZ/pckg1/pckg11/pckg111/C02.java',
57        'lang/ClassLoader/setPackageAssertionStatusLjava_lang_StringZ/pckg1/pckg12/C01.java',
58        'lang/Class/PackageAccessible.java',
59        'lang/Class/PackageInstantiable.java',
60        'lang/Enum/EnumMocks.java',
61        'lang/InheritableThreadLocal/TestThread.java',
62        'lang/Number/TestNumber.java',
63        'lang/Package/PackageAnnotationsData.java',
64        'lang/Package/PackageLoader.java',
65        'lang/ProcessBuilder/ProcessBuilderHelper.java',
66        'lang/reflect/AccessibleObject/ChildTestClass.java',
67        'lang/reflect/AccessibleObject/ClassTestAnnotation.java',
68        'lang/reflect/AccessibleObject/DefaultTestAnnotation.java',
69        'lang/reflect/AccessibleObject/Helper.java',
70        'lang/reflect/AccessibleObject/Runtime1TestAnnotation.java',
71        'lang/reflect/AccessibleObject/Runtime2TestAnnotation.java',
72        'lang/reflect/AccessibleObject/Runtime3TestAnnotation.java',
73        'lang/reflect/AccessibleObject/SourceTestAnnotation.java',
74        'lang/reflect/AccessibleObject/TestClass.java',
75        'lang/reflect/Constructor/ConstructorAnnotationsData.java',
76        'lang/reflect/Constructor/ConstructorTestHelper.java',
77        'lang/reflect/Constructor/PrivateClass.java',
78        'lang/reflect/Constructor/PrivateConstructor.java',
79        'lang/reflect/Field/FieldAnnotationsData.java',
80        'lang/reflect/Field/TestExceptionInInitializerError.java',
81        'lang/reflect/Field/TestFinalObjectField.java',
82        'lang/reflect/Field/TestFinalPrimitiveField.java',
83        'lang/reflect/Field/TestObjectField.java',
84        'lang/reflect/Field/TestOtherField.java',
85        'lang/reflect/Field/TestPrimitiveField.java',
86        'lang/reflect/Field/TestStaticFinalObjectField.java',
87        'lang/reflect/Field/TestStaticFinalPrimitiveField.java',
88        'lang/reflect/Field/TestStaticObjectField.java',
89        'lang/reflect/Field/TestStaticPrimitiveField.java',
90        'lang/reflect/Method/AbstractTestMethod.java',
91        'lang/reflect/Method/MethodAnnotationsData.java',
92        'lang/reflect/Method/PrivateClass.java',
93        'lang/reflect/Method/PrivateMethod.java',
94        'lang/reflect/Method/TestMethod.java',
95        'lang/reflect/Method/TestMethodSub.java',
96        'lang/reflect/Proxy/HiddenInterface.java',
97        'lang/reflect/Proxy/NullHandler.java',
98        'lang/ref/MemoryHog.java',
99        'lang/ref/MyReferenceQueue.java',
100        'lang/ref/PhantomReference/MyPhantomReference.java',
101        'lang/ref/SoftReference/MySoftReference.java',
102        'lang/ref/WeakReference/MyWeakReference.java',
103        'lang/Runtime/CountLoads.java',
104        'lang/Runtime/CWD.java',
105        'lang/Runtime/EchoArgs.java',
106        'lang/Runtime/EchoEnv.java',
107        'lang/SecurityManager/CheckingDomain.java',
108        'lang/SecurityManager/SecurityManagerTest.java',
109        'lang/StackTraceElement/ElementData.java',
110        'lang/StackTraceElement/InitTestFixture.java',
111        'lang/StackTraceElement/StaticInitTestFixture.java',
112        'lang/StackTraceElement/TestFixture.java',
113        'lang/StrictMath/FPUtil.java',
114        'lang/StringBuffer/MultiThreadTestHelper.java',
115        'lang/String/String_Character.java',
116        'lang/String/StringHelper.java',
117        'lang/String/String_ISO88591.java',
118        'lang/String/String_UnicodeCodePoint.java',
119        'lang/String/String_USASCII.java',
120        'lang/String/String_UTF16BE.java',
121        'lang/String/String_UTF16.java',
122        'lang/String/String_UTF16LE.java',
123        'lang/String/String_UTF8.java',
124        'lang/System/System_propertyKeys.java',
125        'lang/Thread/CatchThread.java',
126        'lang/Thread/CheckHandler.java',
127        'lang/Thread/CheckRun.java',
128        'lang/ThreadGroup/AccessCheckThread.java',
129        'lang/ThreadGroup/CatchGroup.java',
130        'lang/ThreadGroup/MyThread.java',
131        'lang/ThreadGroup/SMTestCheckAccessThreadGroupThrowSE.java',
132        'lang/ThreadGroup/SMTestCheckAccessThreadGroupWasCalled.java',
133        'lang/ThreadGroup/SMTestCheckAccessThreadThrowSE.java',
134        'lang/ThreadGroup/ThreadGroupHelper.java',
135        'lang/Thread/SlowIncThread.java',
136        'lang/Thread/StepThread.java',
137        'lang/Thread/WaitRun.java',
138        'lang/Throwable/Exception1.java',
139        'lang/Throwable/Exception2.java',
140        'lang/Throwable/Exception3.java',
141        'lang/Throwable/MethodStackFixture.java',
142        'lang/Throwable/MultipleExceptionsFixture.java',
143        'lang/Throwable/MultipleExceptionsStackChecker.java',
144        'util/concurrent/AbstractExecutorService/DirectExecutorService.java',
145        'util/concurrent/AdjustablePolicy.java',
146        'util/concurrent/ArrayBlockingQueue/ArrayBlockingQueueHelper.java',
147        'util/concurrent/CheckedCallable.java',
148        'util/concurrent/CheckedInterruptedCallable.java',
149        'util/concurrent/CheckedInterruptedRunnable.java',
150        'util/concurrent/CheckedRunnable.java',
151        'util/concurrent/ConcurrentHashMap/ConcurrentHashMapHelper.java',
152        'util/concurrent/ConcurrentLinkedQueue/ConcurrentLinkedQueueHelper.java',
153        'util/concurrent/ConcurrentSkipListMap/ConcurrentSkipListMapHelper.java',
154        'util/concurrent/ConcurrentSkipListSet/ConcurrentSkipListSetHelper.java',
155        'util/concurrent/ConcurrentSkipListSet/MyReverseComparator.java',
156        'util/concurrent/CopyOnWriteArrayList/CopyOnWriteArrayListHelper.java',
157        'util/concurrent/CopyOnWriteArraySet/CopyOnWriteArraySetHelper.java',
158        'util/concurrent/CyclicBarrier/MyAction.java',
159        'util/concurrent/DelayQueue/DelayQueueHelper.java',
160        'util/concurrent/DelayQueue/NanoDelay.java',
161        'util/concurrent/DelayQueue/PDelay.java',
162        'util/concurrent/FutureTask/CounterCallable.java',
163        'util/concurrent/FutureTask/PublicFutureTask.java',
164        'util/concurrent/Helper.java',
165        'util/concurrent/InterruptedCallable.java',
166        'util/concurrent/InterruptingCallable.java',
167        'util/concurrent/LinkedBlockingDeque/LinkedBlockingDequeHelper.java',
168        'util/concurrent/LinkedBlockingQueue/LinkedBlockingQueueHelper.java',
169        'util/concurrent/MediumPossiblyInterruptedRunnable.java',
170        'util/concurrent/MediumRunnable.java',
171        'util/concurrent/NoOpCallable.java',
172        'util/concurrent/NoOpREHandler.java',
173        'util/concurrent/NoOpRunnable.java',
174        'util/concurrent/NPETask.java',
175        'util/concurrent/PriorityBlockingQueue/MyReverseComparator.java',
176        'util/concurrent/PriorityBlockingQueue/PriorityBlockingQueueHelper.java',
177        'util/concurrent/RunnableShouldThrow.java',
178        'util/concurrent/ScheduledThreadPoolExecutor/CustomExecutor.java',
179        'util/concurrent/ScheduledThreadPoolExecutor/CustomTask.java',
180        'util/concurrent/ScheduledThreadPoolExecutor/RunnableCounter.java',
181        'util/concurrent/Semaphore/InterruptedLockRunnable.java',
182        'util/concurrent/Semaphore/InterruptibleLockRunnable.java',
183        'util/concurrent/Semaphore/PublicSemaphore.java',
184        'util/concurrent/ShortRunnable.java',
185        'util/concurrent/SimpleThreadFactory.java',
186        'util/concurrent/SmallCallable.java',
187        'util/concurrent/SmallPossiblyInterruptedRunnable.java',
188        'util/concurrent/SmallRunnable.java',
189        'util/concurrent/StringTask.java',
190        'util/concurrent/ThreadPoolExecutor/CustomTask.java',
191        'util/concurrent/ThreadPoolExecutor/CustomTPE.java',
192        'util/concurrent/ThreadPoolExecutor/ExtendedTPE.java',
193        'util/concurrent/ThreadPoolExecutor/FailingThreadFactory.java',
194        'util/concurrent/ThreadShouldThrow.java',
195        'util/concurrent/TrackedCallable.java',
196        'util/concurrent/TrackedLongRunnable.java',
197        'util/concurrent/TrackedNoOpRunnable.java',
198        'util/concurrent/TrackedShortRunnable.java',
199    ]
200    files.each {
201        def dir = new File(it).parent
202        from ("$inputDir/$prefix/$it") {
203            into "$prefix/$dir"
204        }
205
206    }
207
208    def prefixNoPackage = 'LibTests/src'
209    def filesNoPackage = [
210        'DefaultPackageInterface.java',
211        'UnnamedPackageClass.java'
212    ]
213    filesNoPackage.each {
214        from ("$inputDir/$prefixNoPackage/$it") {
215            into "$prefixNoPackage"
216        }
217    }
218
219    into outputDir
220}
221