Skip to content

Commit 4478c81

Browse files
authored
Sherlock Trunks - Version 3 (sonatype-nexus-community#171)
1 parent 36be381 commit 4478c81

File tree

64 files changed

+453
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+453
-986
lines changed

.circleci/config.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: 2.1
22
orbs:
3-
gradle: circleci/gradle@1.0.11
3+
gradle: circleci/gradle@3.0.0
44
executors:
5-
openjdk-8-executor:
5+
openjdk-11-executor:
66
docker:
7-
- image: 'circleci/android:api-28-alpha'
7+
- image: 'circleci/android:api-29'
88

99
commands:
1010
configure-git:
@@ -23,7 +23,7 @@ commands:
2323
2424
jobs:
2525
do-release:
26-
executor: openjdk-8-executor
26+
executor: openjdk-11-executor
2727
parameters:
2828
ssh-fingerprints:
2929
type: string
@@ -36,15 +36,15 @@ jobs:
3636
- gradle-release
3737

3838
it-defaults: &it-defaults
39-
executor: openjdk-8-executor
39+
executor: openjdk-11-executor
4040
test_results_path: build/test-results
4141
reports_path: build/reports
4242

4343
workflows:
4444
checkout-run_task:
4545
jobs:
4646
- gradle/test:
47-
executor: openjdk-8-executor
47+
executor: openjdk-11-executor
4848
test_results_path: build/test-results
4949
reports_path: build/reports
5050
test_command: test --no-daemon --debug --max-workers 2
@@ -70,36 +70,24 @@ workflows:
7070
test_command: --no-daemon -Dorg.gradle.daemon=false --info it2
7171
it3:
7272
jobs:
73-
- gradle/test:
73+
- gradle/test:
7474
<<: *it-defaults
7575
test_command: --no-daemon -Dorg.gradle.daemon=false --info it3
7676
it4:
7777
jobs:
78-
- gradle/test:
78+
- gradle/test:
7979
<<: *it-defaults
8080
test_command: --no-daemon -Dorg.gradle.daemon=false --info it4
8181
it5:
8282
jobs:
83-
- gradle/test:
83+
- gradle/test:
8484
<<: *it-defaults
8585
test_command: --no-daemon -Dorg.gradle.daemon=false --info it5
8686
it6:
87-
jobs:
88-
- gradle/test:
89-
<<: *it-defaults
90-
test_command: --no-daemon -Dorg.gradle.daemon=false --info it6
91-
92-
it7:
93-
jobs:
94-
- gradle/test:
95-
<<: *it-defaults
96-
test_command: --no-daemon -Dorg.gradle.daemon=false --info it7
97-
98-
it8:
9987
jobs:
10088
- gradle/test:
10189
<<: *it-defaults
102-
test_command: --no-daemon -Dorg.gradle.daemon=false --info it8
90+
test_command: --no-daemon -Dorg.gradle.daemon=false --info it6
10391

10492
release:
10593
jobs:

.github/actions/setup/action.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ runs:
77
uses: actions/setup-java@v4
88
with:
99
distribution: 'temurin'
10-
# TODO: Update this to Java 11 after branch `version3` is merged
11-
java-version: 8
10+
java-version: 11
1211
- name: Setup Gradle
1312
uses: gradle/actions/setup-gradle@v4

.github/workflows/ci.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ jobs:
3030
strategy:
3131
# might be helpful to limit threads in local builds
3232
#max-parallel: 2
33-
# TODO: Update this to remove obsolete itX's after branch `version3` is merged
3433
matrix:
35-
it: [it1, it2, it3, it4, it5, it6, it7, it8]
34+
it: [it1, it2, it3, it4, it5, it6]
3635
runs-on: ubuntu-latest
3736
steps:
3837
- name: Checkout
@@ -68,4 +67,4 @@ jobs:
6867
username: ${{ secrets.SONATYPE_LIFECYCLE_USERNAME }}
6968
password: ${{ secrets.SONATYPE_LIFECYCLE_PASSWORD }}
7069
application-id: 'scan-gradle-plugin'
71-
scan-targets: '.'
70+
scan-targets: './build.gradle'

.java-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ If you want to save some time, skip integration tests:
4242
> ./gradlew integrationTest
4343
4444
## Compatibility
45-
The plugin can be used on projects with Gradle 3.3 or higher (local installation or wrapper) and Java 8 installed locally.
45+
The plugin from release 3.0.0 onwards, can be used with Java 11 installed locally on projects with Gradle versions:
46+
- 5.0 until 6.4.1
47+
- 7.6.4
48+
- 8.3 or higher
49+
50+
It has ranges of supported versions due to a known bug in Gradle for plugins with multi-jar dependencies. See more at:
51+
- https://github.com/gradle/gradle/issues/27156
52+
- https://discuss.gradle.org/t/is-there-any-way-to-skip-gradle-instrumenting-classpath-file-transformer/45213/3
53+
54+
All plugin releases prior to 3.0.0, can be used on projects with Gradle 3.3 or higher (local installation or wrapper) and Java 8 installed locally.
4655

4756
## Supported Programming Languages
4857
Gradle can be used to build projects developed in various programming languages. This plugin supports:
@@ -72,6 +81,13 @@ Some basic examples follow, which we strongly advise reading :)
7281

7382
After doing so, specific usage on CI tools can be found at https://github.com/guillermo-varela/example-scan-gradle-plugin
7483

84+
Also, when running the tasks please set the log level to `INFO` to see results using `-i` or `--info`:
85+
86+
```
87+
./gradlew ossIndexAudit --info
88+
./gradlew nexusIQScan --info
89+
```
90+
7591
### OSS Index
7692
OSS Index can be used without any extra configuration, but to avoid reaching the limit for anonymous queries every user
7793
is encouraged to create a free account on [OSS Index](https://ossindex.sonatype.org/user/signin) and use the credentials

build.gradle

+15-42
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
2-
31
plugins {
42
id 'java-gradle-plugin'
53
id 'maven-publish'
64
id 'signing'
75
id 'net.researchgate.release' version '3.0.0'
86
id 'io.codearte.nexus-staging' version '0.30.0'
97
id 'com.gradle.plugin-publish' version '0.21.0'
10-
id 'com.github.johnrengelman.shadow' version '7.1.2'
118
}
129

1310
apply from: 'gradle/integration-test.gradle'
@@ -26,8 +23,8 @@ gradlePlugin {
2623
}
2724

2825
java {
29-
sourceCompatibility = JavaVersion.VERSION_1_8
30-
targetCompatibility = JavaVersion.VERSION_1_8
26+
sourceCompatibility = JavaVersion.VERSION_11
27+
targetCompatibility = JavaVersion.VERSION_11
3128
withJavadocJar()
3229
withSourcesJar()
3330
}
@@ -49,49 +46,33 @@ jar {
4946
}
5047
}
5148

52-
shadowJar {
53-
mergeServiceFiles()
54-
archiveClassifier.set('')
55-
}
56-
57-
task relocateShadowJar(type: ConfigureShadowRelocation) {
58-
target = tasks.shadowJar
59-
}
60-
61-
tasks.shadowJar.dependsOn tasks.relocateShadowJar
62-
63-
artifacts {
64-
archives shadowJar
65-
}
66-
6749
allprojects {
6850
repositories {
6951
mavenCentral()
7052
}
7153
}
7254

73-
dependencies {
74-
shadow localGroovy()
75-
shadow gradleApi()
55+
ext {
56+
nexusPlatformApiVersion='5.1.2-01'
57+
ossIndexClientVersion='1.8.2'
58+
logbackVersion='1.3.14'
59+
commonsIoVersion='2.16.1'
7660

77-
implementation ("com.sonatype.nexus:nexus-platform-api:$nexusPlatformApiVersion") {
78-
exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit'
79-
}
80-
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.13.3.202401111512-r'
61+
junitVersion='4.13.2'
62+
mockitoVersion='5.12.0'
63+
assertJVersion='3.25.3'
64+
}
65+
66+
dependencies {
67+
implementation "com.sonatype.nexus:nexus-platform-api:$nexusPlatformApiVersion"
8168
implementation "org.sonatype.ossindex:ossindex-service-client:$ossIndexClientVersion"
8269
implementation "ch.qos.logback:logback-classic:$logbackVersion"
8370
implementation "commons-io:commons-io:$commonsIoVersion"
8471

8572
testImplementation gradleTestKit()
8673
testImplementation "junit:junit:$junitVersion"
8774
testImplementation "org.assertj:assertj-core:$assertJVersion"
88-
testImplementation "org.powermock:powermock-module-junit4:$powermockVersion"
89-
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
90-
}
91-
92-
// Remove the gradleApi so it isn't merged into the jar file when applying 'shadow'
93-
configurations.named(JavaPlugin.API_CONFIGURATION_NAME) {
94-
dependencies.remove(project.dependencies.gradleApi())
75+
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
9576
}
9677

9778
processResources {
@@ -104,14 +85,6 @@ test {
10485
maxHeapSize = '512m'
10586
}
10687

107-
sourceSets {
108-
test {
109-
// Groovy and Gradle libraries on the new shadow configuration need to be available for tests
110-
compileClasspath = configurations.shadow + compileClasspath
111-
runtimeClasspath = configurations.shadow + runtimeClasspath
112-
}
113-
}
114-
11588
publishing {
11689
afterEvaluate {
11790
def pluginUrl = 'https://github.com/sonatype-nexus-community/scan-gradle-plugin'

gradle.properties

+1-10
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,5 @@
1515
#
1616

1717
group=org.sonatype.gradle.plugins
18-
version=2.8.4-SNAPSHOT
18+
version=3.0.0-SNAPSHOT
1919
release.useAutomaticVersion=true
20-
21-
nexusPlatformApiVersion=4.0.7-01
22-
ossIndexClientVersion=1.8.2
23-
logbackVersion=1.3.14
24-
commonsIoVersion=2.16.1
25-
26-
junitVersion=4.13.2
27-
powermockVersion=2.0.9
28-
assertJVersion=3.25.3

gradle/integration-test.gradle

+4-6
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ task integrationTest(type: Test) {
1212
group = 'verification'
1313
}
1414

15-
['**/ScanIT_Gradle_Versions_3_3*.class',
16-
'**/ScanIT_Gradle_Versions_4_1*.class',
17-
'**/ScanIT_Gradle_Versions_4_4*.class',
18-
'**/ScanIT_Gradle_Versions_5_0*.class',
15+
['**/ScanIT_Gradle_Versions_5_0*.class',
1916
'**/ScanIT_Gradle_Versions_5_5*.class',
2017
'**/ScanIT_Gradle_Versions_6_0*.class',
21-
'**/ScanIT_Gradle_Versions_6_6*.class',
22-
'**/ScanIT_Gradle_Versions_7_0*.class'].eachWithIndex { className, index ->
18+
'**/ScanIT_Gradle_Versions_7_6*.class',
19+
'**/ScanIT_Gradle_Versions_8_3*.class',
20+
'**/ScanIT_Gradle_Versions_8_6*.class'].eachWithIndex { className, index ->
2321
task "it${index + 1}"(type: Test) {
2422
includes = [className]
2523
description = "Runs the integration tests on class $className."

gradle/wrapper/gradle-wrapper.jar

2.36 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)