Mercurial > public > develkit
comparison init20.gradle @ 188:711ef14d18d2
add object to determine available memory on linux
author | smith@nwoca.org |
---|---|
date | Thu, 26 Mar 2015 17:26:44 +0100 |
parents | 6d5b9cf9fd97 |
children | a80191d5a6ca |
comparison
equal
deleted
inserted
replaced
187:6d5b9cf9fd97 | 188:711ef14d18d2 |
---|---|
53 def shortName = springModuleTranslator[details.requested.name.replace('org.springframework.', 'spring-').replace('.', '-')] | 53 def shortName = springModuleTranslator[details.requested.name.replace('org.springframework.', 'spring-').replace('.', '-')] |
54 details.useTarget("${details.requested.group}:$shortName:${details.requested.version}") | 54 details.useTarget("${details.requested.group}:$shortName:${details.requested.version}") |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 gradle.ext.runtimeInfo = new RuntimeInfo() | |
59 | |
58 gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch')) | 60 gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch')) |
59 gradle.ext.branchName = gradle.branch.name | 61 gradle.ext.branchName = gradle.branch.name |
60 gradle.ext.branchStream = gradle.branch.stream | 62 gradle.ext.branchStream = gradle.branch.stream |
61 gradle.ext.branchHash = gradle.branch.hash | 63 gradle.ext.branchHash = gradle.branch.hash |
62 println "${gradle.hgRepositoryUrl} ${gradle.branch}" | 64 println "${gradle.hgRepositoryUrl} ${gradle.branch}" |
65 println "$gradle.runtimeInfo" | |
63 | 66 |
64 loadEnvironments() | 67 loadEnvironments() |
65 | 68 |
66 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl) | 69 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl) |
67 gradle.environment.put('branchName', gradle.branch.name) | 70 gradle.environment.put('branchName', gradle.branch.name) |
494 gradle.ext.environments = environments | 497 gradle.ext.environments = environments |
495 | 498 |
496 } | 499 } |
497 | 500 |
498 | 501 |
502 @ToString(includeNames=true) | |
503 class RuntimeInfo { | |
504 // OS memory in megabytes, zero if unknown | |
505 int systemMemory = 0 | |
506 int systemFreeMemory = 0 | |
507 | |
508 RuntimeInfo() { | |
509 try { | |
510 new File('/proc/meminfo').readLines().findAll { it.startsWith 'Mem' }.collect { it.split(/\s+/) }.each { | |
511 int value = (it[1] as Long) / 1024 | |
512 if (it[0].startsWith('MemTotal')) { systemMemory = value } | |
513 if (it[0].startsWith('MemFree')) { systemFreeMemory = value } | |
514 } | |
515 | |
516 } catch (e) { } | |
517 | |
518 } | |
519 | |
520 } | |
521 | |
522 | |
523 | |
499 @ToString | 524 @ToString |
500 class BranchInfo { | 525 class BranchInfo { |
501 def name | 526 def name |
502 def stream = "none" | 527 def stream = "none" |
503 | 528 |