forked from ragsns/coprhd-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assembly.gradle
161 lines (147 loc) · 5.04 KB
/
assembly.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Copyright 2015 EMC Corporation
// All Rights Reserved
configurations {
cassandra
}
dependencies {
cassandra "org.apache.cassandra:apache-cassandra:2.0.7:[email protected]"
}
task unpackCassandra(type: Copy) {
from tarTree(configurations.cassandra.singleFile)
into "${buildDir}/tmp"
}
task assembleCqlsh(type: Copy, dependsOn: unpackCassandra) {
def cassandraDir = "${buildDir}/tmp/apache-cassandra-2.0.7"
into "${buildDir}"
from ("${cassandraDir}/bin/cqlsh") {
into "bin"
fileMode = 0755
}
from ("${cassandraDir}/lib/cql-internal-only-1.4.1.zip") {
into "lib"
}
from ("${cassandraDir}/lib/thrift-python-internal-only-0.9.1.zip") {
into "lib"
}
from ("${cassandraDir}/pylib") {
into "pylib"
}
}
// Creates symlinks for shared objects, all pointing to the most specific version in the same directory
def createSharedLibrarySymlinks(File f) {
def targetFile = f
// Find all other files that match and target the one with the longest name (most specific version)
def matchingFiles = f.parentFile.listFiles()?.findAll {
def matches = it.name.startsWith(f.name)
if (matches && (it.name.length() > targetFile.name.length())) {
targetFile = it
}
matches
}
// Erase all other files and re-create as links to the target
matchingFiles.each {
if (it != targetFile) {
ant.symlink(link:it.absolutePath, resource:targetFile.name, overwrite:true)
}
}
}
// Internal flag is used to indicate if a project should not be included in the main build/rpm
def eachExternalProject(Closure closure) {
subprojects.each {project ->
// Configure target after evaluate, so subproject configurations are created, including internal flag
project.afterEvaluate {
def skipForOss = buildType == "oss" && ( project.name == "vasa" || project.name == "installer" )
if ( !skipForOss && (!project.ext.has('internalLibrary') || !project.internalLibrary)) {
closure(project)
}
}
}
}
task assembleLibs(type: Copy) {
into "${buildDir}/lib"
eachExternalProject { project->
from project.configurations.runtime
from project.configurations.runtime.allArtifacts.files
from project.configurations.packagingLib
}
exclude "**/hamcrest-*.jar"
from "${jdkHome}/lib/tools.jar"
}
task assembleWars() {
ext.externalProjects = []
eachExternalProject { project->
dependsOn project.tasks.getByName('assemble')
externalProjects << project
}
doLast {
def destDir = "${buildDir}/lib"
externalProjects.each { project->
def wars = project.fileTree("${project.buildDir}/libs").include("*.war")
wars.each { file->
def warName = file.name.replaceAll("\\.war\$", "")
def warDir = rootProject.file("${destDir}/${warName}")
if (warDir.isDirectory()) {
warDir.deleteDir()
}
ant.unzip(src:file, dest:warDir.path, overwrite:true)
}
}
}
}
task assembleScripts(type: Copy) {
eachExternalProject { project->
// FIXME: hardcode to openjdk for now, need to find a way for customer to override it.
if (buildType == 'oss')
project.jdkHome = '/usr/lib64/jvm/java-1.7.0-openjdk'
from "${project.buildDir}/bin"
dependsOn project.tasks.getByName('assemble')
}
into "${buildDir}/bin"
fileMode = 0755
}
task assembleConfs(type: Copy) {
eachExternalProject {
from "${it.projectDir}/src/conf"
from "${it.projectDir}/src/${buildType}/conf"
from "${it.projectDir}/src/main/resources"
}
def platformDir = project(":com.iwave.platform").projectDir
from "${platformDir}/dist/conf"
into "${buildDir}/conf"
}
task assemblePortal(type: Copy, dependsOn: ":portal:assemble") {
def portal = project(":portal")
into buildDir
into("portal") {
from "${portal.buildDir}/dist"
}
into("play") {
includeEmptyDirs = false
from { "${portal.buildDir}/play/play-${portal.extensions.play.version}" }
exclude "documentation/"
exclude "samples-and-tests/"
exclude "support/"
exclude "**/junit-*.jar"
}
into("conf") {
from "${portal.buildDir}/dist/conf"
include "log4j-prod.properties"
rename {"portalsvc-log4j.properties"}
}
doLast {
// Create a symlink for the log4j config
if (!rootProject.isWindows) {
ant.symlink(
link: "${buildDir}/portal/conf/log4j-prod.properties",
resource: "../../conf/portalsvc-log4j.properties",
overwrite:true)
}
}
}
task assemblePlatform(type: Copy) {
def platformDir = project(":com.iwave.platform").projectDir
from "${platformDir}/dist/conf"
into "${buildDir}/conf"
}
task assembly(dependsOn: [assembleLibs, assembleWars, assembleConfs, assembleScripts, assemblePortal, assembleCqlsh]) << {
}