Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Is it helpful to provide smaller artifact? #96

Open
KengoTODA opened this issue Jun 27, 2020 · 4 comments
Open

Is it helpful to provide smaller artifact? #96

KengoTODA opened this issue Jun 27, 2020 · 4 comments

Comments

@KengoTODA
Copy link
Member

@uhafner I found this your comment and want to ask one thing.

using the internal parser is also not very elegant since the whole SpotBugs library is required as a dependency

Is it helpful for you if spotbugs provides a thin artifact that provides:

  1. Interface and abstract classes such as BugReporter, BugInstance etc., or
  2. only core parts which does not include GUI and default detectors (Move built-in detectors to their own plugin spotbugs#193)

I think both are possible, but not sure how it helps your development.

@uhafner
Copy link

uhafner commented Jun 27, 2020

Yes, that would be helpful indeed! Currently the parser is quite simple, it just calls your API and adapts it to my object model: https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/parser/FindBugsParser.java#L128

In order to reference your parser I needed to create a patched version of your library that shades several dependencies (like ASM, which should not be required by the XML parser anyway): https://github.com/jenkinsci/findbugs-plugin/blob/master/library/pom.xml

This works for a long time now, but it causes several problems from time to time. (E.g. SAX parser using the wrong class loader, etc.).

So yes, providing 1. would be very nice. (If it also would include the parser)

@KengoTODA KengoTODA changed the title Is it helpful to provide Is it helpful to provide smaller artifact? Jun 27, 2020
@KengoTODA
Copy link
Member Author

I've checked imported classes in your code:

import edu.umd.cs.findbugs.BugAnnotation;
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.Project;
import edu.umd.cs.findbugs.SortedBugCollection;
import edu.umd.cs.findbugs.SourceLineAnnotation;

They are XMLWriteable or its collection, then it's reasonable to put them into one artifact such as spotbugs-elements or spotbugs-entities.

import edu.umd.cs.findbugs.annotations.Nullable;

This is annotation and already provided as spotbugs-annotations.

import edu.umd.cs.findbugs.ba.SourceFile;
import edu.umd.cs.findbugs.ba.SourceFinder;

Not sure how I should categorize them... util? Emm...
When I found a good naming for it, I think we can extract them as an artifact.

@KengoTODA
Copy link
Member Author

I found that Project depends on many classes including SourceFinder.

import edu.umd.cs.findbugs.ba.SourceFinder;
import edu.umd.cs.findbugs.ba.URLClassPath;
import edu.umd.cs.findbugs.charsets.UTF8;
import edu.umd.cs.findbugs.config.UserPreferences;
import edu.umd.cs.findbugs.filter.Filter;
import edu.umd.cs.findbugs.io.IO;
import edu.umd.cs.findbugs.util.Util;

@KengoTODA
Copy link
Member Author

I found that the xml package is easy to extract. We have 10 XMLWritable implementations and two of them are easy to move (worked in spotbugs/spotbugs@d5be74c):

  • AppVersion
  • BugProperty

But the other eight classes are difficult to extract, especially BugInstance which needs other packages and BCEL & ASM.

  • BugInstance
  • PackageStats
  • Project
  • ProjectStats
  • ba/ClassHash
  • log/Profiler
  • log/ProfileSummary
  • model/ClassFeatureSet

Then I'll try to find how 2 can minify the artifact.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants