blob: b7ab92eb2827f19f5574ea348f164e3b80561c28 (
plain)
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
|
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
buildscript {
//
// If iceBuilderHome is set add its lib directory it to the local maven repositories
// so we can build using a local plugin version
//
if (iceBuilderHome) {
def builder = new File([iceBuilderHome, "build", "libs"].join(File.separator))
if(builder.exists()) {
repositories {
flatDir dirs: "file://${builder.getCanonicalPath()}"
}
}
}
if(new File("/usr/share/maven-repo").exists()){
repositories {
maven {
url "file:///usr/share/maven-repo"
}
}
}
repositories {
mavenCentral()
maven {
url "https://repo.zeroc.com/nexus/content/repositories/releases"
}
}
dependencies {
classpath group: 'com.zeroc.gradle.ice-builder', name: 'slice', version: "${iceBuilderVersion}"
}
}
if (!project.plugins.findPlugin(com.zeroc.gradle.icebuilder.slice.SlicePlugin)) {
project.apply(plugin: com.zeroc.gradle.icebuilder.slice.SlicePlugin)
}
slice {
cppConfiguration = this.cppConfiguration
cppPlatform = this.cppPlatform
if(!System.env.ICE_BIN_DIST?.split(" ").find{ it == 'all' || it.contains('java')}) {
iceHome = this.hasProperty('iceHome') ? this.iceHome
: new File([rootProject.projectDir, ".."].join(File.separator)).getCanonicalPath()
}
}
ext.generatedDir = "$project.buildDir/generated"
ext.useLocalOnly = false
// Android does not have a compileJava task
if(!(project.hasProperty('android') && project.android.sourceSets)) {
compileJava {
options.debug = debug
}
}
def env = System.getenv()
// Determine the name of the Slice-to-Java translator
def isWindows = System.properties['os.name'].toLowerCase().contains('windows')
if (!prefix) {
// If the prefix isn't set use these default locations.
if (isWindows) {
prefix = "C:\\Ice-${project.version}"
} else {
prefix = "/opt/Ice-${project.version}"
}
}
// Installation location for jar/pom & executables.
//
// Note that we exclude /usr/src/packages because it's the RPM build directory on SLES.
//
if ((prefix.startsWith("/usr") || prefix.startsWith("/usr/local")) && !prefix.startsWith("/usr/src/packages")) {
ext.jarDir = prefix + "/share/java"
ext.binDir = prefix + "/bin"
} else {
ext.jarDir = prefix + "/lib"
ext.binDir = prefix + "/bin"
}
// Check if we are building against source distribution
def iceCppDir = slice.srcDist ? [slice.iceHome, "cpp"].join(File.separator) : slice.iceHome
def iceSrcDist = false
// Check is DESTDIR is set (non-Windows)
if (isWindows) {
ext.DESTDIR = ""
}
ext.versionSuffix = "-${project.version}"
ext.libDir = "$rootProject.projectDir/lib"
ext.iceSourceCompatibility = 1.7
ext.iceTargetCompatibility = 1.7
ext.searchFile = { List<Closure> places, List<String> searchPaths ->
def dirs = []
places.each {
def dir = it()
if(dir != null) {
dirs << dir + "/"
}
}
def candidates = searchPaths.collect {
def path = it
dirs.collect {
it.concat(path)
}
}.flatten()
return candidates.find {
new File(it).exists()
}
}
ext.localDependency = { artifactId ->
if (project.slice.srcDist) {
return project(":${artifactId}")
} else {
return "com.zeroc:${artifactId}:${project.version}"
}
}
|