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"system/RuntimePermissions",
103"system/RuntimePermissionsBasic",
104"wearable/wear/RuntimePermissionsWear",
105"notification/ActiveNotifications",
106"media/Camera2Raw",
107"content/AutoBackupForApps",
108"ui/window/MultiWindowPlayground",
109"content/documentsUi/ScopedDirectoryAccess",
110"security/DirectBoot",
111"content/DirectShare",
112"media/MidiScope",
113"media/MidiSynth",
114"wearable/wear/WearSpeakerSample",
115"wearable/wear/WearDrawers",
116"ui/window/DragAndDropAcrossApps",
117"wearable/wear/WearNotifications",
118"system/AppShortcuts",
119"input/keyboard/CommitContentSampleApp",
120"input/keyboard/CommitContentSampleIME",
121"content/ShareActionProvider",
122"wearable/wear/WearVerifyRemoteApp",
123"wearable/wear/WearHighBandwidthNetworking",
124"content/documentsUi/ContentProviderPaging",
125"notification/NotificationChannels",
126"media/PictureInPicture",
127"input/autofill/AutofillFramework",
128"views/EmojiCompat",
129"ui/fonts/DownloadableFonts",
130"wearable/wear/WearComplicationProvidersTestSuite",
131]
132
133List<String> taskNames = [
134    "clean",
135    "refresh",
136    "assembleDebug",
137    "build",
138    "check",
139    "connectedCheck",
140    "deviceCheck",
141    "emitAnt",
142    "emitGradle",
143    "emitBrowseable",
144    "emitGradleZip",
145]
146
147taskNames.each { taskName ->
148    def task = project.hasProperty(taskName) ? project.tasks[taskName] : project.task(taskName)
149    println task
150    samples.each { sample ->
151        File sampleDir = new File(sample)
152        task.dependsOn project.task([type: GradleBuild], "${sample}_${taskName}", {
153            buildFile = "${sample}/build.gradle"
154            dir = sample
155            tasks = [taskName]
156        })
157    }
158}
159