diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d84e326bb055fda4507f28842270b45a626e88..c0b1e50e8ed4c849072abd49efabb7dd43d85e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ Upcoming version: ----------------- + - choosing vagrant provider depending on host (in gradle; not only in vagrantfile) (Nikolaus Krismer) - not validating vagrant installation in gradle anymore (Nikolaus Krismer) - removed provider definition from gradle (only needed within vagrant) (Nikolaus Krismer) - fixed syntax error in Vagrantfile (Nikolaus Krismer) diff --git a/build.gradle b/build.gradle index 8b35f7949ab6a7afd37bf3dbffe5b86ed9452211..1a7c58bd9a395695a9d2c6c1c31ffc6906059dde 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,25 @@ def getDate() { return formattedDate } +def getHostname() { + InetAddress result = null; + Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); + while (interfaces.hasMoreElements()) { + Enumeration<InetAddress> addresses = interfaces.nextElement().getInetAddresses(); + while (addresses.hasMoreElements()) { + InetAddress address = addresses.nextElement(); + if (!address.isLoopbackAddress()) { + if (address.isSiteLocalAddress()) { + return address.getHostName(); + } else if (result == null) { + result = address; + } + } + } + } + return (result != null ? result : InetAddress.getLocalHost()).getHostName(); +} + // Repositories, Configurations, Dependencies and SourceSets setup repositories { @@ -88,9 +107,8 @@ scmversion { } vagrant { - installation { - validate = false - } + def hostname = getHostname(); + provider = (hostname.startsWith('ci') || hostname.startsWith('dbis-ci') || hostname.startsWith('isochrone') || hostname.startsWith('dbis-isochrone')) ? 'libvirt' : 'virtualbox'; } vagrantDestroy.doFirst {