blob: b22ea8d7f249d7247f2f26b2538218416666ad1f (
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
137
138
139
140
141
142
|
// **********************************************************************
//
// Copyright (c) 2003-2017 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://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: "${iceBuilderClassPath}", name: 'slice', version: "${iceBuilderVersion}"
}
}
//
// We do not use the new gradle Plugin DSL because on debian we want to use the plug-in
// from gradle-ice-builder-plugin package and this is not possible when using gradle 3.2
// included in stretch and the Plugin DSL.
//
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
: System.getenv("ICE_HOME") != null ? System.env.ICE_HOME : new File(project.ext.topSrcDir).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 the prefix isn't set use these default locations.
if (!prefix) {
def prefixVersion = iceVersion
if(prefixVersion.indexOf(".0-alpha")){
prefixVersion = prefixVersion.replace(".0-alpha", "a")
} else if(prefixVersion.indexOf(".0-beta")){
prefixVersion = prefixVersion.replace(".0-beta", "b")
}
if (isWindows) {
prefix = "C:\\Ice-${prefixVersion}"
} else {
prefix = "/opt/Ice-${prefixVersion}"
}
}
// 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 is DESTDIR is set (non-Windows)
if (isWindows) {
ext.DESTDIR = ""
}
ext.versionSuffix = "-${project.version}"
ext.libDir = "$rootProject.projectDir/lib"
ext.iceSourceCompatibility = 1.8
ext.iceTargetCompatibility = 1.8
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 || System.env.ICE_BIN_DIST == "cpp") {
return project(":${artifactId}")
} else {
return "com.zeroc:${artifactId}:${project.version}"
}
}
|