Skip to content

Commit cdcade9

Browse files
author
Francisco Solis
committed
Fixes and Added GitHub Packages
1 parent c3fee95 commit cdcade9

File tree

1 file changed

+44
-83
lines changed

1 file changed

+44
-83
lines changed

build.gradle

Lines changed: 44 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,27 @@ dependencies {
3535
implementation 'com.google.code.gson:gson:2.8.9'
3636
implementation 'me.carleslc.Simple-YAML:Simple-Yaml:1.7.2'
3737
implementation 'com.zaxxer:HikariCP:3.3.1'
38-
compileOnly 'org.xerial:sqlite-jdbc:3.25.2'
39-
implementation 'org.apache.logging.log4j:log4j-api:2.13.2'
40-
compileOnly 'org.apache.logging.log4j:log4j-core:2.13.2'
38+
compileOnly 'org.xerial:sqlite-jdbc:3.36.0.2'
39+
implementation 'org.apache.logging.log4j:log4j-api:2.14.1'
40+
compileOnly 'org.apache.logging.log4j:log4j-core:2.14.1'
4141
implementation 'net.lingala.zip4j:zip4j:2.9.0'
4242
compileOnly 'me.clip:placeholderapi:2.10.9'
4343
implementation 'org.jetbrains:annotations:23.0.0'
4444

45-
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
45+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
4646
}
4747

4848
test {
4949
useJUnitPlatform()
5050
}
5151

52-
sourceCompatibility = 1.8
53-
targetCompatibility = 1.8
54-
java.withJavadocJar()
55-
java.withSourcesJar()
52+
java {
53+
sourceCompatibility = JavaVersion.VERSION_1_8
54+
targetCompatibility = JavaVersion.VERSION_1_8
55+
56+
withJavadocJar()
57+
withSourcesJar()
58+
}
5659

5760
tasks.withType(JavaCompile) {
5861
options.encoding = 'UTF-8'
@@ -66,16 +69,19 @@ tasks.withType(Javadoc) {
6669
}
6770

6871
tasks.withType(Copy) {
69-
duplicatesStrategy = 'include'
72+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
7073
exclude 'META-INF/**'
7174
}
7275

7376
tasks.withType(Jar) {
74-
duplicatesStrategy = 'include'
77+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
7578
exclude 'META-INF/**'
7679
}
7780

78-
shadowJar {
81+
shadowJar {
82+
archiveBaseName.set('SuperCoreAPI')
83+
archiveClassifier.set('')
84+
7985
relocate 'com.google', 'xyz.theprogramsrc.supercoreapi.libs.google'
8086
relocate 'org.apache.commons', 'xyz.theprogramsrc.supercoreapi.libs.apache.commons'
8187
relocate 'com.cryptomorin.xseries', 'xyz.theprogramsrc.supercoreapi.libs.xseries'
@@ -89,15 +95,9 @@ shadowJar {
8995
relocate 'javax.annotation', 'xyz.theprogramsrc.supercoreapi.libs.annotation'
9096
relocate 'com.zaxxer.hikari', 'xyz.theprogramsrc.supercoreapi.libs.hikari'
9197

92-
archiveBaseName.set('SuperCoreAPI')
93-
archiveClassifier.set('')
94-
archiveVersion.set('')
9598
minimize()
9699
}
97100

98-
shadowJar.finalizedBy javadocJar
99-
shadowJar.finalizedBy sourcesJar
100-
101101
configurations {
102102
testImplementation {
103103
extendsFrom(compileOnly)
@@ -107,81 +107,41 @@ configurations {
107107
sourceSets.main.java.srcDir 'src/main/java'
108108
sourceSets.test.java.srcDir 'src/test/java'
109109

110-
def repos = repositories
111-
112110
publishing {
111+
repositories {
112+
maven {
113+
name = 'TheProgramSrcRepository'
114+
credentials.username = System.getenv('NEXUS_USERNAME')
115+
credentials.password = System.getenv('NEXUS_PASSWORD')
116+
url = uri(version.contains('-SNAPSHOT') ? 'https://repo.theprogramsrc.xyz/repository/maven-snapshots/' : 'https://repo.theprogramsrc.xyz/repository/maven-releases/')
117+
}
118+
maven {
119+
name = 'GitHubPackages'
120+
url = 'https://maven.pkg.github.com/TheProgramSrc/SuperCoreAPI'
121+
credentials {
122+
username = System.getenv('GITHUB_ACTOR')
123+
password = System.getenv('GITHUB_TOKEN')
124+
}
125+
}
126+
}
113127
publications {
114128
mavenJava(MavenPublication) {
115-
artifactId 'SuperCoreAPI'
129+
artifactId 'supercoreapi'
116130

117-
artifact(tasks["shadowJar"])
131+
from components.java
118132

119133
pom.withXml {
120-
def root = asNode()
121-
122-
root.appendNode('description', description)
123-
root.appendNode('packaging', 'jar')
124-
root.appendNode('url', 'https://github.com/TheProgramsrc/SuperCoreAPI')
125-
126-
final repositoriesNode = root.appendNode('repositories')
127-
repos.each {
128-
if(it.name == 'MavenLocal'){
129-
return
130-
}
131-
def repositoryNode = repositoriesNode.appendNode('repository')
132-
repositoryNode.appendNode('id', it.name)
133-
repositoryNode.appendNode('url', it.url)
134-
}
135-
136-
final dependenciesNode = root.appendNode('dependencies')
137-
ext.addDependency = { dep, String scope ->
138-
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
139-
return // ignore invalid dependencies
140-
141-
final dependencyNode = dependenciesNode.appendNode('dependency')
142-
dependencyNode.appendNode('groupId', dep.group)
143-
dependencyNode.appendNode('artifactId', dep.name)
144-
dependencyNode.appendNode('version', dep.version)
145-
dependencyNode.appendNode('scope', scope)
146-
147-
if (!dep.transitive) {
148-
// If this dependency is not transitive, we should force exclude all its dependencies from the POM
149-
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
150-
exclusionNode.appendNode('groupId', '*')
151-
exclusionNode.appendNode('artifactId', '*')
152-
} else if (!dep.properties.excludeRules.empty) {
153-
// Otherwise add specified exclude rules
154-
final exclusionsNode = dependencyNode.appendNode('exclusions')
155-
dep.properties.excludeRules.each { rule ->
156-
final exclusionNode = exclusionsNode.appendNode('exclusion')
157-
exclusionNode.appendNode('groupId', rule.group ?: '*')
158-
exclusionNode.appendNode('artifactId', rule.module ?: '*')
159-
}
160-
}
161-
}
162-
163-
configurations.compileOnly.getDependencies().each { dep -> addDependency(dep, "provided") }
164-
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "compile") }
165-
configurations.testImplementation.getDependencies().each { dep -> addDependency(dep, "test") }
134+
asNode().appendNode('packaging', 'jar')
135+
asNode().remove(asNode().get('dependencies'))
136+
137+
def dependenciesNode = asNode().appendNode('dependencies')
138+
def jetbrainsAnnotations = dependenciesNode.appendNode('dependency')
139+
jetbrainsAnnotations.appendNode('groupId', 'org.jetbrains')
140+
jetbrainsAnnotations.appendNode('artifactId', 'annotations')
141+
jetbrainsAnnotations.appendNode('version', '19.0.0')
166142
}
167143
}
168144
}
169-
repositories {
170-
maven {
171-
name = 'TheProgramSrcRepository'
172-
credentials.username = System.getenv('NEXUS_USERNAME')
173-
credentials.password = System.getenv('NEXUS_PASSWORD')
174-
url = uri(version.contains('-SNAPSHOT') ? 'https://repo.theprogramsrc.xyz/repository/maven-snapshots/' : 'https://repo.theprogramsrc.xyz/repository/maven-releases/')
175-
}
176-
// maven {
177-
// name = 'GitHubPackages'
178-
// url = 'https://maven.pkg.github.com/TheProgramSrc/SuperCoreAPI'
179-
// credentials {
180-
// username = System.getenv('GITHUB_ACTOR')
181-
// password = System.getenv('GITHUB_TOKEN')
182-
// }
183-
// }
184-
}
185145
}
186146

187147
javadoc {
@@ -191,3 +151,4 @@ javadoc {
191151
}
192152

193153
publish.dependsOn clean, test, jar
154+

0 commit comments

Comments
 (0)