1- import cam72cam.universalmodcore.Util ;
2-
31buildscript {
42 repositories {
5- // maven { url = "https://maven.minecraftforge.net/" }
6- maven {
7- name " neoforgedReleases"
8- url " https://maven.neoforged.net/releases"
9- }
10- maven { url = " https://teamopenindustry.cc/maven" }
3+ maven { url " https://maven.neoforged.net/releases" }
4+ maven { url " https://plugins.gradle.org/" }
115 mavenCentral()
126 gradlePluginPortal()
137 }
148 dependencies {
15- // classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
169 classpath group : ' net.neoforged.gradle' , name : ' userdev' , version : ' 7.1.11'
17- classpath ' cam72cam.universalmodcore:UniversalModCoreGradle:0.1.3'
1810 }
1911}
12+
2013apply plugin : ' net.neoforged.gradle.userdev'
21- // Only edit below this line, the above code adds and enables the necessary things for NeoForge to be setup.
2214apply plugin : ' eclipse'
23- // apply plugin: 'maven'
2415apply plugin : ' maven-publish'
2516
26- java. toolchain. languageVersion = JavaLanguageVersion . of(21 ) // Since 1.20.5
17+ java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
2718
28- String baseVersion = " 1.2 "
19+ String baseVersion = " 1.3 "
2920if (! " release" . equalsIgnoreCase(System . getProperty(" target" ))) {
30- baseVersion + = " -" + Util.GitRevision ()
21+ try {
22+ baseVersion + = " -" + ' git rev-parse --verify --short=7 HEAD' . execute(). text. trim()
23+ } catch (Exception ex) {
24+ baseVersion + = " -unknown"
25+ }
3126}
3227version = " 1.21.8-neoforge-" + baseVersion
3328group = " trackapi" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
3429archivesBaseName = " TrackAPI"
3530
31+ configurations {
32+ minecraftLibrary
33+ implementation. extendsFrom minecraftLibrary
34+ }
35+
36+ java {
37+ withSourcesJar()
38+ }
39+
3640runs {
3741 // applies to all the run configs below
3842 configureEach {
@@ -48,6 +52,10 @@ runs {
4852 // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
4953 systemProperty ' forge.logging.console.level' , ' debug'
5054
55+ dependencies {
56+ runtime project. configurations. minecraftLibrary
57+ }
58+
5159 modSource project. sourceSets. main
5260 }
5361
@@ -77,44 +85,24 @@ runs {
7785 }
7886}
7987
80-
8188sourceSets. main. resources { srcDir ' src/generated/resources' }
8289
8390dependencies {
84-
8591 implementation ' net.neoforged:neoforge:21.8.52'
86-
87- // You may put jars on which you depend on in ./libs or you may define them like so..
88- // compile "some.group:artifact:version:classifier"
89- // compile "some.group:artifact:version"
90-
91- // Real examples
92- // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
93- // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
94-
95- // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
96- // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
97-
98- // These dependencies get remapped to your current MCP mappings
99- // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
100-
101- // For more info...
102- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
103- // http://www.gradle.org/docs/current/userguide/dependency_management.html
104-
92+ minecraftLibrary " org.apache.maven.wagon:wagon-ssh:3.5.3"
10593}
10694
10795// Example for how to get properties into the manifest for reading by the runtime..
10896jar {
10997 manifest {
11098 attributes([
111- " Specification-Title" : " trackapi" ,
112- " Specification-Vendor" : " trackapi" ,
113- " Specification-Version" : " 1" , // We are version 1 of ourselves
114- " Implementation-Title" : project. name,
115- " Implementation-Version" : " ${ version} " ,
116- " Implementation-Vendor" : " trackapi" ,
117- " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
99+ " Specification-Title" : " trackapi" ,
100+ " Specification-Vendor" : " trackapi" ,
101+ " Specification-Version" : " 1" , // We are version 1 of ourselves
102+ " Implementation-Title" : project. name,
103+ " Implementation-Version" : " ${ version} " ,
104+ " Implementation-Vendor" : " trackapi" ,
105+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
118106 ])
119107 }
120108}
@@ -123,6 +111,8 @@ publishing {
123111 publications {
124112 mavenJava(MavenPublication ) {
125113 artifact jar
114+ artifact sourcesJar
115+ artifactId archivesBaseName
126116 }
127117 }
128118 repositories {
@@ -136,47 +126,12 @@ publishing {
136126 }
137127}
138128
139-
140- /*
141- // Example configuration to allow publishing using the maven-publish task
142- // we define a custom artifact that is sourced from the reobfJar output task
143- // and then declare that to be published
144- // Note you'll need to add a repository here
145- def reobfFile = file("$buildDir/reobfJar/output.jar")
146- def reobfArtifact = artifacts.add('default', reobfFile) {
147- type 'jar'
148- builtBy 'reobfJar'
149- }
150- publishing {
151- publications {
152- mavenJava(MavenPublication) {
153- artifact reobfArtifact
154- }
155- }
156- repositories {
157- maven {
158- url "file:///${project.projectDir}/mcmodsrepo"
159- }
129+ task (' showBuildInfo' ) {
130+ doLast {
131+ System . out. println (" Build Uploaded to Maven at: " )
132+ System . out. println (" https://teamopenindustry.cc/maven/trackapi/TrackAPI/${ version} /TrackAPI-${ version} .jar" )
160133 }
161134}
162135
163- task deployJar(type: Jar)
136+ publish . finalizedBy showBuildInfo
164137
165- configurations {
166- deployerJars
167- }
168-
169- dependencies {
170- deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
171- }
172-
173- uploadArchives {
174- tasks.uploadArchives.dependsOn build
175- repositories.mavenDeployer {
176- configuration = configurations.deployerJars
177- repository(url: "scp://teamopenindustry.cc/var/www/html/maven/") {
178- authentication(userName: "mavenci", privateKey: "publish_key")
179- }
180- }
181- }
182- */
0 commit comments