-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsamples.gradle
71 lines (58 loc) · 1.7 KB
/
samples.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
import com.liferay.project.templates.ProjectTemplates
buildscript {
dependencies{
classpath group: "com.liferay", name: "com.liferay.project.templates", version: "4.0.0"
}
repositories {
maven {
url "https://repository.liferay.com/nexus/content/groups/public"
}
}
}
configurations {
projectTemplates
}
dependencies {
projectTemplates group: "com.liferay", name: "com.liferay.project.templates", version: "4.0.0"
}
repositories {
maven {
url "https://repository.liferay.com/nexus/content/groups/public"
}
}
task createSamples {
String liferayVersionArg
if (project.hasProperty('liferayVersion')) {
liferayVersionArg = liferayVersion
}
else {
liferayVersionArg = '7.0'
}
def templateNames = ProjectTemplates.getTemplates().keySet()
templateNames.each {
def mainArgs = ["--template", it, "--name", "sample-${it}"]
if (it.equals("fragment")) {
mainArgs += ["--host-bundle-symbolic-name", "com.liferay.login.web", "--host-bundle-version", "1.0.0"]
}
else if (it.equals("service")) {
mainArgs += ["--class-name", "FooAction", "--service", "com.liferay.portal.kernel.events.LifecycleAction"]
}
else if (it.equals("service-builder")) {
mainArgs += ["--package-name", "com.liferay.docs.guestbook"]
}
else if (it.equals("service-wrapper")) {
mainArgs += ["--service", "com.liferay.portal.kernel.service.UserLocalServiceWrapper"]
}
mainArgs += ["--liferayVersion", liferayVersionArg]
File samplesDir = new File("samples-${liferayVersionArg}")
if (!samplesDir.exists()) {
samplesDir.mkdir()
}
javaexec {
args mainArgs
classpath = configurations.projectTemplates
main = "com.liferay.project.templates.ProjectTemplates"
workingDir = samplesDir
}
}
}