comparison init20.gradle @ 200:8aab0c2c1259

add helpers for memory checks
author smith@nwoca.org
date Fri, 14 Aug 2015 16:13:24 +0100
parents 5bc8264bb979
children e721a977726b e90ce1d50d85
comparison
equal deleted inserted replaced
199:5bc8264bb979 200:8aab0c2c1259
532 } 532 }
533 533
534 } catch (e) { } 534 } catch (e) { }
535 535
536 } 536 }
537
538 void requireMemory(int megabytes) {
539 if (systemFreeMemory > 0 && systemFreeMemory < megabytes) {
540 throw new GradleException("insufficent free OS memory for this build (available: ${systemFreeMemory}m, required: ${megabytes}m)")
541 }
542 }
543 /**
544 * Returns maximum memory available upto the value specified.
545 */
546 int maxMemory(int megabytes) {
547 if (systemFreeMemory) {
548 [systemFreeMemory,megabytes].min()
549 } else { megabytes }
550
551 }
537 552
538 } 553 }
539 554
540 555
541 556