@@ -13,6 +13,7 @@ buildscript {
1313
1414plugins {
1515 id ' org.jetbrains.kotlin.jvm' version " $kotlinVersion "
16+ id ' maven-publish'
1617}
1718
1819apply plugin : ' net.minecraftforge.gradle'
@@ -61,8 +62,9 @@ minecraft {
6162
6263configurations {
6364 jarLibs
65+ onlyJarLibs
6466 // Force choosing the correct nightly build because Mac OS chooses an invalid one
65- all {
67+ configureEach {
6668 resolutionStrategy {
6769 force ' org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
6870 }
@@ -112,7 +114,7 @@ dependencies {
112114 implementation(' cabaletta:baritone-deobf-unoptimized-mcp-dev:1.2' ). setChanging(true )
113115
114116 // This Baritone WILL be included in the jar
115- jarLibs (' cabaletta:baritone-api:1.2' ). setChanging(true )
117+ onlyJarLibs (' cabaletta:baritone-api:1.2' ). setChanging(true )
116118
117119 // Add everything in jarLibs to implementation (compile)
118120 implementation configurations. jarLibs
@@ -137,23 +139,23 @@ processResources {
137139 }
138140}
139141
140- task buildApiSource ( type : Jar ) { // Generate sources
142+ tasks . register( ' buildApiSource ' , Jar ) { // Generate sources
141143 group ' build'
142144 description ' Assemble API library source archive'
143145
144146 archiveClassifier. set ' api-source'
145147 from sourceSets. main. allSource
146148}
147149
148- task buildApi ( type : Jar ) {
150+ tasks . register( ' buildApi ' , Jar ) {
149151 group ' build'
150152 description ' Assemble API library archive'
151153
152154 archiveClassifier. set ' api'
153155 from sourceSets. main. output
154156}
155157
156- task buildAll {
158+ tasks . register( ' buildAll' ) {
157159 group ' build'
158160 description ' Assemble all jars'
159161
@@ -184,7 +186,7 @@ shadowJar {
184186 ' kotlin/**/*.kotlin_metadata' ,
185187 ' kotlin/**/*.kotlin_builtins' ,
186188 ' META-INF/*.version'
187- configurations = [project. configurations. jarLibs]
189+ configurations = [project. configurations. jarLibs, project . configurations . onlyJarLibs ]
188190 relocate ' kotlin' , ' com.lambda.shadow.kotlin'
189191 relocate ' kotlinx' , ' com.lambda.shadow.kotlinx'
190192 finalizedBy ' configureReobfTaskForReobfShadowJar' , ' reobfShadowJar'
@@ -198,7 +200,11 @@ reobf {
198200 }
199201}
200202
201- artifacts {
202- shadowJar
203- }
204-
203+ publishing {
204+ publications {
205+ api(MavenPublication ) {
206+ artifact source : buildApi, classifier : null
207+ artifact source : buildApiSource, classifier : ' sources'
208+ }
209+ }
210+ }
0 commit comments