Skip to content

Commit 1cd602a

Browse files
committed
clean-up build.gradle.kts for github & update comments
1 parent 175f33d commit 1cd602a

11 files changed

+51
-114
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.gradle
22
gradle.properties
3+
maven-publish.gradle.kts
34
build/
45
!gradle/wrapper/gradle-wrapper.jar
56
!**/src/main/**/build/

build.gradle.kts

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
plugins {
22
id("java")
3-
id("maven-publish")
43
id("jacoco")
54
}
65

76
group = "io.github.jetkai"
87
version = "1.1.0"
98

109
java {
11-
withSourcesJar()
12-
withJavadocJar()
10+
//withSourcesJar()
11+
//withJavadocJar()
1312
sourceCompatibility = JavaVersion.VERSION_11
1413
targetCompatibility = JavaVersion.VERSION_11
1514
}
@@ -27,31 +26,10 @@ dependencies {
2726
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
2827
}
2928

30-
publishing {
31-
32-
publications {
33-
create<MavenPublication>("openai") {
34-
from(components["java"])
35-
}
36-
}
37-
38-
repositories {
39-
maven {
40-
val jiraUsername = System.getenv("JIRA_USERNAME") ?: ""
41-
val jiraPassword = System.getenv("JIRA_PASSWORD") ?: ""
42-
name = "OSSRH"
43-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
44-
credentials {
45-
username = jiraUsername
46-
password = jiraPassword
47-
}
48-
}
49-
}
50-
}
51-
52-
tasks.getByName<Test>("test") {
53-
useJUnitPlatform()
54-
}
29+
/**
30+
* Set Environmental Variables for the OPEN_AI_API_KEY
31+
* Called by System.getenv("OPEN_AI_API_KEY"); in source-code
32+
*/
5533

5634
tasks.register("setEnvironmentVariable") {
5735
doFirst {
@@ -65,16 +43,6 @@ tasks.register("setEnvironmentVariable") {
6543
}
6644
}
6745

68-
tasks.test {
69-
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
70-
}
71-
tasks.jacocoTestReport {
72-
reports {
73-
xml.required.set(true)
74-
}
75-
dependsOn(tasks.test) // tests are required to run before generating the report
76-
}
77-
7846
tasks.withType<Jar> {
7947
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
8048

@@ -86,4 +54,29 @@ tasks.withType<Jar> {
8654
from({
8755
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
8856
})
89-
}
57+
}
58+
59+
tasks.getByName<Test>("test") {
60+
useJUnitPlatform()
61+
}
62+
63+
/**
64+
* Jacoco Testing Plugin
65+
* --- START ---
66+
*/
67+
68+
tasks.test {
69+
finalizedBy(tasks.jacocoTestReport)
70+
}
71+
72+
tasks.jacocoTestReport {
73+
reports {
74+
xml.required.set(true)
75+
}
76+
dependsOn(tasks.test)
77+
}
78+
79+
/**
80+
* Jacoco Testing Plugin
81+
* --- END ---
82+
*/

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "openai-for-java"
1+
rootProject.name = "openai"

src/main/java/examples/ExampleChatGPT.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,12 @@
2121
*
2222
* <p>
2323
* Note - This is just a test class, it is recommended to import this project as a library
24-
* </p>
24+
* <p>
25+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2526
*/
2627
final class ExampleChatGPT {
2728

28-
/*
29-
* You can get a free API key from https://platform.openai.com/account/api-keys
30-
* OpenAI openAI = OpenAI.builder()
31-
* .setApiKey("YOUR_API_KEY")
32-
* .setOrganization("YOUR_ORGANIZATION")
33-
* .build();
34-
*/
35-
36-
//This is a List that will store all our conversation history
37-
//This includes our chat history and the AI's
29+
//This is a List that will store all our conversation history - This includes our chat history and the AI's
3830
private final List<ChatCompletionMessageData> messageHistory = new ArrayList<>();
3931

4032
public static void main(String[] args) {

src/main/java/examples/ExampleImageCreation.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,11 @@
2020
*
2121
* <p>
2222
* Note - This is just a test class, it is recommended to import this project as a library
23-
* </p>
23+
* <p>
24+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2425
*/
2526
final class ExampleImageCreation {
2627

27-
/*
28-
* You can get a free API key from https://platform.openai.com/account/api-keys
29-
* OpenAI openAI = OpenAI.builder()
30-
* .setApiKey("YOUR_API_KEY")
31-
* .setOrganization("YOUR_ORGANIZATION")
32-
* .build();
33-
*/
34-
3528
public static void main(String[] args) throws IOException {
3629
//Initialize ExampleImageCreation class
3730
ExampleImageCreation imageCreation = new ExampleImageCreation();

src/main/java/examples/ExampleListModel.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@
1616
*
1717
* <p>
1818
* Note - This is just a test class, it is recommended to import this project as a library
19-
* </p>
19+
* <p>
20+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2021
*/
2122
final class ExampleListModel {
2223

23-
/*
24-
* You can get a free API key from https://platform.openai.com/account/api-keys
25-
* OpenAI openAI = OpenAI.builder()
26-
* .setApiKey("YOUR_API_KEY")
27-
* .setOrganization("YOUR_ORGANIZATION")
28-
* .build();
29-
*/
30-
3124
public static void main(String[] args) {
3225
//Initialize ExampleListModel class
3326
ExampleListModel getModel = new ExampleListModel();

src/main/java/examples/ExampleListModels.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,11 @@
1818
*
1919
* <p>
2020
* Note - This is just a test class, it is recommended to import this project as a library
21-
* </p>
21+
* <p>
22+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2223
*/
2324
final class ExampleListModels {
2425

25-
/*
26-
* You can get a free API key from https://platform.openai.com/account/api-keys
27-
* OpenAI openAI = OpenAI.builder()
28-
* .setApiKey("YOUR_API_KEY")
29-
* .setOrganization("YOUR_ORGANIZATION")
30-
* .build();
31-
*/
32-
3326
public static void main(String[] args) {
3427
//Initialize ExampleListModels class
3528
ExampleListModels getModels = new ExampleListModels();

src/main/java/examples/ExampleSpellingCorrection.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,11 @@
1717
*
1818
* <p>
1919
* Note - This is just a test class, it is recommended to import this project as a library
20-
* </p>
20+
* <p>
21+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2122
*/
2223
final class ExampleSpellingCorrection {
2324

24-
/*
25-
* You can get a free API key from https://platform.openai.com/account/api-keys
26-
* OpenAI openAI = OpenAI.builder()
27-
* .setApiKey("YOUR_API_KEY")
28-
* .setOrganization("YOUR_ORGANIZATION")
29-
* .build();
30-
*/
31-
3225
public static void main(String[] args) {
3326
//Initialize ExampleSpellingCorrection class
3427
ExampleSpellingCorrection getModel = new ExampleSpellingCorrection();

src/main/java/examples/ExampleTranscriptionFromAudioFile.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,11 @@
2020
*
2121
* <p>
2222
* Note - This is just a test class, it is recommended to import this project as a library
23-
* </p>
23+
* <p>
24+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2425
*/
2526
final class ExampleTranscriptionFromAudioFile {
2627

27-
/*
28-
* You can get a free API key from https://platform.openai.com/account/api-keys
29-
* OpenAI openAI = OpenAI.builder()
30-
* .setApiKey("YOUR_API_KEY")
31-
* .setOrganization("YOUR_ORGANIZATION")
32-
* .build();
33-
*/
34-
3528
public static void main(String[] args) throws URISyntaxException {
3629
//Initialize ExampleTranslationFromAudioFile class
3730
ExampleTranscriptionFromAudioFile transcriptAudioFile = new ExampleTranscriptionFromAudioFile();

src/main/java/examples/ExampleTranslation.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,11 @@
1818
*
1919
* <p>
2020
* Note - This is just a test class, it is recommended to import this project as a library
21-
* </p>
21+
* <p>
22+
* You can get a free API key from <a href="https://platform.openai.com/account/api-keys">here</a>
2223
*/
2324
final class ExampleTranslation {
2425

25-
/*
26-
* You can get a free API key from https://platform.openai.com/account/api-keys
27-
* OpenAI openAI = OpenAI.builder()
28-
* .setApiKey("YOUR_API_KEY")
29-
* .setOrganization("YOUR_ORGANIZATION")
30-
* .build();
31-
*/
32-
3326
public static void main(String[] args) {
3427
//Initialize ExampleTranslation class
3528
ExampleTranslation translation = new ExampleTranslation();

0 commit comments

Comments
 (0)