Add test re: buildless mode interaction with snapshot repositories

This commit is contained in:
Chris Smowton
2023-09-21 19:44:16 +01:00
parent 2d44724acd
commit 0b5727f1d1
14 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>snapshot-test-repo</id>
<url>http://localhost:9427/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.my.snapshot.test</groupId>
<artifactId>snapshottest</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,24 @@
<metadata modelVersion="1.1.0">
<groupId>com.github.my.snapshot.test</groupId>
<artifactId>snapshottest</artifactId>
<version>1.0-SNAPSHOT</version>
<versioning>
<lastUpdated>20230101020304</lastUpdated>
<snapshot>
<timestamp>20230901.050514</timestamp>
<buildNumber>100</buildNumber>
</snapshot>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>1.0-20230901.050514-100</value>
<updated>20230101020304</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>1.0-20230901.050514-100</value>
<updated>20230101020304</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>

View File

@@ -0,0 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.my.snapshot.test</groupId>
<artifactId>snapshottest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

View File

@@ -0,0 +1,7 @@
import testpkg.DepClass;
public class Test {
DepClass dc;
}

View File

@@ -0,0 +1,3 @@
diagnostics
#select
| DepClass |

View File

@@ -0,0 +1,12 @@
import sys
from create_database_utils import *
import subprocess
repo_server_process = subprocess.Popen(["python3", "-m", "http.server", "9427"], cwd = "repo")
try:
run_codeql_database_create([], lang="java", extra_args=["--extractor-option=buildless=true"], extra_env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_CLASSPATH_FROM_BUILD_FILES": "true"})
finally:
repo_server_process.kill()

View File

@@ -0,0 +1,8 @@
import java
import semmle.code.java.Diagnostics
query predicate diagnostics(Diagnostic d) { any() }
from Class c
where c.getName() = "DepClass"
select c.toString()