diff --git a/modules.gradle b/modules.gradle index e725a09a..0c06909f 100644 --- a/modules.gradle +++ b/modules.gradle @@ -32,7 +32,6 @@ configure(subprojects.findAll { it.name.startsWith('modules/') }) { } dependencies { - compile project(':android') compile group: 'com.google.android', name: 'android', version: '2.3.3' compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.3' compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.3' @@ -56,69 +55,71 @@ configure(subprojects.findAll { it.name.startsWith('modules/') }) { } } -task createModule << { - def console = System.console() +task createModule { + doLast { + def console = System.console() + + if (console) { + def all = project.hasProperty('all') + + def contexts = read("${N}Context", project.ext['contexts']) + def String platforms = project.ext['platforms'] + def url = project.ext['url'] + def filter = project.ext['filter'] + def portalVersion = project.ext['portalVersion'] + def version = project.version + def packageName = project.ext['packageName'] + def description = project.description + + if (all) { + platforms = read('Platforms', platforms) + url = read('Server URL', url) + filter = read('Filter', filter, false) + portalVersion = read('Portal Version', portalVersion) + version = read('Module Version', version) + } - if (console) { - def all = project.hasProperty('all') - - def contexts = read("${N}Context", project.ext['contexts']) - def String platforms = project.ext['platforms'] - def url = project.ext['url'] - def filter = project.ext['filter'] - def portalVersion = project.ext['portalVersion'] - def version = project.version - def packageName = project.ext['packageName'] - def description = project.description - - if (all) { - platforms = read('Platforms', platforms) - url = read('Server URL', url) - filter = read('Filter', filter, false) - portalVersion = read('Portal Version', portalVersion) - version = read('Module Version', version) - } + def moduleDir = "${project.rootDir}/modules/$contexts/" + file(moduleDir).mkdirs() - def moduleDir = "${project.rootDir}/modules/$contexts/" - file(moduleDir).mkdirs() + def props = file("$moduleDir/gradle.properties") + props.createNewFile() - def props = file("$moduleDir/gradle.properties") - props.createNewFile() + write(props, 'contexts', contexts) + write(props, 'destination', '.') - write(props, 'contexts', contexts) - write(props, 'destination', '.') + if (all) { + write(props, 'platforms', platforms) + write(props, 'url', url) + write(props, 'filter', filter) + write(props, 'portalVersion', portalVersion) + write(props, 'version', version, project.version) + } - if (all) { - write(props, 'platforms', platforms) - write(props, 'url', url) - write(props, 'filter', filter) - write(props, 'portalVersion', portalVersion) - write(props, 'version', version, project.version) - } + if (platforms.contains('android')) { + packageName = read('Package Name', packageName) + description = read('POM Description', description) - if (platforms.contains('android')) { - packageName = read('Package Name', packageName) - description = read('POM Description', description) + write(props, 'packageName', packageName) + write(props, 'description', description, project.description) + } - write(props, 'packageName', packageName) - write(props, 'description', description, project.description) + generate.args = [ + "platforms=$platforms", + "url=$url", + "contexts=$contexts", + "filter=$filter", + "packageName=$packageName", + "portalVersion=$portalVersion", + "destination=$moduleDir" + ] + + println addTextColor("Module was successfully created at ${moduleDir}.", COLORS.GREEN) + println addTextColor("SDK Builder will generate now all services with the details you provided.", COLORS.GREEN) + } + else { + println addTextColor("Error while getting console.", COLORS.RED) } - - generate.args = [ - "platforms=$platforms", - "url=$url", - "contexts=$contexts", - "filter=$filter", - "packageName=$packageName", - "portalVersion=$portalVersion", - "destination=$moduleDir" - ] - - println addTextColor("Module was successfully created at ${moduleDir}.", COLORS.GREEN) - println addTextColor("SDK Builder will generate now all services with the details you provided.", COLORS.GREEN) - } - else { - println addTextColor("Error while getting console.", COLORS.RED) } }