Skip to content

Commit

Permalink
UPDATE: add absPath dsl.
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyAndroid committed Mar 6, 2019
1 parent 5307f98 commit 1d08a05
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1536m
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

greenbean_pods_version=0.0.1
greenbean_pods_version=0.0.3
3 changes: 2 additions & 1 deletion plugin/greenbean-pods-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ buildscript {
}
}

// upload cmd: ./gradlew clean build bintrayUpload
publish {
userOrg = 'jackyjacky'
groupId = 'tech.jackywang'
artifactId = 'greenbean-pods-plugin'
publishVersion = '0.0.1'
publishVersion = '0.0.3'
licences = ["GPL-3.0"]
desc = 'https://github.com/JackyAndroid/GreenBeanPods'
website = 'https://github.com/JackyAndroid/GreenBeanPods'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ abstract class GreenBean extends Script {
String name
String group
String path
String absPath
String branch
String cmd
ArrayList<String> excludes = new ArrayList<>()
Expand All @@ -94,6 +95,10 @@ abstract class GreenBean extends Script {
this.path = path
}

void absPath(String absPath) {
this.absPath = absPath
}

void branch(String branch) {
this.branch = branch
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ class GreenBeanPods implements Plugin<PluginAware> {
def rootDir = settings.rootDir
evaluateDSL(rootDir.path + File.separator + dslPath)
GreenBean.pods.each { pod ->
if (pod.on_off && pod.path != null) {
if (pod.on_off) {
if (pod.path == null && pod.absPath == null) {
return
}
def path
if (pod.path != null) {
path = rootDir.getParent() + File.separator + pod.path
} else {
path = pod.absPath
}
// cmd hook
if (pod.cmd != null && !pod.cmd.isEmpty()) {
def proc = pod.cmd.execute()
Expand All @@ -62,16 +71,14 @@ class GreenBeanPods implements Plugin<PluginAware> {
}
// 切换分支
if (pod.branch != null && !pod.branch.isEmpty()) {
def gitDir = rootDir.getParent() + File.separator + pod.path
String cmd = "git -C " + gitDir + " checkout " + pod.branch
String cmd = "git -C " + path + " checkout " + pod.branch
def proc = cmd.execute()
def outputStream = new StringBuffer()
proc.waitForProcessOutput(outputStream, System.err)
println "模块:" + pod.name + " 检出分支:" + pod.branch + " 结果:" + outputStream.toString()
}
def projectName = ":" + pod.name
settings.include(projectName)
String path = settings.rootDir.getParent() + File.separator + pod.path
settings.project(projectName).projectDir = new File(path)
println("被包含的模块 名字:" + pod.name + " 路径:" + path)
}
Expand Down

0 comments on commit 1d08a05

Please sign in to comment.