Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Fix createModules task
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Melo committed Aug 3, 2018
1 parent 4cca012 commit e38dea1
Showing 1 changed file with 57 additions and 56 deletions.
113 changes: 57 additions & 56 deletions modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
}
}

Expand Down

0 comments on commit e38dea1

Please sign in to comment.