Upgrade Gradle to 4.0

And remove usage of deprecated Gradle APIs
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/reports/AggregatedJacocoReportTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/reports/AggregatedJacocoReportTask.groovy
index ba1b8f2..5b7232e 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/reports/AggregatedJacocoReportTask.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/reports/AggregatedJacocoReportTask.groovy
@@ -66,7 +66,7 @@
       sourceDirs.findAll { it.directory }.collect { it.absolutePath }
     }
     def classesDirsOf = { List<SourceSet> sourceSets ->
-      def classesDirs = sourceSets.collect { it.output.classesDir } as List<File>
+      def classesDirs = sourceSets.collect { it.output.classesDirs.files }.flatten() as List<File>
       classesDirs.findAll { it.directory }.collect { it.absolutePath }
     }
 
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/tests/PerformanceTestsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/tests/PerformanceTestsPlugin.groovy
index 3b10b2f..48db0ad 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/tests/PerformanceTestsPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/tests/PerformanceTestsPlugin.groovy
@@ -54,7 +54,7 @@
       task.description = 'Runs performance tests.'
       task.maxParallelForks = 1
       task.forkEvery = 1L
-      task.testClassesDir = sourceSets.getByName( 'perf' ).output.classesDir
+      task.testClassesDirs = sourceSets.getByName( 'perf' ).output.classesDirs
       task.classpath = sourceSets.getByName( 'perf' ).runtimeClasspath
       task.systemProperty 'jar.path', ( project.tasks.getByName( 'jar' ) as Jar ).archivePath
     } as Action<Test> )
diff --git a/dependencies.gradle b/dependencies.gradle
index d75e937..3c6bfaf 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -20,7 +20,7 @@
 def dependencies = extensions.getByType( DependenciesDeclarationExtension )
 
 // Gradle version
-dependencies.gradleVersion = '3.5'
+dependencies.gradleVersion = '4.0'
 
 // Remote repositories
 dependencies.repositoriesUrls << [
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f662fc6..7536313 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2271d9f..125e44b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -20,5 +20,5 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
 
diff --git a/libraries/http/build.gradle b/libraries/http/build.gradle
index 6002d53..651249b 100644
--- a/libraries/http/build.gradle
+++ b/libraries/http/build.gradle
@@ -76,7 +76,7 @@
     {
       enabled = false
     }
-    testClassesDir = sourceSets.vhostTest.output.classesDir
+    testClassesDirs = sourceSets.vhostTest.output.classesDirs
     classpath = sourceSets.vhostTest.runtimeClasspath
     systemProperties 'networkaddress.cache.ttl': '0'
     systemProperties 'sun.net.spi.nameservice.provider.1': 'dns,LocalManagedDns'