Skip to content

Commit 1f1399a

Browse files
committed
Tweaks
Took 2 hours 2 minutes
1 parent 4c60e44 commit 1f1399a

File tree

5 files changed

+73
-54
lines changed

5 files changed

+73
-54
lines changed

build.gradle.kts

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import java.net.URI
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.gradle.initialization.Environment.Properties
23

4+
//The project's information.
35
group = "net.cameronbowe" //The project's group.
46
version = "1.0.0" //The project's version.
57
description = "A utility to access Vouchley's API with ease." //The project's description.
@@ -24,54 +26,71 @@ dependencies {
2426
implementation("org.apache.httpcomponents", "httpclient", "4.5.13") //Implement apache http client (for http requests).
2527
}
2628

27-
//The publishing to maven.
29+
//The tasks.
30+
tasks {
31+
32+
//The without dependencies jar creation task.
33+
task("withoutDepends", type = Jar::class) {
34+
from(sourceSets.main.get().allSource) //Add the main sources.
35+
archiveClassifier.set("withoutDepends") //Set the classifier.
36+
archiveFileName.set("${project.name}-${project.version}-without-depends.jar") //Set the file name.
37+
}
38+
39+
//The with dependencies jar creation task.
40+
task("withDepends", type = ShadowJar::class) {
41+
from(sourceSets.main.get().allSource) //Add the main sources.
42+
archiveClassifier.set("withDepends") //Set the classifier.
43+
configurations = listOf(project.configurations.runtimeClasspath.get()) //Set the configurations.
44+
archiveFileName.set("${project.name}-${project.version}-with-depends.jar") //Set the archive file name.
45+
relocate("com.google.gson", "net.cameronbowe.relocated.com.google.gson") //Relocate gson (so it doesn't conflict with other plugins).
46+
relocate("org.apache", "net.cameronbowe.relocated.org.apache") //Relocate apache (so it doesn't conflict with other plugins).
47+
exclude("mozilla/**", "META-INF/**", "module-info.class") //Exclude some stuff.
48+
}
49+
50+
}
51+
52+
//The publishing to my software repository.
2853
publishing {
2954

30-
//The publishing repository.
55+
//The publishing repositories (where to publish).
3156
repositories {
32-
33-
//Add the Maven Central repository.
3457
maven {
35-
url = uri("https://s01.oss.sonatype.org/content/repositories/releases/") //The sonatype repository.
36-
credentials {
37-
username = project.findProperty("ossrhUsername")?.toString()
38-
password = project.findProperty("ossrhPassword")?.toString()
58+
name = "net.cameronbowe" //The name of the repository.
59+
url = uri("https://software.cameronbowe.net/public") //The URL of the repository.
60+
authentication { create<BasicAuthentication>("basic") } //The authentication of the repository.
61+
credentials(PasswordCredentials::class) { //The credentials of the repository.
62+
username = findProperty("softwareRepositoryUsername") as String? //The username of the repository.
63+
password = findProperty("softwareRepositoryPassword") as String? //The password of the repository.
3964
}
4065
}
41-
4266
}
4367

4468
//The publishing publications (what to publish).
4569
publications {
4670

47-
//The maven java publication.
48-
register("mavenJava", MavenPublication::class) {
49-
artifact(tasks.named("shadowJar").get()) { classifier = "all" } //Publish the shadow jar.
71+
//The without dependencies publication.
72+
create<MavenPublication>("withoutDepends") {
73+
artifactId = project.name //Set the artifact ID.
74+
groupId = project.group.toString() //Set the group ID.
75+
version = project.version.toString() //Set the version.
76+
artifact(tasks["withoutDepends"]) //Set the artifact.
77+
}
78+
79+
//The with dependencies publication.
80+
create<MavenPublication>("withDepends") { //Create a maven publication.
81+
artifactId = project.name //Set the artifact ID.
82+
groupId = project.group.toString() //Set the group ID.
83+
version = project.version.toString() //Set the version.
84+
artifact(tasks["withDepends"]) //Set the artifact.
5085
}
5186

5287
}
88+
5389
}
5490

55-
//The signing (of the maven publication).
91+
//The signing of the publications.
5692
signing {
57-
sign(publishing.publications["mavenJava"]) //Sign the maven publication.
58-
sign(configurations.archives.get()) //Sign the archives.
5993
useGpgCmd() //Use the gpg command.
60-
}
61-
62-
//Compilation.
63-
tasks {
64-
65-
//Handle java compilation.
66-
compileJava { //On java compilation.
67-
options.encoding = "UTF-8" //Make sure text is UTF-8 (stuff bugs out otherwise).
68-
}
69-
70-
//Handle shadow jar (shading/relocation).
71-
shadowJar {
72-
relocate("com.google.gson", "com.vouchley.relocated.com.google.gson") //Relocate gson (so it doesn't conflict with other plugins).
73-
relocate("org.apache.http", "com.vouchley.relocated.apache.http") //Relocate apache http (so it doesn't conflict with other plugins).
74-
exclude("**/*.txt", "**./META-INF/*") //Exclude gibberish files.
75-
}
76-
94+
sign(publishing.publications["withoutDepends"]) //Sign the without dependencies publication.
95+
sign(publishing.publications["withDepends"]) //Sign the with dependencies publication.
7796
}

src/main/java/net/cameronbowe/vouchleyapi/VouchleyAPI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.cameronbowe.vouchleyapi;
22

33
/*
4-
* Made with by Cameron Bowe (https://cameronbowe.net).
4+
* Engineered with love by Cameron Bowe (https://cameronbowe.net).
55
* Copyright (©) 2023, all rights reserved.
66
*/
77

@@ -20,7 +20,7 @@ public class VouchleyAPI {
2020
/*
2121
* Allows you to retrieve a Vouchley user via their ID.
2222
*
23-
* @implNote This method does call a remote
23+
* @apiNote This method does call a remote
2424
* API and should be run on a separate thread.
2525
*
2626
* @param id The ID of the user.
@@ -34,7 +34,7 @@ public static VouchleyUser getUserById(final UUID id) throws VouchleyException {
3434
/*
3535
* Allows you to retrieve a Vouchley user via their username.
3636
*
37-
* @implNote This method does call a remote
37+
* @apiNote This method does call a remote
3838
* API and should be run on a separate thread.
3939
*
4040
* @param id The username of the user.
@@ -48,7 +48,7 @@ public static VouchleyUser getUserByUsername(final String username) throws Vouch
4848
/*
4949
* Allows you to retrieve a Vouchley user's review via its ID.
5050
*
51-
* @implNote This method does call a remote
51+
* @apiNote This method does call a remote
5252
* API and should be run on a separate thread.
5353
*
5454
* @param id The ID of the user's review.

src/main/java/net/cameronbowe/vouchleyapi/exceptions/VouchleyException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.cameronbowe.vouchleyapi.exceptions;
22

33
/*
4-
* Made with by Cameron Bowe (https://cameronbowe.net).
4+
* Engineered with love by Cameron Bowe (https://cameronbowe.net).
55
* Copyright (©) 2023, all rights reserved.
66
*/
77

src/main/java/net/cameronbowe/vouchleyapi/user/VouchleyUser.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.cameronbowe.vouchleyapi.user;
22

33
/*
4-
* Made with by Cameron Bowe (https://cameronbowe.net).
4+
* Engineered with love by Cameron Bowe (https://cameronbowe.net).
55
* Copyright (©) 2023, all rights reserved.
66
*/
77

@@ -23,7 +23,7 @@
2323

2424
/**
2525
* Vouchley User
26-
* Handles the data & implementation of a Vouchley user.
26+
* Handles the data and implementation of a Vouchley user.
2727
*/
2828
public class VouchleyUser {
2929

@@ -67,7 +67,7 @@ private VouchleyUser(final UUID id, final String displayName, final String usern
6767
/*
6868
* Allows you to retrieve a Vouchley user via their ID.
6969
*
70-
* @implNote This method does call a remote
70+
* @apiNote This method does call a remote
7171
* API and should be run on a separate thread.
7272
*
7373
* @param id The ID of the user.
@@ -81,7 +81,7 @@ public static VouchleyUser getFromID(final UUID id) throws VouchleyException {
8181
/*
8282
* Allows you to retrieve a Vouchley user via their username.
8383
*
84-
* @implNote This method does call a remote
84+
* @apiNote This method does call a remote
8585
* API and should be run on a separate thread.
8686
*
8787
* @param username The username of the user.
@@ -95,7 +95,7 @@ public static VouchleyUser getFromUsername(final String username) throws Vouchle
9595
/*
9696
* Allows you to retrieve a Vouchley user.
9797
*
98-
* @implNote This method serves as a wrapper
98+
* @apiNote This method serves as a wrapper
9999
* to save code & time for retrieval methods.
100100
*
101101
* @param destination The destination for retrieving the user.
@@ -129,7 +129,7 @@ public UUID getId() {
129129
/**
130130
* Allows you to get the display name of the user.
131131
*
132-
* @implNote May return an empty string.
132+
* @apiNote May return an empty string.
133133
*
134134
* @return The display name of the user.
135135
*/
@@ -149,7 +149,7 @@ public String getUsername() {
149149
/**
150150
* Allows you to get the title of the user.
151151
*
152-
* @implNote May return an empty string.
152+
* @apiNote May return an empty string.
153153
*
154154
* @return The title of the user.
155155
*/
@@ -160,7 +160,7 @@ public String getTitle() {
160160
/**
161161
* Allows you to get the avatar URL of the user.
162162
*
163-
* @implNote May return the default Vouchley avatar(s).
163+
* @apiNote May return the default Vouchley avatar(s).
164164
*
165165
* @return The avatar URL of the user.
166166
*/
@@ -171,7 +171,7 @@ public String getAvatarURL() {
171171
/**
172172
* Allows you to get the Discord ID of the user.
173173
*
174-
* @implNote May return an empty string.
174+
* @apiNote May return an empty string.
175175
*
176176
* @return The Discord ID of the user.
177177
*/
@@ -182,7 +182,7 @@ public String getDiscordId() {
182182
/**
183183
* Allows you to get the reviews of the user.
184184
*
185-
* @implNote May return an empty list.
185+
* @apiNote May return an empty list.
186186
*
187187
* @return The reviews of the user.
188188
*/
@@ -211,7 +211,7 @@ public Double getTotalValueTraded() {
211211
/**
212212
* Allows you to get the donator badges of the user.
213213
*
214-
* @implNote May return an empty list.
214+
* @apiNote May return an empty list.
215215
*
216216
* @return The donator badges of the user.
217217
*/

src/main/java/net/cameronbowe/vouchleyapi/user/review/VouchleyUserReview.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.cameronbowe.vouchleyapi.user.review;
22

33
/*
4-
* Made with by Cameron Bowe (https://cameronbowe.net).
4+
* Engineered with love by Cameron Bowe (https://cameronbowe.net).
55
* Copyright (©) 2023, all rights reserved.
66
*/
77

@@ -20,7 +20,7 @@
2020

2121
/*
2222
* Vouchley User Review
23-
* Handles the data & implementation of a Vouchley user's review.
23+
* Handles the data and implementation of a Vouchley user's review.
2424
*/
2525
public class VouchleyUserReview {
2626

@@ -60,7 +60,7 @@ private VouchleyUserReview(final UUID id, final UUID receiver, final UUID sender
6060
/*
6161
* Allows you to retrieve a Vouchley user's review via its ID.
6262
*
63-
* @implNote This method does call a remote
63+
* @apiNote This method does call a remote
6464
* API and should be run on a separate thread.
6565
*
6666
* @param id The ID of the user's review.
@@ -152,7 +152,7 @@ public String getPlatform() {
152152
/**
153153
* Allows you to get the product of the user's review.
154154
*
155-
* @implNote May return null.
155+
* @apiNote May return null.
156156
*
157157
* @return The product of the user's review.
158158
*/
@@ -163,7 +163,7 @@ public String getProduct() {
163163
/**
164164
* Allows you to get the receiver's reply to the review.
165165
*
166-
* @implNote May return null.
166+
* @apiNote May return null.
167167
*
168168
* @return The receiver's reply to the review.
169169
*/

0 commit comments

Comments
 (0)