Skip to content

Commit

Permalink
Merge pull request #14 from bancolombia/feature/validateTask
Browse files Browse the repository at this point in the history
Feature/validate task
  • Loading branch information
santitigaga authored Jan 8, 2020
2 parents 3ade131 + e6a3806 commit 80bc675
Show file tree
Hide file tree
Showing 23 changed files with 1,414 additions and 416 deletions.
18 changes: 9 additions & 9 deletions .idea/modules/pluginClean.functionalTest.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules/pluginClean.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions .idea/modules/pluginClean.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions .idea/modules/pluginClean.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 41 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ Gradle plugin to create a java application based on Clean Architecture following
Plugin Implementation
===================
To use the plugin you need Gradle version 5 or later, to start add the following section into your
build.gradle file.
**build.gradle** file.

```groovy
plugins {
id "co.com.bancolombia.cleanArchitecture" version "0.53"
id "co.com.bancolombia.cleanArchitecture" version "1.0"
}
```



Tasks
=====
The Scaffolding Clean Architecture plugin will allow you create 1 task (more tasks are comming) :
The Scaffolding Clean Architecture plugin will allow you create 6 task :

1 The ```cleanArchitecture``` task will generate a clean architecture structure in your project, this task have three optional parameters; ```package``` , ```type``` and ```name```.
1 The ```cleanArchitecture | ca``` task will generate a clean architecture structure in your project, this task have three optional parameters; ```package``` , ```type``` and ```name```.

```package = <package.we.need>```: You can specify the main or default package of your project. ```Default Value = co.com.bancolombia```

Expand All @@ -33,22 +33,51 @@ The Scaffolding Clean Architecture plugin will allow you create 1 task (more tas

```sh
gradle cleanArchitecture --package=co.com.bancolombia --type=imperative --name=NameProject
gradle ca
```

2 The ```generateModel``` task will generate a class and interface in model layer, this task have one required parameter ```name```.
2 The ```generateModel | gm``` task will generate a class and interface in model layer, this task have one required parameter ```name```.
```sh
gradle generateModel --name=modelName
gradle generateModel --name=[modelName]
gradle gm --name [modelName]
```
3 The ```generateUseCase | guc``` task will generate a class in model layer, this task have one required parameter ```name```.
```sh
gradle generateUseCase --name=[useCaseName]
gradle guc --name [useCaseName]
```
4 The ```generateDrivenAdapter | gda``` task will generate a class in Infraestucture layer, this task have one required parameter ```value```.
```sh
gradle generateDrivenAdapter --value=[referenceNumberDrivenAdapter]
gradle gda --value [referenceNumberDrivenAdapter]
```

| Reference number driven adapter | Name |
| ------------------ | ------------ |
| 1|JPA Repository |
| 2|Mongo Repository |
| 3|Secrets Manager Consumer |

3 The ```validateStructure``` Validate that project references are not violated.
5 The ```generateEntryPoint | gep``` task will generate a class in Infraestructure layer, this task have one required parameter ```value```.
```sh
gradle validateStructure
gradle generateEntryPoint --value=referenceNumberEntryPoint
gradle gs --value referenceNumberEntryPoint
```
| Reference number entry point | Name |
| ------------------ | ------------ |
| 1|API REST (Spring Boot Starter Web) |



6 The ```validateStructure | vs``` Validate that project references aren't violated.
```sh
gradle validateStructure
gradle vs
```



How I can help?
=============
The following functionalities are within the road map of this script:
Review the issues, we hear new ideas.

- Task to generate entry points
- Task to generate driven adapters
- Task to generate usecase
36 changes: 35 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:2.9.0"


compile gradleApi()
}

Expand Down Expand Up @@ -90,7 +91,40 @@ jacocoTestReport{
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled false
html.enabled true
csv.enabled false
}
}
FileTree buildFiles = fileTree(rootDir) {
List excludes = gradle.startParameter.projectProperties.get("excludeProjects")?.split(",")
include '**/*.gradle'
exclude 'applications/admin-server', 'main.gradle','build', '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*', 'out'
if(excludes) {
exclude excludes
}
}

buildFiles.each { File buildFile ->

boolean isDefaultName = 'build.gradle'.equals(buildFile.name)
if(isDefaultName) {
String projectName = buildFile.parentFile.name
String projectPath = ':' + projectName
include projectPath
def project = findProject("${projectPath}")
project.name = buildFile.parentFile.parentFile.name + '-' + projectName
project.projectDir = buildFile.parentFile
project.buildFileName = buildFile.name

} else {
String projectName = buildFile.name.replace('.gradle', '')
String projectPath = ':' + projectName
include projectPath
def project = findProject("${projectPath}")
project.name = projectName
project.projectDir = buildFile.parentFile
project.buildFileName = buildFile.name
}
}


2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
package=co.com.bancolombia
systemProp.version=0.53
systemProp.version=1.0
Loading

0 comments on commit 80bc675

Please sign in to comment.