@@ -108,17 +108,27 @@ def shouldSkipNative(task) {
108108}
109109
110110/* ******************************************************************************************
111- * Task Rule : builds all the natives in this module for a given platform.
111+ * Task Rule : buildNatives[_PlatformName]
112112 *
113- * Example : gradle buildNatives_win_x86_64 will build all win_x86_64 native executables and shared libraries .
114- *
115- * NOTE: you must be on the appropriate platform for this to work .
113+ * Summary: Builds all the natives in this module for a given platform .
114+ *
115+ * Args: PlatformName - The name of the platform. If not specified, the current platform is used .
116116 *
117+ * Example: gradle buildNatives_win_x86_64 will build all win_x86_64 native executables and shared libraries.
118+ *
119+ * NOTE: you must be on the appropriate platform for this to work.
117120 ******************************************************************************************/
118- tasks. addRule(" Pattern: buildNatives_<platform name> ]: build all natives for given platform" ) { String taskName ->
121+ tasks. addRule(" Pattern: buildNatives[_PlatformName ]: build all natives for given platform" ) { String taskName ->
119122
120- if (taskName. startsWith(" buildNatives_" )) {
121- String platform = taskName - " buildNatives_"
123+ if (taskName. startsWith(" buildNatives" )) {
124+ String currentPlatform = getCurrentPlatformName()
125+ String platform = taskName - " buildNatives"
126+ if (platform. length() == 0 ) {
127+ platform = currentPlatform
128+ }
129+ if (platform. startsWith(" _" )) {
130+ platform = platform - " _"
131+ }
122132
123133 task(taskName) { myTask ->
124134
@@ -157,20 +167,30 @@ tasks.addRule("Pattern: buildNatives_<platform name>]: build all natives for giv
157167 }
158168}
159169
160- /* ******************************************************************************************
161- * Task Rule : builds all the natives in this module for a given platform and copies the
162- * results to the bin repo.
170+ /* ******************************************************************************************
171+ * Task Rule : prebuildNatives[_PlatformName]
172+ *
173+ * Summary: Builds all the natives in this module for a given platform and copies the results
174+ * to the bin repo.
163175 *
164- * Example : gradle prebuildNatives_win_x86_64 will build all win_x86_64 native executables and shared
165- * libraries and copy the results to the appropriate project/os directory in the bin
166- * repo.
167- *
168- * NOTE: you must be on the appropriate platform for this to work.
176+ * Args: PlatformName - The name of the platform. If not specified, the current platform is used.
169177 *
178+ * Example: gradle prebuildNatives_win_x86_64 will build all win_x86_64 native executables and
179+ * shared libraries and copy the results to the appropriate project/os directory in
180+ * the bin repo.
181+ *
182+ * NOTE: you must be on the appropriate platform for this to work.
170183 ******************************************************************************************/
171- tasks. addRule(" Pattern: prebuildNatives_<platform name>]: build all natives for given platform" ) { String taskName ->
172- if (taskName. startsWith(" prebuildNatives_" )) {
173- String platform = taskName - " prebuildNatives_"
184+ tasks. addRule(" Pattern: prebuildNatives<_platform name>]: build all natives for given platform" ) { String taskName ->
185+ if (taskName. startsWith(" prebuildNatives" )) {
186+ def currentPlatform = getCurrentPlatformName()
187+ def platform = taskName - " prebuildNatives"
188+ if (platform. length() == 0 ) {
189+ platform = currentPlatform
190+ }
191+ if (platform. startsWith(" _" )) {
192+ platform = platform - " _"
193+ }
174194
175195 task(taskName) { myTask ->
176196 dependsOn " buildNatives_$platform "
@@ -214,8 +234,7 @@ gradle.taskGraph.whenReady {
214234}
215235
216236/* ****************************************************************************************
217- * The following block of code ensures that the buildNatives_<platform> task is used
218- * during assembly to ensure that missing toolchain generates an appropriate error
237+ * The following block of code ensures that the buildNatives (for current plaform) task is
238+ * used during assembly to ensure that missing toolchain generates an appropriate error
219239 ****************************************************************************************/
220- def currentPlatform = getCurrentPlatformName()
221- assemble. dependsOn " buildNatives_$currentPlatform "
240+ assemble. dependsOn " buildNatives"
0 commit comments