Skip to content

Commit

Permalink
Add rule for 'com.google.code.findbugs:findbugs-annotations'
Browse files Browse the repository at this point in the history
Fixes #62
  • Loading branch information
jjohannes committed Jan 29, 2024
1 parent d6da2c9 commit 03d8e2d
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ Each Capability's GA coordinates correspond to the GA coordinates of the Compone
* [com.mchange:c3p0](https://search.maven.org/artifact/com.mchange/c3p0)
* [cglib:cglib](https://search.maven.org/artifact/cglib/cglib) ([CGlibRule](src/main/java/org/gradlex/javaecosystem/capabilities/rules/CGlibRule.java))
* [cglib:cglib-nodep](https://search.maven.org/artifact/cglib/cglib-nodep)
* [com.google.code.findbugs:annotations](https://search.maven.org/artifact/com.google.code.findbugs/annotations) ([FindbugsAnnotationsRule](src/main/java/org/gradlex/javaecosystem/capabilities/rules/FindbugsAnnotationsRule.java))
* [com.google.code.findbugs:findbugs-annotations](https://search.maven.org/artifact/com.google.code.findbugs/findbugs-annotations)
* [com.github.spotbugs:spotbugs-annotations](https://search.maven.org/artifact/com.github.spotbugs/spotbugs-annotations)
* [com.google.collections:google-collections](https://search.maven.org/artifact/com.google.collections/google-collections) ([GoogleCollectionsRule](src/main/java/org/gradlex/javaecosystem/capabilities/rules/GoogleCollectionsRule.java))
* [com.google.guava:guava](https://search.maven.org/artifact/com.google.guava/guava)
* [com.google.guava:guava](https://search.maven.org/artifact/com.google.guava/guava) ([GuavaRule](src/main/java/org/gradlex/javaecosystem/capabilities/rules/GuavaRule.java))
Expand Down
3 changes: 3 additions & 0 deletions samples/sample-all-deactivated/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ dependencies {
implementation("c3p0:c3p0:0.9.1.2")
implementation("cglib:cglib-nodep:3.2.12")
implementation("cglib:cglib:3.3.0")
implementation("com.github.spotbugs:spotbugs-annotations:4.8.3")
implementation("com.github.stephenc.jcip:jcip-annotations:1.0-1")
implementation("com.google.code.findbugs:annotations:3.0.1")
implementation("com.google.code.findbugs:findbugs-annotations:3.0.1")
implementation("com.google.collections:google-collections:1.0")
implementation("com.google.guava:guava-jdk5:17.0")
implementation("com.google.guava:guava:33.0.0-jre")
Expand Down
3 changes: 3 additions & 0 deletions samples/sample-all-deactivated/build.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ compileClasspath - Compile classpath for source set 'main'.
+--- c3p0:c3p0:0.9.1.2 FAILED
+--- cglib:cglib-nodep:3.2.12 FAILED
+--- cglib:cglib:3.3.0 FAILED
+--- com.github.spotbugs:spotbugs-annotations:4.8.3 FAILED
+--- com.github.stephenc.jcip:jcip-annotations:1.0-1 FAILED
+--- com.google.code.findbugs:annotations:3.0.1 FAILED
+--- com.google.code.findbugs:findbugs-annotations:3.0.1 FAILED
+--- com.google.collections:google-collections:1.0 FAILED
+--- com.google.guava:guava-jdk5:17.0 FAILED
+--- com.google.guava:guava:33.0.0-jre FAILED
Expand Down
3 changes: 3 additions & 0 deletions samples/sample-all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ dependencies {
implementation("c3p0:c3p0:0.9.1.2")
implementation("cglib:cglib-nodep:3.2.12")
implementation("cglib:cglib:3.3.0")
implementation("com.github.spotbugs:spotbugs-annotations:4.8.3")
implementation("com.github.stephenc.jcip:jcip-annotations:1.0-1")
implementation("com.google.code.findbugs:annotations:3.0.1")
implementation("com.google.code.findbugs:findbugs-annotations:3.0.1")
implementation("com.google.collections:google-collections:1.0")
implementation("com.google.guava:guava-jdk5:17.0")
implementation("com.google.guava:guava:33.0.0-jre")
Expand Down
4 changes: 4 additions & 0 deletions samples/sample-all/build.out
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ compileClasspath - Compile classpath for source set 'main'.
+--- cglib:cglib-nodep:3.2.12 -> cglib:cglib:3.3.0
| \--- org.ow2.asm:asm:7.1 -> 9.2
+--- cglib:cglib:3.3.0 (*)
+--- com.github.spotbugs:spotbugs-annotations:4.8.3
| \--- com.google.code.findbugs:jsr305:3.0.2
+--- com.github.stephenc.jcip:jcip-annotations:1.0-1
+--- com.google.code.findbugs:annotations:3.0.1 -> com.github.spotbugs:spotbugs-annotations:4.8.3 (*)
+--- com.google.code.findbugs:findbugs-annotations:3.0.1 -> com.github.spotbugs:spotbugs-annotations:4.8.3 (*)
+--- com.google.collections:google-collections:1.0 -> com.google.guava:guava:33.0.0-jre
| +--- com.google.guava:failureaccess:1.0.2
| +--- com.google.code.findbugs:jsr305:3.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.gradlex.javaecosystem.capabilities.rules.CGlibRule;
import org.gradlex.javaecosystem.capabilities.rules.CommonsIoRule;
import org.gradlex.javaecosystem.capabilities.rules.Dom4jRule;
import org.gradlex.javaecosystem.capabilities.rules.FindbugsAnnotationsRule;
import org.gradlex.javaecosystem.capabilities.rules.GoogleCollectionsRule;
import org.gradlex.javaecosystem.capabilities.rules.GuavaListenableFutureRule;
import org.gradlex.javaecosystem.capabilities.rules.GuavaRule;
Expand Down Expand Up @@ -163,6 +164,7 @@ private void registerCapabilityRules(ComponentMetadataHandler components, Set<St
registerRule(CGlibRule.CAPABILITY, CGlibRule.MODULES, CGlibRule.class, null, components, allCapabilities);
registerRule(CommonsIoRule.CAPABILITY, CommonsIoRule.MODULES, CommonsIoRule.class, null, components, allCapabilities);
registerRule(Dom4jRule.CAPABILITY, Dom4jRule.MODULES, Dom4jRule.class, null, components, allCapabilities);
registerRule(FindbugsAnnotationsRule.CAPABILITY, FindbugsAnnotationsRule.MODULES, FindbugsAnnotationsRule.class, null, components, allCapabilities);
registerRule(GoogleCollectionsRule.CAPABILITY, GoogleCollectionsRule.MODULES, GoogleCollectionsRule.class, null, components, allCapabilities);
registerRule(GuavaListenableFutureRule.CAPABILITY, GuavaListenableFutureRule.MODULES, GuavaListenableFutureRule.class, null, components, allCapabilities);
registerRule(GuavaRule.CAPABILITY, GuavaRule.MODULES, GuavaRule.class, null, components, allCapabilities);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2022 the GradleX team.
*
* Licensed 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.
*/

package org.gradlex.javaecosystem.capabilities.rules;

import org.gradle.api.NonNullApi;
import org.gradle.api.artifacts.CacheableRule;
import org.gradle.api.artifacts.ComponentMetadataContext;
import org.gradle.api.artifacts.ComponentMetadataRule;

@CacheableRule
@NonNullApi
public abstract class FindbugsAnnotationsRule implements ComponentMetadataRule {

public static final String CAPABILITY_GROUP = "com.google.code.findbugs";
public static final String CAPABILITY_NAME = "annotations";
public static final String CAPABILITY = CAPABILITY_GROUP + ":" + CAPABILITY_NAME;

public static final String[] MODULES = {
"com.google.code.findbugs:findbugs-annotations",
"com.github.spotbugs:spotbugs-annotations"
};

@Override
public void execute(ComponentMetadataContext context) {
String version = context.getDetails().getId().getVersion();
context.getDetails().allVariants(variant -> variant.withCapabilities(capabilities -> capabilities.addCapability(
CAPABILITY_GROUP, CAPABILITY_NAME, version
)));
}
}

0 comments on commit 03d8e2d

Please sign in to comment.