Ryan Ernst 37795d259a
Remove guava from transitive compile classpath (#54309) (#54695)
Guava was removed from Elasticsearch many years ago, but remnants of it
remain due to transitive dependencies. When a dependency pulls guava
into the compile classpath, devs can inadvertently begin using methods
from guava without realizing it. This commit moves guava to a runtime
dependency in the modules that it is needed.

Note that one special case is the html sanitizer in watcher. The third
party dep uses guava in the PolicyFactory class signature. However, only
calling a method on the PolicyFactory actually causes the class to be
loaded, a reference alone does not trigger compilation to look at the
class implementation. There we utilize a MethodHandle for invoking the
relevant method at runtime, where guava will continue to exist.
2020-04-07 23:20:17 -07:00

191 lines
8.4 KiB
Groovy

import java.nio.file.Files
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
esplugin {
description 'The GCS repository plugin adds Google Cloud Storage support for repositories.'
classname 'org.elasticsearch.repositories.gcs.GoogleCloudStoragePlugin'
}
dependencies {
compile 'com.google.cloud:google-cloud-storage:1.106.0'
compile 'com.google.cloud:google-cloud-core:1.93.3'
runtimeOnly 'com.google.guava:guava:26.0-jre'
compile 'com.google.http-client:google-http-client:1.34.2'
compile "commons-logging:commons-logging:${versions.commonslogging}"
compile "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}"
compile "commons-codec:commons-codec:${versions.commonscodec}"
compile 'com.google.api:api-common:1.8.1'
compile 'com.google.api:gax:1.54.0'
compile 'org.threeten:threetenbp:1.4.1'
compile 'com.google.protobuf:protobuf-java-util:3.11.3'
compile 'com.google.protobuf:protobuf-java:3.11.3'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.api.grpc:proto-google-common-protos:1.16.0'
compile 'com.google.api.grpc:proto-google-iam-v1:0.12.0'
compile 'com.google.cloud:google-cloud-core-http:1.93.3'
compile 'com.google.auth:google-auth-library-credentials:0.20.0'
compile 'com.google.auth:google-auth-library-oauth2-http:0.20.0'
compile 'com.google.oauth-client:google-oauth-client:1.28.0'
compile 'com.google.api-client:google-api-client:1.30.9'
compile 'com.google.http-client:google-http-client-appengine:1.34.2'
compile 'com.google.http-client:google-http-client-jackson2:1.34.2'
compile 'com.google.api:gax-httpjson:0.62.0'
compile 'io.grpc:grpc-context:1.12.0'
compile 'io.opencensus:opencensus-api:0.18.0'
compile 'io.opencensus:opencensus-contrib-http-util:0.18.0'
compile 'com.google.apis:google-api-services-storage:v1-rev20200226-1.30.9'
testCompile project(':test:fixtures:gcs-fixture')
}
restResources {
restApi {
includeCore '_common', 'cluster', 'nodes'
}
}
dependencyLicenses {
mapping from: /google-cloud-.*/, to: 'google-cloud'
mapping from: /google-auth-.*/, to: 'google-auth'
mapping from: /google-http-.*/, to: 'google-http'
mapping from: /opencensus.*/, to: 'opencensus'
mapping from: /protobuf.*/, to: 'protobuf'
mapping from: /proto-google.*/, to: 'proto-google'
}
thirdPartyAudit {
ignoreViolations(
// uses internal java api: sun.misc.Unsafe
'com.google.protobuf.UnsafeUtil',
'com.google.protobuf.UnsafeUtil$1',
'com.google.protobuf.UnsafeUtil$JvmMemoryAccessor',
'com.google.protobuf.UnsafeUtil$MemoryAccessor',
'com.google.protobuf.MessageSchema',
'com.google.protobuf.UnsafeUtil$Android32MemoryAccessor',
'com.google.protobuf.UnsafeUtil$Android64MemoryAccessor',
'com.google.common.cache.Striped64',
'com.google.common.cache.Striped64$1',
'com.google.common.cache.Striped64$Cell',
'com.google.common.hash.Striped64',
'com.google.common.hash.Striped64$1',
'com.google.common.hash.Striped64$Cell',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
)
ignoreMissingClasses(
'com.google.appengine.api.datastore.Blob',
'com.google.appengine.api.datastore.DatastoreService',
'com.google.appengine.api.datastore.DatastoreServiceFactory',
'com.google.appengine.api.datastore.Entity',
'com.google.appengine.api.datastore.Key',
'com.google.appengine.api.datastore.KeyFactory',
'com.google.appengine.api.datastore.PreparedQuery',
'com.google.appengine.api.datastore.Query',
'com.google.appengine.api.memcache.Expiration',
'com.google.appengine.api.memcache.MemcacheService',
'com.google.appengine.api.memcache.MemcacheServiceFactory',
'com.google.appengine.api.urlfetch.FetchOptions$Builder',
'com.google.appengine.api.urlfetch.FetchOptions',
'com.google.appengine.api.urlfetch.HTTPHeader',
'com.google.appengine.api.urlfetch.HTTPMethod',
'com.google.appengine.api.urlfetch.HTTPRequest',
'com.google.appengine.api.urlfetch.HTTPResponse',
'com.google.appengine.api.urlfetch.URLFetchService',
'com.google.appengine.api.urlfetch.URLFetchServiceFactory',
// commons-logging optional dependencies
'org.apache.avalon.framework.logger.Logger',
'org.apache.log.Hierarchy',
'org.apache.log.Logger',
// optional apache http client dependencies
'org.apache.http.ConnectionReuseStrategy',
'org.apache.http.Header',
'org.apache.http.HttpEntity',
'org.apache.http.HttpEntityEnclosingRequest',
'org.apache.http.HttpHost',
'org.apache.http.HttpRequest',
'org.apache.http.HttpResponse',
'org.apache.http.HttpVersion',
'org.apache.http.RequestLine',
'org.apache.http.StatusLine',
'org.apache.http.client.AuthenticationHandler',
'org.apache.http.client.HttpClient',
'org.apache.http.client.HttpRequestRetryHandler',
'org.apache.http.client.RedirectHandler',
'org.apache.http.client.RequestDirector',
'org.apache.http.client.UserTokenHandler',
'org.apache.http.client.methods.HttpDelete',
'org.apache.http.client.methods.HttpEntityEnclosingRequestBase',
'org.apache.http.client.methods.HttpGet',
'org.apache.http.client.methods.HttpHead',
'org.apache.http.client.methods.HttpOptions',
'org.apache.http.client.methods.HttpPost',
'org.apache.http.client.methods.HttpPut',
'org.apache.http.client.methods.HttpRequestBase',
'org.apache.http.client.methods.HttpTrace',
'org.apache.http.config.SocketConfig',
'org.apache.http.config.SocketConfig$Builder',
'org.apache.http.conn.ClientConnectionManager',
'org.apache.http.conn.ConnectionKeepAliveStrategy',
'org.apache.http.conn.params.ConnManagerParams',
'org.apache.http.conn.params.ConnPerRouteBean',
'org.apache.http.conn.params.ConnRouteParams',
'org.apache.http.conn.routing.HttpRoutePlanner',
'org.apache.http.conn.scheme.PlainSocketFactory',
'org.apache.http.conn.scheme.Scheme',
'org.apache.http.conn.scheme.SchemeRegistry',
'org.apache.http.conn.ssl.SSLConnectionSocketFactory',
'org.apache.http.conn.ssl.SSLSocketFactory',
'org.apache.http.conn.ssl.X509HostnameVerifier',
'org.apache.http.entity.AbstractHttpEntity',
'org.apache.http.impl.client.DefaultHttpClient',
'org.apache.http.impl.client.DefaultHttpRequestRetryHandler',
'org.apache.http.impl.client.HttpClientBuilder',
'org.apache.http.impl.conn.PoolingHttpClientConnectionManager',
'org.apache.http.impl.conn.ProxySelectorRoutePlanner',
'org.apache.http.impl.conn.SystemDefaultRoutePlanner',
'org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager',
'org.apache.http.message.BasicHttpResponse',
'org.apache.http.params.BasicHttpParams',
'org.apache.http.params.HttpConnectionParams',
'org.apache.http.params.HttpParams',
'org.apache.http.params.HttpProtocolParams',
'org.apache.http.protocol.HttpContext',
'org.apache.http.protocol.HttpProcessor',
'org.apache.http.protocol.HttpRequestExecutor',
// commons-logging provided dependencies
'javax.servlet.ServletContextEvent',
'javax.servlet.ServletContextListener'
)
}
check {
// also execute the QA tests when testing the plugin
dependsOn 'qa:google-cloud-storage:check'
}