Skip to content

Commit 5152644

Browse files
authored
Initial commit
0 parents  commit 5152644

18 files changed

+876
-0
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
buy_me_a_coffee: "lv0nrncj3m"
2+
custom: ["https://lenni0451.net/donate"]

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- directory: "/"
8+
package-ecosystem: "gradle"
9+
schedule:
10+
interval: "daily"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Update Gradle Wrapper
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 1 * *"
7+
8+
jobs:
9+
update-gradle-wrapper:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Make Gradle Wrapper Executable
17+
run: chmod +x gradlew
18+
19+
- name: Update Gradle Wrapper
20+
uses: gradle-update/update-gradle-wrapper-action@v2

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.gradle/
2+
/.idea/
3+
/.vscode/
4+
/bin/
5+
build/
6+
out/
7+
/run/
8+
*.iml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Lenni0451
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.MD

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Gradle Template
2+
A template project for my gradle based repos.
3+
4+
## Maven Server Setup
5+
To use the maven servers in this template you need to enter your credentials into your `gradle.properties` files.\
6+
The file can be found in the `.gradle` folder in your home directory (create it if it doesn't exist).
7+
```properties
8+
reposiliteUsername=user
9+
reposilitePassword=123456
10+
11+
ossrhUsername=user
12+
ossrhPassword=123456
13+
```
14+
15+
## Signing Setup
16+
To sign your artifacts you need to enter your signing credentials into your `gradle.properties` files.\
17+
The file can be found in the `.gradle` folder in your home directory (create it if it doesn't exist).
18+
```properties
19+
signing.keyId=ABC12345
20+
signing.password=123456
21+
signing.secretKeyRingFile=secretkey.gpg
22+
```
23+
24+
The secretkey can be exported using the `gpg` command:
25+
```bash
26+
gpg --export-secret-key > secretkey.gpg
27+
```

build.gradle

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
plugins {
2+
id "java"
3+
id "maven-publish"
4+
id "signing"
5+
id "checkstyle"
6+
id "net.raphimc.class-token-replacer" version "1.1.3"
7+
}
8+
9+
base {
10+
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
11+
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
12+
13+
archivesName = project.maven_name ?: rootProject.maven_name
14+
group = project.maven_group ?: rootProject.maven_group
15+
version = project.maven_version ?: rootProject.maven_version
16+
}
17+
18+
configurations {
19+
include
20+
21+
implementation.extendsFrom include
22+
api.extendsFrom include
23+
}
24+
25+
repositories {
26+
mavenCentral()
27+
maven {
28+
name = "lenni0451"
29+
url = "https://maven.lenni0451.net/everything"
30+
}
31+
maven {
32+
name = "jitpack"
33+
url = "https://jitpack.io"
34+
}
35+
maven {
36+
name = "sonatype snapshots"
37+
url "https://oss.sonatype.org/content/repositories/snapshots/"
38+
}
39+
40+
//ivy { //include "waterfall:1.19:504@jar"
41+
// url "https://papermc.io/api/v2/projects"
42+
// patternLayout {
43+
// artifact "/[organisation]/versions/[module]/builds/[revision]/downloads/[organisation]-[module]-[revision].[ext]"
44+
// }
45+
// metadataSources {
46+
// artifact()
47+
// }
48+
//}
49+
}
50+
51+
dependencies {
52+
if (new File(projectDir, "libs").exists()) { //Include all jars in the libs folder
53+
include fileTree(include: ["*.jar"], dir: "libs")
54+
}
55+
56+
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
57+
compileOnly "org.jetbrains:annotations:25.0.0"
58+
compileOnly(annotationProcessor("org.projectlombok:lombok:1.18.34"))
59+
//include "net.lenni0451:Reflect:1.0.0"
60+
61+
testImplementation(platform("org.junit:junit-bom:5.11.1"))
62+
testImplementation "org.junit.jupiter:junit-jupiter"
63+
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
64+
testCompileOnly(testAnnotationProcessor("org.projectlombok:lombok:1.18.34"))
65+
}
66+
67+
sourceSets {
68+
main {
69+
classTokenReplacer {
70+
//Replace all instances of '${version}' with the project version
71+
property("\${version}", project.version)
72+
}
73+
}
74+
}
75+
76+
java {
77+
withSourcesJar()
78+
withJavadocJar()
79+
}
80+
81+
processResources {
82+
//Config file: "version: ${version}"
83+
inputs.properties(
84+
"version": project.maven_version
85+
)
86+
87+
filesMatching("config.yml") {
88+
expand(
89+
"version": project.maven_version
90+
)
91+
}
92+
}
93+
94+
artifacts {
95+
archives javadocJar, sourcesJar
96+
}
97+
98+
jar {
99+
dependsOn configurations.include
100+
from {
101+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
102+
configurations.include.collect {
103+
zipTree(it)
104+
}
105+
} {
106+
exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA"
107+
}
108+
109+
manifest {
110+
attributes(
111+
"Main-Class": "net.lenni0451.gradletemplate.Main",
112+
"Multi-Release": "true"
113+
)
114+
}
115+
}
116+
117+
test {
118+
useJUnitPlatform()
119+
testLogging {
120+
events "passed", "skipped", "failed"
121+
}
122+
maxParallelForks Runtime.runtime.availableProcessors()
123+
}
124+
125+
publishing {
126+
repositories {
127+
maven {
128+
name = "reposilite"
129+
def releasesUrl = "https://maven.lenni0451.net/releases"
130+
def snapshotsUrl = "https://maven.lenni0451.net/snapshots"
131+
url = project.maven_version.endsWith("SNAPSHOT") ? snapshotsUrl : releasesUrl
132+
133+
credentials(PasswordCredentials)
134+
authentication {
135+
basic(BasicAuthentication)
136+
}
137+
}
138+
maven {
139+
name = "ossrh"
140+
def releasesUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
141+
def snapshotsUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
142+
url = project.maven_version.endsWith("SNAPSHOT") ? snapshotsUrl : releasesUrl
143+
144+
credentials(PasswordCredentials)
145+
authentication {
146+
basic(BasicAuthentication)
147+
}
148+
}
149+
}
150+
publications {
151+
maven(MavenPublication) {
152+
artifactId = project.maven_name ?: rootProject.maven_name
153+
groupId = rootProject.maven_group
154+
version = rootProject.maven_version
155+
156+
from components.java
157+
158+
pom {
159+
name = rootProject.name
160+
description = rootProject.maven_description
161+
url = "https://github.com/" + rootProject.github_repo
162+
licenses {
163+
license {
164+
name = "MIT License"
165+
url = "https://github.com/" + rootProject.github_repo + "/blob/main/LICENSE"
166+
}
167+
}
168+
developers {
169+
developer {
170+
id = "Lenni0451"
171+
}
172+
}
173+
scm {
174+
connection = "scm:git:git://github.com/" + rootProject.github_repo + ".git"
175+
developerConnection = "scm:git:ssh://github.com/" + rootProject.github_repo + ".git"
176+
url = "github.com/" + rootProject.github_repo
177+
}
178+
}
179+
}
180+
}
181+
}
182+
183+
checkstyle {
184+
toolVersion = "10.16.0" //Latest version for Java 8: 9.3
185+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
186+
}
187+
188+
signing {
189+
setRequired false
190+
sign configurations.archives
191+
sign publishing.publications.maven
192+
}
193+
194+
project.tasks.withType(PublishToMavenRepository).forEach {
195+
it.dependsOn(project.tasks.withType(Sign))
196+
}
197+
build.dependsOn(test)
198+
build.dependsOn(check)

0 commit comments

Comments
 (0)