This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate dev-tools folder into elasticsearch-parent
Closes #43 Squashed commit of the following: commit 99821c3 Author: Robert Muir <[email protected]> Date: Thu May 21 10:25:11 2015 -0400 tweak this to the default packages seem to want commit 2920302 Author: Robert Muir <[email protected]> Date: Thu May 21 09:21:25 2015 -0400 clean up this duplicate/mess commit 8125827 Author: Robert Muir <[email protected]> Date: Thu May 21 08:50:50 2015 -0400 Remove more duplication. Es-core can easily "override" here explicitly commit f04b7e6 Author: Robert Muir <[email protected]> Date: Thu May 21 08:43:09 2015 -0400 remove more duplication commit 3e51b90 Author: Robert Muir <[email protected]> Date: Thu May 21 08:36:17 2015 -0400 Move some plugins up so we don't have to redefine them in every project. commit f32f586 Author: Robert Muir <[email protected]> Date: Thu May 21 02:26:00 2015 -0400 Add missing groupId here. commit 9534ba8 Author: Robert Muir <[email protected]> Date: Thu May 21 02:07:50 2015 -0400 Remove unnecessary outdated version. TODO: fix this in es-core where i copied it from :) commit fa7d3da Author: Robert Muir <[email protected]> Date: Thu May 21 01:34:38 2015 -0400 define elasticsearch.tools.directory property, so it can be cleanly used. commit 66c00d3 Author: Robert Muir <[email protected]> Date: Thu May 21 01:17:59 2015 -0400 Give a meaningful name for this module. commit d88737e Author: Robert Muir <[email protected]> Date: Thu May 21 01:14:41 2015 -0400 declare dev-tools as module commit 81f70b9 Author: Robert Muir <[email protected]> Date: Thu May 21 00:07:49 2015 -0400 Consolidate dev-tools folder into elasticsearch-parent. This makes `dev-tools` a little module that other modules pull with maven-remote-resources plugin. This way we can include PMD configuration, whatever we need. Entirety of dev-tools soon... I added the forbidden API configuration from es-core. Plugins don't need to do the path based exceptions in POM files, these days just use the `@SuppressForbidden(reason = ...)` mechanism via annotations for exceptions. I also added 'dev' profile, since it kinda goes along with forbidden-apis, its a way to skip the check. I tested this with kuromoji plugin, everything works easily with just these additions to its POM: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-remote-resources-plugin</artifactId> </plugin> <plugin> <groupId>de.thetaphi</groupId> <artifactId>forbiddenapis</artifactId> </plugin> Closes #42
- Loading branch information
Showing
5 changed files
with
462 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.elasticsearch</groupId> | ||
<artifactId>dev-tools</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
<name>Elasticsearch Build Resources</name> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-remote-resources-plugin</artifactId> | ||
<version>1.5</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>bundle</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 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. | ||
|
||
@defaultMessage Convert to URI | ||
java.net.URL#getPath() | ||
java.net.URL#getFile() | ||
|
||
@defaultMessage Use java.nio.file instead of java.io.File API | ||
java.util.jar.JarFile | ||
java.util.zip.ZipFile | ||
java.io.File | ||
java.io.FileInputStream | ||
java.io.FileOutputStream | ||
java.io.PrintStream#<init>(java.lang.String,java.lang.String) | ||
java.io.PrintWriter#<init>(java.lang.String,java.lang.String) | ||
java.util.Formatter#<init>(java.lang.String,java.lang.String,java.util.Locale) | ||
java.io.RandomAccessFile | ||
java.nio.file.Path#toFile() | ||
|
||
@defaultMessage Don't use deprecated lucene apis | ||
org.apache.lucene.index.DocsEnum | ||
org.apache.lucene.index.DocsAndPositionsEnum | ||
org.apache.lucene.queries.TermFilter | ||
org.apache.lucene.queries.TermsFilter | ||
org.apache.lucene.search.TermRangeFilter | ||
org.apache.lucene.search.NumericRangeFilter | ||
org.apache.lucene.search.PrefixFilter | ||
|
||
java.nio.file.Paths @ Use PathUtils.get instead. | ||
java.nio.file.FileSystems#getDefault() @ use PathUtils.getDefault instead. | ||
|
||
@defaultMessage Specify a location for the temp file/directory instead. | ||
java.nio.file.Files#createTempDirectory(java.lang.String,java.nio.file.attribute.FileAttribute[]) | ||
java.nio.file.Files#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[]) |
133 changes: 133 additions & 0 deletions
133
dev-tools/src/main/resources/forbidden/core-signatures.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# 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. | ||
|
||
@defaultMessage spawns threads with vague names; use a custom thread factory and name threads so that you can tell (by its name) which executor it is associated with | ||
|
||
java.util.concurrent.Executors#newFixedThreadPool(int) | ||
java.util.concurrent.Executors#newSingleThreadExecutor() | ||
java.util.concurrent.Executors#newCachedThreadPool() | ||
java.util.concurrent.Executors#newSingleThreadScheduledExecutor() | ||
java.util.concurrent.Executors#newScheduledThreadPool(int) | ||
java.util.concurrent.Executors#defaultThreadFactory() | ||
java.util.concurrent.Executors#privilegedThreadFactory() | ||
|
||
java.lang.Character#codePointBefore(char[],int) @ Implicit start offset is error-prone when the char[] is a buffer and the first chars are random chars | ||
java.lang.Character#codePointAt(char[],int) @ Implicit end offset is error-prone when the char[] is a buffer and the last chars are random chars | ||
|
||
@defaultMessage Collections.sort dumps data into an array, sorts the array and reinserts data into the list, one should rather use Lucene's CollectionUtil sort methods which sort in place | ||
|
||
java.util.Collections#sort(java.util.List) | ||
java.util.Collections#sort(java.util.List,java.util.Comparator) | ||
|
||
java.io.StringReader#<init>(java.lang.String) @ Use FastStringReader instead | ||
|
||
@defaultMessage Reference management is tricky, leave it to SearcherManager | ||
org.apache.lucene.index.IndexReader#decRef() | ||
org.apache.lucene.index.IndexReader#incRef() | ||
org.apache.lucene.index.IndexReader#tryIncRef() | ||
|
||
@defaultMessage Pass the precision step from the mappings explicitly instead | ||
org.apache.lucene.search.NumericRangeQuery#newDoubleRange(java.lang.String,java.lang.Double,java.lang.Double,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeQuery#newFloatRange(java.lang.String,java.lang.Float,java.lang.Float,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeQuery#newIntRange(java.lang.String,java.lang.Integer,java.lang.Integer,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeQuery#newLongRange(java.lang.String,java.lang.Long,java.lang.Long,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeFilter#newDoubleRange(java.lang.String,java.lang.Double,java.lang.Double,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeFilter#newFloatRange(java.lang.String,java.lang.Float,java.lang.Float,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeFilter#newIntRange(java.lang.String,java.lang.Integer,java.lang.Integer,boolean,boolean) | ||
org.apache.lucene.search.NumericRangeFilter#newLongRange(java.lang.String,java.lang.Long,java.lang.Long,boolean,boolean) | ||
|
||
@defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead. | ||
java.lang.Object#wait() | ||
java.lang.Object#wait(long) | ||
java.lang.Object#wait(long,int) | ||
java.lang.Object#notify() | ||
java.lang.Object#notifyAll() | ||
|
||
@defaultMessage Beware of the behavior of this method on MIN_VALUE | ||
java.lang.Math#abs(int) | ||
java.lang.Math#abs(long) | ||
|
||
@defaultMessage Please do not try to stop the world | ||
java.lang.System#gc() | ||
|
||
@defaultMessage Use Long.compare instead we are on Java7 | ||
com.google.common.primitives.Longs#compare(long,long) | ||
|
||
@defaultMessage Use Channels.* methods to write to channels. Do not write directly. | ||
java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) | ||
java.nio.channels.FileChannel#write(java.nio.ByteBuffer, long) | ||
java.nio.channels.GatheringByteChannel#write(java.nio.ByteBuffer[], int, int) | ||
java.nio.channels.GatheringByteChannel#write(java.nio.ByteBuffer[]) | ||
java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer) | ||
java.nio.channels.ScatteringByteChannel#read(java.nio.ByteBuffer[]) | ||
java.nio.channels.ScatteringByteChannel#read(java.nio.ByteBuffer[], int, int) | ||
java.nio.channels.FileChannel#read(java.nio.ByteBuffer, long) | ||
|
||
@defaultMessage Use Lucene.parseLenient instead it strips off minor version | ||
org.apache.lucene.util.Version#parseLeniently(java.lang.String) | ||
|
||
@defaultMessage unsafe encoders/decoders have problems in the lzf compress library. Use variants of encode/decode functions which take Encoder/Decoder. | ||
com.ning.compress.lzf.impl.UnsafeChunkEncoders#createEncoder(int) | ||
com.ning.compress.lzf.impl.UnsafeChunkEncoders#createNonAllocatingEncoder(int) | ||
com.ning.compress.lzf.impl.UnsafeChunkEncoders#createEncoder(int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.impl.UnsafeChunkEncoders#createNonAllocatingEncoder(int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.impl.UnsafeChunkDecoder#<init>() | ||
com.ning.compress.lzf.parallel.CompressTask | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance() | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(int) | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalNonAllocatingInstance(int) | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.util.ChunkEncoderFactory#optimalNonAllocatingInstance(int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.util.ChunkDecoderFactory#optimalInstance() | ||
com.ning.compress.lzf.util.LZFFileInputStream#<init>(java.io.File) | ||
com.ning.compress.lzf.util.LZFFileInputStream#<init>(java.io.FileDescriptor) | ||
com.ning.compress.lzf.util.LZFFileInputStream#<init>(java.lang.String) | ||
com.ning.compress.lzf.util.LZFFileOutputStream#<init>(java.io.File) | ||
com.ning.compress.lzf.util.LZFFileOutputStream#<init>(java.io.File, boolean) | ||
com.ning.compress.lzf.util.LZFFileOutputStream#<init>(java.io.FileDescriptor) | ||
com.ning.compress.lzf.util.LZFFileOutputStream#<init>(java.lang.String) | ||
com.ning.compress.lzf.util.LZFFileOutputStream#<init>(java.lang.String, boolean) | ||
com.ning.compress.lzf.LZFEncoder#encode(byte[]) | ||
com.ning.compress.lzf.LZFEncoder#encode(byte[], int, int) | ||
com.ning.compress.lzf.LZFEncoder#encode(byte[], int, int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.LZFEncoder#appendEncoded(byte[], int, int, byte[], int) | ||
com.ning.compress.lzf.LZFEncoder#appendEncoded(byte[], int, int, byte[], int, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.LZFCompressingInputStream#<init>(java.io.InputStream) | ||
com.ning.compress.lzf.LZFDecoder#fastDecoder() | ||
com.ning.compress.lzf.LZFDecoder#decode(byte[]) | ||
com.ning.compress.lzf.LZFDecoder#decode(byte[], int, int) | ||
com.ning.compress.lzf.LZFDecoder#decode(byte[], byte[]) | ||
com.ning.compress.lzf.LZFDecoder#decode(byte[], int, int, byte[]) | ||
com.ning.compress.lzf.LZFInputStream#<init>(java.io.InputStream) | ||
com.ning.compress.lzf.LZFInputStream#<init>(java.io.InputStream, boolean) | ||
com.ning.compress.lzf.LZFInputStream#<init>(java.io.InputStream, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.LZFInputStream#<init>(java.io.InputStream, com.ning.compress.BufferRecycler, boolean) | ||
com.ning.compress.lzf.LZFOutputStream#<init>(java.io.OutputStream) | ||
com.ning.compress.lzf.LZFOutputStream#<init>(java.io.OutputStream, com.ning.compress.BufferRecycler) | ||
com.ning.compress.lzf.LZFUncompressor#<init>(com.ning.compress.DataHandler) | ||
com.ning.compress.lzf.LZFUncompressor#<init>(com.ning.compress.DataHandler, com.ning.compress.BufferRecycler) | ||
|
||
@defaultMessage Spawns a new thread which is solely under lucenes control use ThreadPool#estimatedTimeInMillisCounter instead | ||
org.apache.lucene.search.TimeLimitingCollector#getGlobalTimerThread() | ||
org.apache.lucene.search.TimeLimitingCollector#getGlobalCounter() | ||
|
||
@defaultMessage Don't interrupt threads use FutureUtils#cancel(Future<T>) instead | ||
java.util.concurrent.Future#cancel(boolean) | ||
|
||
@defaultMessage Don't try reading from paths that are not configured in Environment, resolve from Environment instead | ||
org.elasticsearch.common.io.PathUtils#get(java.lang.String, java.lang.String[]) | ||
org.elasticsearch.common.io.PathUtils#get(java.net.URI) |
20 changes: 20 additions & 0 deletions
20
dev-tools/src/main/resources/forbidden/test-signatures.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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. | ||
|
||
com.carrotsearch.randomizedtesting.RandomizedTest#globalTempDir() @ Use newTempDirPath() instead | ||
com.carrotsearch.randomizedtesting.annotations.Seed @ Don't commit hardcoded seeds | ||
|
||
org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead |
Oops, something went wrong.