// ********************************************************************** // // 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 places, List 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}" } }