11import  me.modmuss50.mpp.PublishModTask 
2+ import  me.modmuss50.mpp.platforms.curseforge.Curseforge 
23import  org.gradle.api.tasks.testing.logging.TestExceptionFormat 
34import  org.gradle.api.tasks.testing.logging.TestLogEvent 
45import  org.slf4j.event.Level 
@@ -149,6 +150,47 @@ val sourcesJarTask = tasks.named<Jar>("sourcesJar") {
149150	archiveClassifier.set(" sources" 
150151}
151152
153+ 
154+ abstract  class  ReadChangelog  : DefaultTask () {
155+ 	@get:InputFile
156+ 	abstract  val  inputFile:  RegularFileProperty 
157+ 
158+ 	@get:OutputFile
159+ 	abstract  val  outputFile:  RegularFileProperty 
160+ 
161+ 	@TaskAction
162+ 	fun  read () {
163+ 		val  text =  inputFile.get().asFile.readText()
164+ 		outputFile.get().asFile.writeText(text)
165+ 	}
166+ }
167+ 
168+ val  changelogHtmlFile:  Provider <RegularFile > = 
169+ 	project(" :Changelog" " changelog.html" 
170+ 
171+ val  changelogHtmlTask =  tasks.register<ReadChangelog >(" readChangelogHtml" 
172+ 	dependsOn(" :Changelog:makeChangelog" 
173+ 	inputFile.set(changelogHtmlFile)
174+ 	outputFile.set(layout.buildDirectory.file(" intermediates/changelog.html" 
175+ }
176+ 
177+ val  changelogHtmlContent:  Provider <String > =  changelogHtmlTask.flatMap {
178+ 	it.outputFile.map { f ->  f.asFile.readText() }
179+ }
180+ 
181+ val  changelogMdFile:  Provider <RegularFile > = 
182+ 	project(" :Changelog" " changelog.md" 
183+ 
184+ val  changelogMdTask =  tasks.register<ReadChangelog >(" readChangelogMd" 
185+ 	dependsOn(" :Changelog:makeMarkdownChangelog" 
186+ 	inputFile.set(changelogMdFile)
187+ 	outputFile.set(layout.buildDirectory.file(" intermediates/changelog.md" 
188+ }
189+ 
190+ val  changelogMdContent:  Provider <String > =  changelogMdTask.flatMap {
191+ 	it.outputFile.map { f ->  f.asFile.readText() }
192+ }
193+ 
152194publishMods {
153195	file.set(tasks.jar.get().archiveFile)
154196	type =  BETA 
@@ -159,7 +201,7 @@ publishMods {
159201	curseforge {
160202		projectId =  curseProjectId
161203		accessToken.set(curseforgeApikey ? :  " 0" 
162- 		changelog.set(provider { file( " ../Changelog/changelog.html " ).readText() } )
204+ 		changelog.set(changelogHtmlContent )
163205		changelogType =  " html" 
164206		minecraftVersionRange {
165207			start =  minecraftVersionRangeStart
@@ -171,15 +213,18 @@ publishMods {
171213	modrinth {
172214		projectId =  modrinthId
173215		accessToken =  modrinthToken
174- 		changelog.set(provider { file( " ../Changelog/changelog.md " ).readText() } )
216+ 		changelog.set(changelogMdContent )
175217		minecraftVersionRange {
176218			start =  minecraftVersionRangeStart
177219			end =  minecraftVersion
178220		}
179221	}
222+ 
223+ 	dryRun =  true 
180224}
225+ 
181226tasks.withType<PublishModTask > {
182- 	dependsOn(tasks.jar, " :Changelog:makeChangelog " ,  " :Changelog:makeMarkdownChangelog " 
227+ 	dependsOn(tasks.jar, changelogHtmlTask, changelogMdTask )
183228}
184229
185230tasks.named<Test >(" test" 
0 commit comments