feat: [dep] init analysis

上级 9a8ab9a8
......@@ -514,6 +514,8 @@ results
- [ ] plugin support
- [ ] 3rd-party Dependence Analysis
- [ ] analysis XML or Groovy Scripts
- [ ] Groovy Support
- [ ] migrate to Golang Styles
Documents Todo:
......
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.2.2.RELEASE'
}
apply plugin: 'io.spring.dependency-management'
group = 'study.huhao.demo'
version = '1.0.0'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
exclude module: 'junit'
}
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.5.2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.1'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.1.1'
implementation 'org.flywaydb:flyway-core'
testImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:6.0.0'
testImplementation 'io.rest-assured:rest-assured'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.12.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:0.12.0'
}
test {
useJUnitPlatform()
}
package deps
import (
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/phodal/coca/core/infrastructure/ast/groovy"
. "github.com/phodal/coca/languages/groovy"
)
func Analysis(str string) {
parser := ProcessGroovyString(str)
context := parser.CompilationUnit()
listener := new(groovy.GroovyIdentifierListener)
antlr.NewParseTreeWalker().Walk(listener, context)
}
func ProcessGroovyString(code string) *GroovyParser {
is := antlr.NewInputStream(code)
lexer := NewGroovyLexer(is)
stream := antlr.NewCommonTokenStream(lexer, 0)
parser := NewGroovyParser(stream)
return parser
}
package deps
import (
. "github.com/onsi/gomega"
"testing"
)
func TestAnalysis(t *testing.T) {
g := NewGomegaWithT(t)
pluginsStr := `plugins {
id 'java'
id 'org.springframework.boot' version '2.2.2.RELEASE'
}
`
Analysis(pluginsStr)
g.Expect(true).To(Equal(true))
}
package groovy
import parser "github.com/phodal/coca/languages/groovy"
type GroovyIdentifierListener struct {
parser.BaseGroovyParserListener
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册