1List<String> samples = [
2"security/keystore/BasicAndroidKeyStore",
3"connectivity/sync/BasicSyncAdapter",
4"connectivity/network/NetworkConnect",
5"connectivity/network/BasicNetworking",
6"connectivity/bluetooth/BluetoothLeGatt",
7"content/multiuser/AppRestrictions",
8"content/contacts/BasicContactables",
9"content/documentsUi/StorageClient",
10"content/documentsUi/StorageProvider",
11"views/TextLinkify",
12"input/gestures/BasicGestureDetect",
13"input/multitouch/BasicMultitouch",
14"testing/ActivityInstrumentation",
15"media/MediaRecorder",
16"media/BasicMediaRouter",
17"media/BasicMediaDecoder",
18"ui/holo/BorderlessButtons",
19"ui/accessibility/BasicAccessibility",
20"ui/lists/CustomChoiceList",
21"ui/views/TextSwitcher",
22"ui/views/HorizontalPaging",
23"ui/actionbarcompat/ActionBarCompat-Basic",
24"ui/actionbarcompat/ActionBarCompat-Styled",
25"ui/actionbarcompat/ActionBarCompat-ListPopupMenu",
26"notification/BasicNotifications",
27"notification/CustomNotifications",
28"ui/actionbar/DoneBar",
29"ui/graphics/PdfRendererBasic",
30"ui/window/BasicImmersiveMode",
31"ui/window/AdvancedImmersiveMode",
32"ui/window/ImmersiveMode",
33"background/alarms/RepeatingAlarm",
34"renderScript/BasicRenderScript",
35"renderScript/RenderScriptIntrinsic",
36"ui/views/SlidingTabs/SlidingTabsBasic",
37"ui/views/SlidingTabs/SlidingTabsColors",
38"connectivity/nfc/BeamLargeFiles",
39"connectivity/nfc/CardEmulation",
40"connectivity/nfc/CardReader",
41"sensors/BatchStepSensor",
42"ui/graphics/DisplayingBitmaps",
43"ui/transition/BasicTransition",
44"ui/transition/CustomTransition",
45"ui/views/SwipeRefreshLayout/SwipeRefreshLayoutBasic",
46"ui/views/SwipeRefreshLayout/SwipeRefreshListFragment",
47"ui/views/SwipeRefreshLayout/SwipeRefreshMultipleViews",
48"media/MediaBrowserService",
49"media/MediaRouter",
50"media/MediaEffects",
51"admin/BasicManagedProfile",
52"media/Camera2Basic",
53"media/Camera2Video",
54"ui/activityscenetransition/ActivitySceneTransitionBasic",
55"ui/views/NavigationDrawer",
56"ui/views/Elevation/ElevationBasic",
57"ui/views/Elevation/ElevationDrag",
58"ui/views/Clipping/ClippingBasic",
59"ui/views/FloatingActionButton/FloatingActionButtonBasic",
60"ui/views/RevealEffect/RevealEffectBasic",
61"background/JobScheduler",
62"ui/views/RecyclerView",
63"ui/views/CardView",
64"notification/LNotifications",
65"notification/MessagingService",
66"ui/DrawableTinting",
67"ui/Interpolator",
68"media/HdrViewfinder",
69"ui/activitytasks/DocumentCentricApps",
70"ui/activitytasks/DocumentCentricRelinquishIdentity",
71"admin/AppRestrictionEnforcer",
72"admin/AppRestrictionSchema",
73"connectivity/bluetooth/BluetoothChat",
74"wearable/wear/AgendaData",
75"wearable/wear/DataLayer",
76"wearable/wear/DelayedConfirmation",
77"wearable/wear/ElizaChat",
78"wearable/wear/FindMyPhone",
79"wearable/wear/Flashlight",
80"wearable/wear/Geofencing",
81"wearable/wear/GridViewPager",
82"wearable/wear/JumpingJack",
83"wearable/wear/Notifications",
84"wearable/wear/Quiz",
85"wearable/wear/RecipeAssistant",
86"wearable/wear/SkeletonWearableApp",
87"wearable/wear/SpeedTracker",
88"wearable/wear/SynchronizedNotifications",
89"wearable/wear/Timer",
90"wearable/wear/WatchViewStub",
91"wearable/wear/WatchFace",
92"content/webview/PermissionRequest",
93"content/documentsUi/DirectorySelection",
94"system/AppUsageStatistics",
95"media/ScreenCapture",
96"admin/NfcProvisioning",
97"admin/DeviceOwner",
98"wearable/wear/XYZTouristAttractions",
99"connectivity/bluetooth/BluetoothAdvertisements",
100"wearable/wear/AlwaysOn",
101"security/ConfirmCredential",
102"security/FingerprintDialog",
103"system/RuntimePermissions",
104"system/RuntimePermissionsBasic",
105"wearable/wear/RuntimePermissionsWear",
106"notification/ActiveNotifications",
107"media/Camera2Raw",
108"content/AutoBackupForApps",
109"ui/window/MultiWindowPlayground",
110"content/documentsUi/ScopedDirectoryAccess",
111"security/DirectBoot",
112"content/DirectShare",
113"media/MidiScope",
114"media/MidiSynth",
115"security/AsymmetricFingerprintDialog",
116"wearable/wear/WearSpeakerSample",
117"wearable/wear/WearDrawers",
118"ui/window/DragAndDropAcrossApps",
119"wearable/wear/WearNotifications",
120"system/AppShortcuts",
121"input/keyboard/CommitContentSampleApp",
122"input/keyboard/CommitContentSampleIME",
123"content/ShareActionProvider",
124"wearable/wear/WearVerifyRemoteApp",
125"wearable/wear/WearHighBandwidthNetworking",
126"content/documentsUi/ContentProviderPaging",
127"notification/NotificationChannels",
128"media/PictureInPicture",
129"input/autofill/AutofillFramework",
130"views/EmojiCompat",
131"ui/fonts/DownloadableFonts",
132"wearable/wear/WearComplicationProvidersTestSuite",
133]
134
135List<String> taskNames = [
136    "clean",
137    "refresh",
138    "assembleDebug",
139    "build",
140    "check",
141    "connectedCheck",
142    "deviceCheck",
143    "emitAnt",
144    "emitGradle",
145    "emitBrowseable",
146    "emitGradleZip",
147]
148
149taskNames.each { taskName ->
150    def task = project.hasProperty(taskName) ? project.tasks[taskName] : project.task(taskName)
151    println task
152    samples.each { sample ->
153        File sampleDir = new File(sample)
154        task.dependsOn project.task([type: GradleBuild], "${sample}_${taskName}", {
155            buildFile = "${sample}/build.gradle"
156            dir = sample
157            tasks = [taskName]
158        })
159    }
160}
161