2018-04-16 23:49:27 +08:00
|
|
|
/*
|
2021-02-03 05:41:39 +08:00
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2024-09-14 04:28:03 +08:00
|
|
|
* or more contributor license agreements. Licensed under the "Elastic License
|
|
|
|
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
|
|
* Public License v 1"; you may not use this file except in compliance with, at
|
|
|
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
|
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
2018-04-16 23:49:27 +08:00
|
|
|
*/
|
|
|
|
|
2024-10-30 04:02:28 +08:00
|
|
|
configure(childProjects.values()) {
|
|
|
|
|
|
|
|
apply plugin: 'base'
|
|
|
|
|
2019-11-13 18:14:04 +08:00
|
|
|
/*
|
2024-10-30 04:02:28 +08:00
|
|
|
* Although these libs are local to Elasticsearch, they can conflict with other similarly
|
|
|
|
* named libraries when downloaded into a single directory via maven. Here we set the
|
|
|
|
* name of all libs to begin with the "elasticsearch-" prefix. Additionally, subprojects
|
|
|
|
* of libs begin with their parents artifactId.
|
2019-11-13 18:14:04 +08:00
|
|
|
*/
|
2024-10-30 04:02:28 +08:00
|
|
|
def baseProject = project
|
|
|
|
def baseArtifactId = "elasticsearch-${it.name}"
|
|
|
|
base {
|
|
|
|
archivesName = baseArtifactId
|
|
|
|
}
|
|
|
|
subprojects {
|
|
|
|
apply plugin: 'base'
|
|
|
|
|
|
|
|
def subArtifactId = baseArtifactId
|
|
|
|
def currentProject = project
|
|
|
|
while (currentProject != baseProject) {
|
|
|
|
subArtifactId += "-${currentProject.name}"
|
|
|
|
currentProject = currentProject.parent
|
|
|
|
}
|
|
|
|
base {
|
|
|
|
archivesName = subArtifactId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// log4j is a hack, and not really a full elasticsearch built jar
|
|
|
|
if (project.name != 'log4j') {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All subprojects are java projects using Elasticsearch's standard build
|
|
|
|
* tools.
|
|
|
|
*/
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
}
|
Bootstrap entitlements for testing (#129268)
* Fix ExceptionSerializationTests to use getCodeSource instead of getResource.
Using getResource makes this sensitive to unrelated classpath entries,
such as the entitlement bridge library, that get prepended to the classpath.
* FIx logging tests to use org.elasticsearch.index instead of root logger.
Using the root logger makes this sensitive to unrelated
logging, such as from the entitlement library.
* Fix entitlement error message by stashing the module name in ModuleEntitlements.
Taking the actual module name from the class doesn't work in tests,
where those classes are loaded from the classpath and so their module
info is misleading.
* Ignore server locations whose representative class isn't loaded
* Partial initial implementation
* System properties: testOnlyClasspath and enableForTests
* Trivially allow some packages
* DEBUG: use TreeMap in TestScopeResolver for readability
* Special case bouncycastle for security plugin
* Add CONFIG to TestPathLookup
* Add the classpath to the source path list for every plugin
* Add @WithoutEntitlements to tests that run ES nodes
* Set es.entitlement.enableForTests for all libs
* Use @WithoutEntitlements on ingest plugin tests
* Substitute ALL-UNNAMED for module name in non-modular plugins
* Add missing entitlements found by unit tests
* Comment in TestScopeResolver
* Properly compute bridge jar location for patch-module
* Call out nonServerLibs
* Don't build two TestPathLookups
* More comments for meta-tests
* Remove redundant dependencies for bridgeJarConfig.
These are alread set in ElasticsearchJavaBasePlugin.
* Add bridge+agent dependencies only if those exist.
For serverless, those project dependencies don't exist, and we'll need
to add the dependencies differently, using Maven coordinates.
* [CI] Auto commit changes from spotless
* Pass testOnlyPath in environment instead of command line.
It's typically a very very long string, which made Windows angry.
* [CI] Auto commit changes from spotless
* Split testOnlyPathString at File.pathSeparator
* Use doFirst to delay setting testOnlyPath env var
* Trivially allow jimfs (??)
* Don't enforce entitlements on internalClusterTest for now
* Replace forbidden APIs
* Match testOnlyClasspath using URI instead of String.
We already get the "needle" in the form of a URI, so this skips
a step, and has the benefit of also working on Windows.
* [CI] Auto commit changes from spotless
* More forbidden APIs
* Disable configuration cache for LegacyYamlRestTestPluginFuncTest
* Strip carriage-return characters in expected output for ReleaseNotesGeneratorTest.
The template generator also strips these, so we need to do so to make this pass
on Windows.
Note that we use replace("\r", "") where the template generator uses
replace("\\r", ""). The latter didn't work for me when I tried it on Windows,
for reasons I'm not aware of.
* Move configureEntitlements to ElasticsearchTestBasePlugin as-is
* Use matching instead of if
* Remove requireNonNull
* Remove default configuration
* Set inputs instead of dependencies
* Use test.systemProperty
* Respond to PR comments
* Disable entitlement enforcement for ScopedSettingsTests.
This test works by altering the logging on the root logger.
With entitlements enabled, that will cause additional log statements to appear,
which interferes with the test.
* Address PR comments
* Moritz's configureJavaBaseModuleOptions
* Allow for entitlements not yet enforced in serverless
* fix entitlementBridge config after rename
* drop empty file collections
* Remove workaround in LegacyYamlRestTestPluginFuncTest
---------
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Moritz Mack <mmack@apache.org>
2025-07-03 01:44:38 +08:00
|
|
|
|
|
|
|
// This is for any code potentially included in the server at runtime.
|
|
|
|
// Omit oddball libraries that aren't in server.
|
|
|
|
def nonServerLibs = ['plugin-scanner']
|
|
|
|
if (false == nonServerLibs.contains(project.name)) {
|
|
|
|
project.getTasks().withType(Test.class).matching(test -> ['test'].contains(test.name)).configureEach(test -> {
|
|
|
|
test.systemProperty('es.entitlement.enableForTests', 'true')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-08-30 17:04:39 +08:00
|
|
|
}
|