Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>

<!-- Exclude json package, events package, and generated package (self-documenting DTOs) -->
<!-- Exclude module descriptor, json package, events package, and generated package (self-documenting DTOs) -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value=".*[\\/](json|events|generated|rpc)[\\/].*\.java$"/>
<property name="fileNamePattern" value="(^|.*[\\/])module-info\.java$|.*[\\/](json|events|generated|rpc)[\\/].*\.java$"/>
</module>

<module name="TreeWalker">
Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.github.copilot.sdk.java</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- Clone or update the official copilot-sdk repository for test resources, and copy image to site -->
<plugin>
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

/**
* GitHub Copilot SDK for Java.
*/
module com.github.copilot.sdk.java {
Comment thread
brunoborges marked this conversation as resolved.
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;
}
28 changes: 28 additions & 0 deletions src/test/java/com/github/copilot/sdk/ModuleDescriptorTest.java
Original file line number Diff line number Diff line change
@@ -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")));
}
}
Loading