-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: add test exercising Gradle download pruning #19135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
smowton
merged 2 commits into
github:main
from
smowton:smowton/admin/test-gradle-bom-downloads
Mar 31, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
java/ql/integration-tests/java/buildless-gradle-boms/build.gradle
This file contains hidden or 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,18 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This is a general purpose Gradle build. | ||
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.3/samples | ||
*/ | ||
|
||
apply plugin: 'java-library' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
api 'org.apache.commons:commons-math3:3.6.1' | ||
|
||
api 'org.junit.jupiter:junit-jupiter-api:5.12.1' | ||
} |
5 changes: 5 additions & 0 deletions
5
java/ql/integration-tests/java/buildless-gradle-boms/buildless-fetches.expected
This file contains hidden or 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,5 @@ | ||
https://repo.maven.apache.org/maven2/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar | ||
https://repo.maven.apache.org/maven2/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar | ||
https://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter-api/5.12.1/junit-jupiter-api-5.12.1.jar | ||
https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.12.1/junit-platform-commons-1.12.1.jar | ||
https://repo.maven.apache.org/maven2/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar |
70 changes: 70 additions & 0 deletions
70
java/ql/integration-tests/java/buildless-gradle-boms/diagnostics.expected
This file contains hidden or 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,70 @@ | ||
{ | ||
"markdownMessage": "Java analysis used build tool Gradle to pick a JDK version and/or to recommend external dependencies.", | ||
"severity": "unknown", | ||
"source": { | ||
"extractorName": "java", | ||
"id": "java/autobuilder/buildless/using-build-tool-advice", | ||
"name": "Java analysis used build tool Gradle to pick a JDK version and/or to recommend external dependencies" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": true, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} | ||
{ | ||
"markdownMessage": "Java analysis used the system default JDK.", | ||
"severity": "unknown", | ||
"source": { | ||
"extractorName": "java", | ||
"id": "java/autobuilder/buildless/jdk-system-default", | ||
"name": "Java analysis used the system default JDK" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": true, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} | ||
{ | ||
"markdownMessage": "Java analysis with build-mode 'none' completed.", | ||
"severity": "unknown", | ||
"source": { | ||
"extractorName": "java", | ||
"id": "java/autobuilder/buildless/complete", | ||
"name": "Java analysis with build-mode 'none' completed" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": true, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} | ||
{ | ||
"markdownMessage": "Java was extracted with build-mode set to 'none'. This means that all Java source in the working directory will be scanned, with build tools such as Maven and Gradle only contributing information about external dependencies.", | ||
"severity": "note", | ||
"source": { | ||
"extractorName": "java", | ||
"id": "java/autobuilder/buildless/mode-active", | ||
"name": "Java was extracted with build-mode set to 'none'" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": true, | ||
"statusPage": true, | ||
"telemetry": true | ||
} | ||
} | ||
{ | ||
"markdownMessage": "Reading the dependency graph from build files provided 5 classpath entries", | ||
"severity": "unknown", | ||
"source": { | ||
"extractorName": "java", | ||
"id": "java/autobuilder/buildless/depgraph-provided-by-gradle", | ||
"name": "Java analysis extracted precise dependency graph information from tool Gradle" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": true, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
java/ql/integration-tests/java/buildless-gradle-boms/settings.gradle
This file contains hidden or 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,8 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* The settings file is used to specify which projects to include in your build. | ||
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.3/userguide/building_swift_projects.html in the Gradle documentation. | ||
*/ | ||
|
||
rootProject.name = 'buildless-gradle' |
6 changes: 6 additions & 0 deletions
6
java/ql/integration-tests/java/buildless-gradle-boms/source_archive.expected
This file contains hidden or 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,6 @@ | ||
.gradle/8.3/dependencies-accessors/gc.properties | ||
.gradle/8.3/gc.properties | ||
.gradle/buildOutputCleanup/cache.properties | ||
.gradle/vcs-1/gc.properties | ||
gradle/wrapper/gradle-wrapper.properties | ||
src/main/java/com/fractestexample/Test.java |
9 changes: 9 additions & 0 deletions
9
.../integration-tests/java/buildless-gradle-boms/src/main/java/com/fractestexample/Test.java
This file contains hidden or 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,9 @@ | ||
package com.fractestexample; | ||
|
||
import org.apache.commons.math3.fraction.Fraction; | ||
|
||
public class Test { | ||
|
||
public Fraction test(org.junit.jupiter.api.Test t) { return Fraction.ONE; } | ||
|
||
} |
This file contains hidden or 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,7 @@ | ||
def test(codeql, java, gradle_8_3): | ||
codeql.database.create( | ||
_env={ | ||
"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS": "true", | ||
"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_CLASSPATH_FROM_BUILD_FILES": "true", | ||
} | ||
) |
4 changes: 4 additions & 0 deletions
4
java/ql/lib/change-notes/2025-03-27-gradle-fetch-reduction.md
This file contains hidden or 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,4 @@ | ||
--- | ||
category: fix | ||
--- | ||
* In `build-mode: none` where the project has a Gradle build system, database creation no longer attempts to download some non-existent jar files relating to non-jar Maven artifacts, such as BOMs. This was harmless, but saves some time and reduces spurious warnings. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using org.junit.jupiter.api.Test as a parameter type appears to be incorrect; consider annotating the method with @test and removing the parameter to correctly define a test method.
Copilot uses AI. Check for mistakes.