[ 
https://issues.apache.org/jira/browse/SOLR-13452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16859508#comment-16859508
 ] 

Mark Miller commented on SOLR-13452:
------------------------------------

I'm fleshing out dependency checking a bit more.

 

jdeps is really quite useful. I'd like to work towards a couple checks that are 
part of some precommit type task. I've got these targets mostly working.

The first is an extension of the above output. We can fail the task when it 
appears new deps have come in and are not statically referenced. You will be 
able to add exclusions with a reason when a dep is still required. To help 
track down if a dep is still required, each class in a jar that looks unused 
will be searched for in the src of all the project jars and if a class is 
referenced  in say, an xml or java file, that information will be provided.

Another task will find classes that are referenced, but no jar exists for them. 
Again, we can fail the task and add exclusions and a reason where we expect and 
want this (hadoop for example, annotation jars for example).

Here is some sample output for an early impl of the unusedDependencies task. 
Jars with a * where found to have classes that are referenced in the src jars 
of other dependencies. This is on the solr-core module:

 
{noformat}
Our classpath dependency count 101
Our directly used dependency count 76

List of possibly unused jars - they may be used at runtime however 
(Class.forName on plugins or other dynamic Object instantiation for example). 
This is not definitive, but helps narrow down what to investigate.
We take our classpath dependencies, substract our direct dependencies and then 
subtract dependencies used by our direct dependencies.

Direct deps that may be unused:

-> Found org.apache.kerby.x509.type.SubjectPublicKeyInfo in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.apache.kerby/kerb-core/1.0.1/bdb610cf26e95c6b072a26be697311db445e1711/kerb-core-1.0.1-sources.jar
 -> org/apache/kerby/kerberos/kerb/type/pa/pkinit/AuthPack.java
-> Found org.apache.kerby.x509.type.AlgorithmIdentifier in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.apache.kerby/kerb-core/1.0.1/bdb610cf26e95c6b072a26be697311db445e1711/kerb-core-1.0.1-sources.jar
 -> org/apache/kerby/kerberos/kerb/type/pa/pkinit/AlgorithmIdentifiers.java

- kerby-pkix-1.0.1.jar *
- org.restlet.ext.servlet-2.3.0.jar

Deps brought in by other modules that may be unused in this module:
- asm-analysis-6.2.jar

-> Found org.objectweb.asm.tree.AbstractInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/SourceValue.java
-> Found org.objectweb.asm.tree.FieldInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.IincInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.InsnList in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.InsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/6.2/34e0c61d4d7e9921681e8053a23f4e28fbb998f1/asm-commons-6.2-sources.jar
 -> org/objectweb/asm/commons/JSRInlinerAdapter.java
-> Found org.objectweb.asm.tree.IntInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.InvokeDynamicInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.JumpInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.LabelNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.LdcInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.LocalVariableNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/6.2/34e0c61d4d7e9921681e8053a23f4e28fbb998f1/asm-commons-6.2-sources.jar
 -> org/objectweb/asm/commons/JSRInlinerAdapter.java
-> Found org.objectweb.asm.tree.LookupSwitchInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.MethodInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.MethodNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.MultiANewArrayInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.TableSwitchInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.TryCatchBlockNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java
-> Found org.objectweb.asm.tree.TypeInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/BasicInterpreter.java
-> Found org.objectweb.asm.tree.VarInsnNode in src:
/home/mark/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/6.2/a14aec1bf493541fc9cb94b97eb7f8cf9f161b10/asm-analysis-6.2-sources.jar
 -> org/objectweb/asm/tree/analysis/Analyzer.java

- asm-tree-6.2.jar *
- kerb-crypto-1.0.1.jar
- kerby-config-1.0.1.jar
- kerby-util-1.0.1.jar
- lucene-spatial-8.1.0.jar
{noformat}

> Update the lucene-solr build from Ivy+Ant+Maven (shadow build) to Gradle.
> -------------------------------------------------------------------------
>
>                 Key: SOLR-13452
>                 URL: https://issues.apache.org/jira/browse/SOLR-13452
>             Project: Solr
>          Issue Type: Improvement
>          Components: Build
>            Reporter: Mark Miller
>            Assignee: Mark Miller
>            Priority: Major
>             Fix For: master (9.0)
>
>
> I took some things from the great work that Dat did in 
> [https://github.com/apache/lucene-solr/tree/jira/gradle] and took the ball a 
> little further.
>  
> When working with gradle in sub modules directly, I recommend 
> [https://github.com/dougborg/gdub]
> This gradle branch uses the following plugin for version locking, version 
> configuration and version consistency across modules: 
> [https://github.com/palantir/gradle-consistent-versions]
>  
>  https://github.com/apache/lucene-solr/tree/jira/SOLR-13452_gradle_3



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to