@@ -13,59 +13,51 @@ List<Service> services = project.ext.services
1313
1414// Service renaming
1515Map<String , String > serviceNaming = project. ext. serviceNamingCamel
16- serviceNaming. putAll([
17- ' balancecontrol' : ' balanceControlService' ,
18- ])
1916
2017services. < Service > each { Service svc ->
2118 String serviceName = serviceNaming[svc. id]
2219
2320 // Generation
2421 tasks. named(" generate${ svc.name} " , GenerateTask ) {
2522 configFile. set(" $projectDir /config.yaml" )
23+
2624 additionalProperties. putAll([
2725 ' serviceName' : serviceName,
2826 ])
27+ // skip generation of models, docs, tests
28+ globalProperties. putAll([
29+ ' apis' : ' ' ,
30+ ' supportingFiles' : ' '
31+ ])
2932 }
3033
31- // Deployment
34+ // Copy services
3235 def deployServices = tasks. register(" deploy${ svc.name} Services" , Sync ) {
3336 group ' deploy'
3437 description " Deploy $svc . name into the repo."
3538 dependsOn " generate$svc . name "
3639 outputs. upToDateWhen { false }
37- onlyIf { ! svc. small && ! svc. webhook }
40+ onlyIf { ! svc. webhook }
41+
42+ // delete existing services
43+ doFirst {
44+ delete layout. projectDirectory. dir(" repo/lib/adyen/services/" + serviceName)
45+ }
3846
47+ // rename and copy generated services (i.e. bin_lookup_api.rb)
3948 from layout. buildDirectory. dir(" services/$svc . id /lib/openapi_client/api" )
4049 include ' *_api.rb'
4150 into layout. projectDirectory. dir(" repo/lib/adyen/services/" + serviceName)
4251
52+ // rename and copy generated service facades (i.e. binLookup.rb)
4353 from(layout. buildDirectory. dir(" services/$svc . id /api" )) {
4454 include ' api-single.rb'
4555 rename ' api-single.rb' , serviceName + ' .rb'
4656 into ' ..'
4757 }
4858 }
4959
50- def deploySmallService = tasks. register(" deploy${ svc.name} SmallService" , Copy ) {
51- group ' deploy'
52- description " Copy $svc . name into the repo."
53- dependsOn " generate$svc . name "
54- outputs. upToDateWhen { false }
55- onlyIf { svc. small }
56-
57- from layout. buildDirectory. file(" services/$svc . id /lib/openapi_client/api/default_api-small.rb" )
58- rename ' default_api-small.rb' , " ${ serviceName} .rb"
59- into layout. projectDirectory. dir(" repo/lib/adyen/services" )
60- }
61-
62- tasks. named(svc. id) { dependsOn deployServices, deploySmallService }
63- }
64-
65- tasks. named(' deployDataProtectionSmallService' , Copy ) {
66- filter {
67- it. replace(" 'DataProtection'" , " 'DataProtectionService'" )
68- }
60+ tasks. named(svc. id) { dependsOn deployServices }
6961}
7062
7163// Tests
@@ -77,7 +69,7 @@ tasks.named('checkout') {
7769}
7870tasks. named(' binlookup' ) {
7971 doLast {
80- assert file(" ${ layout.projectDirectory} /repo/lib/adyen/services/binLookup.rb" ). exists()
81- assert ! file(" ${ layout.projectDirectory} /repo/lib/adyen/services/binLookup" ). exists()
72+ assert file(" ${ layout.projectDirectory} /repo/lib/adyen/services/binLookup/bin_lookup_api .rb" ). exists()
73+ assert file(" ${ layout.projectDirectory} /repo/lib/adyen/services/binLookup" ). exists()
8274 }
8375}
0 commit comments