diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 9a6f3761b5..fcde1f6c97 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -11,9 +11,9 @@ - + - + diff --git a/pom.xml b/pom.xml index 4e3273cf41..ac258afdb9 100644 --- a/pom.xml +++ b/pom.xml @@ -172,13 +172,6 @@ org.apache.maven.plugins maven-jar-plugin 3.5.0 - - - - com.github.copilot.sdk.java - - - diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000000..d912fb420f --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,26 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +/** + * GitHub Copilot SDK for Java. + */ +module com.github.copilot.sdk.java { + requires transitive com.fasterxml.jackson.annotation; + requires com.fasterxml.jackson.core; + requires transitive com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.datatype.jsr310; + requires static com.github.spotbugs.annotations; + requires static java.compiler; + requires static java.net.http; + requires java.logging; + + exports com.github.copilot.sdk; + exports com.github.copilot.sdk.generated; + exports com.github.copilot.sdk.generated.rpc; + exports com.github.copilot.sdk.json; + + opens com.github.copilot.sdk to com.fasterxml.jackson.databind; + opens com.github.copilot.sdk.generated to com.fasterxml.jackson.databind; + opens com.github.copilot.sdk.json to com.fasterxml.jackson.databind; +} diff --git a/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java b/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java new file mode 100644 index 0000000000..36be137345 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.module.ModuleDescriptor; +import org.junit.jupiter.api.Test; + +class ModuleDescriptorTest { + + @Test + void sdkHasExplicitModuleDescriptor() { + Module module = CopilotClient.class.getModule(); + assertTrue(module.isNamed()); + assertEquals("com.github.copilot.sdk.java", module.getName()); + + ModuleDescriptor descriptor = module.getDescriptor(); + assertTrue(descriptor.exports().stream().anyMatch(export -> export.source().equals("com.github.copilot.sdk"))); + assertTrue(descriptor.exports().stream() + .anyMatch(export -> export.source().equals("com.github.copilot.sdk.json"))); + assertTrue(descriptor.requires().stream() + .anyMatch(require -> require.name().equals("com.fasterxml.jackson.databind"))); + } +}