Ver código fonte

Cleaning up some buildscripts (#85394)

Just some housekeeping on build scripts
Rene Groeschke 3 anos atrás
pai
commit
50c0798b3b

+ 1 - 8
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditPrecommitPlugin.java

@@ -48,7 +48,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin implements I
         TaskProvider<ThirdPartyAuditTask> audit = project.getTasks().register("thirdPartyAudit", ThirdPartyAuditTask.class);
         // usually only one task is created. but this construct makes our integTests easier to setup
         project.getTasks().withType(ThirdPartyAuditTask.class).configureEach(t -> {
-            Configuration runtimeConfiguration = getRuntimeConfiguration(project);
+            Configuration runtimeConfiguration = project.getConfigurations().getByName("runtimeClasspath");
             Configuration compileOnly = project.getConfigurations()
                 .getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME);
             t.setClasspath(runtimeConfiguration.plus(compileOnly));
@@ -68,11 +68,4 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin implements I
         return audit;
     }
 
-    private Configuration getRuntimeConfiguration(Project project) {
-        Configuration runtime = project.getConfigurations().findByName("runtimeClasspath");
-        if (runtime == null) {
-            return project.getConfigurations().getByName("testCompileClasspath");
-        }
-        return runtime;
-    }
 }

+ 1 - 64
build-tools/build.gradle

@@ -154,67 +154,4 @@ normalization {
     }
 }
 
-tasks.named("check").configure { dependsOn("integTest") }
-
-// TODO These additional conventions will be applied once those plugins have been ported to build-conventions and
-//
-//  apply plugin: 'elasticsearch.build'
-//
-//  // groovydoc succeeds, but has some weird internal exception...
-//  tasks.named("groovydoc").configure {
-//    enabled = false
-//  }
-//
-//  // build-tools is not ready for primetime with these...
-//  tasks.named("dependencyLicenses").configure { enabled = false }
-//  tasks.named("dependenciesInfo").configure {enabled = false }
-//  tasks.named("dependenciesGraph").configure {enabled = false }
-//  disableTasks('forbiddenApisMain', 'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
-//  tasks.named("jarHell").configure {
-//    enabled = false
-//  }
-//  tasks.named("thirdPartyAudit").configure {
-//    enabled = false
-//  }
-//  configurations.register("distribution")
-//
-//
-//  tasks.withType(Test).configureEach {
-//    // Track reaper jar as a test input using runtime classpath normalization strategy
-//    inputs.files(configurations.reaper).withNormalizer(ClasspathNormalizer)
-//    useJUnitPlatform()
-//  }
-//
-//  tasks.named("test").configure {
-//    include("**/*TestSpec.class")
-//  }
-//
-
-//
-//  tasks.named("forbiddenPatterns").configure {
-//    exclude '**/*.wav'
-//    exclude '**/*.p12'
-//    exclude '**/*.jks'
-//    exclude '**/*.crt'
-//    // the file that actually defines nocommit
-//    exclude '**/ForbiddenPatternsTask.java'
-//    exclude '**/*.bcfks'
-//  }
-//
-//  eclipse {
-//    classpath {
-//        plusConfigurations += [configurations.integTestRuntimeClasspath]
-//    }
-//  }
-//
-//  tasks.named("testingConventions") {
-//    naming.clear()
-//    naming {
-//      Tests {
-//        baseClass 'org.elasticsearch.gradle.internal.test.GradleUnitTestCase'
-//      }
-//      TestSpec {
-//        baseClass 'spock.lang.Specification'
-//      }
-//    }
-//  }
+tasks.named("check").configure { dependsOn("integTest") }

+ 0 - 6
build.gradle

@@ -229,12 +229,6 @@ allprojects {
     }
   }
 
-  project.ext.disableTasks = { String... tasknames ->
-    for (String taskname : tasknames) {
-      project.tasks.named(taskname).configure { enabled = false }
-    }
-  }
-
   /*
    * Remove assemble/dependenciesInfo on all qa projects because we don't
    * need to publish artifacts for them.

+ 0 - 10
client/rest-high-level/build.gradle

@@ -58,16 +58,6 @@ tasks.named('forbiddenApisMain').configure {
   signaturesFiles += files('src/main/resources/forbidden/rest-high-level-signatures.txt')
 }
 
-File nodeCert = file("./testnode.crt")
-File nodeTrustStore = file("./testnode.jks")
-File pkiTrustCert = file("./src/test/resources/org/elasticsearch/client/security/delegate_pki/testRootCA.crt")
-
-def clusterUserNameProvider = providers.systemProperty('tests.rest.cluster.username')
-        .orElse('test_user')
-
-def clusterPasswordProvider = providers.systemProperty('tests.rest.cluster.password')
-        .orElse('test-user-password')
-
 tasks.named('splitPackagesAudit').configure {
   // the client package should be owned by the client, but server has some classes there too
   ignoreClasses 'org.elasticsearch.client.*'

+ 0 - 1
libs/nio/build.gradle

@@ -19,7 +19,6 @@ dependencies {
   }
 }
 
-
 tasks.named('forbiddenApisMain').configure {
   // nio does not depend on core, so only jdk signatures should be checked
   // es-all is not checked as we connect and accept sockets

+ 1 - 1
libs/plugin-classloader/build.gradle

@@ -13,5 +13,5 @@ apply plugin: 'elasticsearch.publish'
 tasks.named("test").configure { enabled = false }
 
 // test depend on ES core...
-disableTasks('forbiddenApisMain')
+tasks.named('forbiddenApisMain').configure { enabled = false}
 tasks.named("jarHell").configure { enabled = false }

+ 0 - 1
libs/ssl-config/build.gradle

@@ -19,7 +19,6 @@ dependencies {
   testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
 }
 
-
 tasks.named('forbiddenApisMain').configure {
   replaceSignatureFiles 'jdk-signatures'
 }

+ 0 - 1
modules/analysis-common/build.gradle

@@ -25,7 +25,6 @@ dependencies {
   compileOnly project(':modules:lang-painless')
 }
 
-
 tasks.named("yamlRestTestV7CompatTransform").configure { task ->
   task.skipTest("indices.analyze/10_analyze/htmlStrip_deprecated", "Cleanup versioned deprecations in analysis #41560")
   task.skipTest("analysis-common/40_token_filters/delimited_payload_filter_error", "Remove preconfigured delimited_payload_filter #43686")

+ 3 - 12
x-pack/plugin/ccr/qa/security/build.gradle

@@ -9,15 +9,6 @@ dependencies {
   testImplementation project(':x-pack:plugin:ccr:qa')
 }
 
-tasks.register("resolve") {
-  doLast {
-    configurations.testCompileClasspath.files.each {
-      println it
-    }
-    println "configurations.testCompileClasspath.files " + configurations.testCompileClasspath.files.size()
-  }
-}
-
 def leadCluster = testClusters.register('leader-cluster') {
     testDistribution = 'DEFAULT'
     setting 'xpack.license.self_generated.type', 'trial'
@@ -27,7 +18,7 @@ def leadCluster = testClusters.register('leader-cluster') {
     user username: "test_ccr", role: "ccruser"
 }
 
-def followCluster = testClusters.register('follow-cluster') {
+testClusters.register('follow-cluster') {
     testDistribution = 'DEFAULT'
     setting 'cluster.remote.leader_cluster.seeds', {
       "\"${leadCluster.get().getAllTransportPortURI().join(",")}\""
@@ -45,11 +36,11 @@ tasks.register('leader-cluster', RestIntegTestTask) {
   systemProperty 'tests.target_cluster', 'leader'
 }
 
-tasks.register('follow-cluster', RestIntegTestTask) {
+def followerClusterTestTask = tasks.register('follow-cluster', RestIntegTestTask) {
   dependsOn 'leader-cluster'
   useCluster leadCluster
   systemProperty 'tests.target_cluster', 'follow'
   nonInputProperties.systemProperty 'tests.leader_host', leadCluster.map(c-> c.getAllHttpSocketURI().get(0))
 }
 
-tasks.named("check").configure { dependsOn('follow-cluster') }
+tasks.named("check").configure { dependsOn(followerClusterTestTask) }

+ 2 - 1
x-pack/plugin/stack/build.gradle

@@ -12,6 +12,7 @@ archivesBaseName = 'x-pack-stack'
 
 dependencies {
   compileOnly project(path: xpackModule('core'))
-testImplementation(testArtifact(project(xpackModule('core'))))}
+  testImplementation(testArtifact(project(xpackModule('core'))))
+}
 
 addQaCheckDependencies()

+ 0 - 3
x-pack/plugin/text-structure/qa/text-structure-with-security/build.gradle

@@ -16,9 +16,6 @@ restResources {
   }
 }
 
-tasks.named("yamlRestTest").configure {
-}
-
 testClusters.configureEach {
   testDistribution = 'DEFAULT'
   rolesFile file('roles.yml')

+ 0 - 1
x-pack/plugin/transform/qa/multi-cluster-tests-with-security/build.gradle

@@ -15,7 +15,6 @@ restResources {
   }
 }
 
-
 def remoteCluster = testClusters.register('remote-cluster') {
     testDistribution = 'DEFAULT'
     numberOfNodes = 2

+ 18 - 17
x-pack/plugin/vector-tile/qa/multi-cluster/build.gradle

@@ -15,38 +15,39 @@ dependencies {
   testImplementation project(':x-pack:plugin:vector-tile')
 }
 
-testClusters {
-  'local' {
+
+def remoteCluster = testClusters.register('remote') {
+  testDistribution = 'DEFAULT'
+  setting 'xpack.license.self_generated.type', 'trial'
+  setting 'xpack.security.enabled', 'true'
+  user username: 'admin', password: 'admin-password', role: 'superuser'
+}
+
+def localCluster = testClusters.register('local') {
     testDistribution = 'DEFAULT'
     setting 'xpack.license.self_generated.type', 'trial'
     setting 'xpack.security.enabled', 'true'
     user username: 'admin', password: 'admin-password', role: 'superuser'
     setting 'cluster.remote.other.seeds',
-      { "\"${testClusters.named('remote').get().getAllTransportPortURI().join(",")}\"" }
-  }
-  'remote' {
-    testDistribution = 'DEFAULT'
-    setting 'xpack.license.self_generated.type', 'trial'
-    setting 'xpack.security.enabled', 'true'
-    user username: 'admin', password: 'admin-password', role: 'superuser'
-  }
+      { "\"${remoteCluster.get().getAllTransportPortURI().join(",")}\"" }
 }
 
-tasks.register("startRemoteCluster", DefaultTestClustersTask.class) {
-  useCluster testClusters.'remote'
+
+def startRemoteCluster = tasks.register("startRemoteCluster", DefaultTestClustersTask.class) {
+  useCluster remoteCluster
   doLast {
     "Starting remote cluster before integ tests and integTest cluster is started"
   }
 }
 
 tasks.named("integTest").configure {
-  dependsOn 'startRemoteCluster'
-  useCluster testClusters.'remote'
-  useCluster testClusters.'local'
+  dependsOn startRemoteCluster
+  useCluster remoteCluster
+  useCluster localCluster
   doFirst {
     nonInputProperties.systemProperty 'tests.local',
-    "${-> testClusters.named('local').get().getAllHttpSocketURI().get(0)}"
+    "${-> localCluster.get().getAllHttpSocketURI().get(0)}"
     nonInputProperties.systemProperty 'tests.remote',
-    "${-> testClusters.named('remote').get().getAllHttpSocketURI().get(0)}"
+    "${-> remoteCluster.get().getAllHttpSocketURI().get(0)}"
   }
 }