-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle
110 lines (93 loc) · 3.22 KB
/
settings.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
include_with_api(":onecompone");
//include ':onecompone'
include ':twocomponet',
':app',
':componentservice',
':build-gradle',
':basiclib',
':componentlib',
':basicres',
':build-CompileApi'
def include_with_api(def projectName) {
include projectName
String rootDir = rootDir.getAbsolutePath();
String moduleName = ((String) projectName).replace(":", "")
String parentName = moduleName.replace("compone", "")+"_service"
System.out.println("rootDir==" + rootDir) //D:\MKHsvn\zujianhua
System.out.println("moduleName==" + moduleName) //componentservice
System.out.println("parentName==" + parentName) //service
copy() {
from rootDir + '/' + moduleName + '/src/main/'
into rootDir + '/' + parentName + '/src/main/'
include '**/*.gradle'
include {
details -> details.file.name.contains('AndroidManifest')
}
filter { line ->
String content = line;
content = content.replace("android:label=\"@string/app_name\"", "")
if (content.contains("package=\"")) {
content = content.replace("\">", ".plugin\">")
}
content
}
}
// build.gradle
copy() {
from rootDir + '/' + moduleName + '/'
into rootDir + '/' + parentName + '/'
include '**/*.gradle'
include {
details -> details.file.name.contains('build')
}
filter { line ->
String content = line;
if (content.contains("compile project(")) {
content = ""
}
if (content.contains("compileApi")) {
content = ""
}
if (content.contains("apply plugin: 'com.dd.comgradle'")) {
content = "apply plugin: 'com.android.library'"
}
if (content.contains("apply plugin: 'com.dd.compileapi'")) {
content = ""
}
if (content.contains("applicationId")) {
content = ""
}
if (content.contains("combuild")) {
content = ""
}
if (content.contains("applicationName")) {
content = ""
}
if (content.contains("isRegisterCompoAuto")) {
content = ""
}
content
}
}
copy() {
from rootDir + '/' + moduleName + '/src/main/java/com/sage/onecompone/'
into rootDir + '/' + parentName + '/src/main/java/com/sage/onecompone/plugin/'
include '**/*.api'
exclude{
details -> details.file.name.endsWith('.java')
}
filter { line ->
String content = line;
System.out.println("content>>>>>>>>>>>>>>>>>>>>>>> ==" + content)
// if (content.contains(moduleName)) {
// content = "";
// }
if (content.contains("package com.sage.onecompone;")) {
content = content.replace("package com.sage.onecompone;","package com.sage.onecompone.plugin;")
// content = "package com.sage.onecompone.plugin;"
}
content
}
}
include parentName
}