@@ -28,6 +28,7 @@ dependencies {
2828 These is also an accompanying test at (test src) com.dumbdogdiner.stickyapi.StickyAPITest
2929 */
3030
31+
3132// Set the timestamp format
3233def dataBuildTimestamp = " yyyy-MM-dd'T'HH:mm:ss.SSSZ"
3334
@@ -58,25 +59,48 @@ task processSourceTokens(type: Sync) {
5859// Use the filter task as the input for compileJava
5960compileJava. source = processSourceTokens. outputs
6061
61-
62- /*
63- Font Width Info
64- ----------
65- This task serves to copy width data from the default Minecraft font into the final jar.
66- This data is generated by <https://github.com/DumbDogDiner/mc-font-extractor>.
62+ /**
63+ * Task to clean generated resources
6764 */
6865
69- // Font Width Info
70- task copyMCFontExtractor ( type : Copy ) {
71- def path = project . configurations . compile . find {it . name . startsWith( " mc-font-extractor " ) }
72- println ( " common: Found font data at: " + path)
73- from file(path)
74- // into file("src/main/resources" )
75- // - Please keep this comment for future reference.
76- // - This is how we would do this if we weren't also adding build info (see processSourceTokens, above comments)
77- destinationDir file( " src/main/resources/generated/ " )
78- rename " mc-font-extractor-main-mojangles_width_data.json " , " mojangles_width_data.json "
66+ task cleanGeneratedResources ( type : Delete ) {
67+ delete( " src/main/resources/generated/ " )
68+ }
69+
70+ clean {
71+ dependsOn(cleanGeneratedResources )
72+ }
73+ configure(cleanGeneratedResources){
74+ group = " Build "
75+ description = " Clean generated/downloaded resource files "
7976}
8077
8178// Run the license formatter and font data copier before compiling the source code.
82- tasks. compileJava. dependsOn licenseFormatMain, licenseFormatTest, copyMCFontExtractor
79+ tasks. compileJava. dependsOn licenseFormatMain, licenseFormatTest, processResources
80+
81+ task downloadTextures (type : Download ){
82+ sourceUrl = " https://dumbdogdiner.github.io/mc-heads-resource/textures.json"
83+ target = file(" src/main/resources/generated/textures.json" )
84+ }
85+
86+ task downloadFontWidths (type : Download ){
87+ sourceUrl = " https://dumbdogdiner.github.io/mc-font-extractor/main/mojangles_width_data.json"
88+ target = file(" src/main/resources/generated/mojangles_width_data.json" )
89+ }
90+
91+ processResources {
92+ dependsOn(downloadTextures, downloadFontWidths)
93+ }
94+
95+ class Download extends DefaultTask {
96+ @Input
97+ String sourceUrl
98+
99+ @OutputFile
100+ File target
101+
102+ @TaskAction
103+ void download () {
104+ ant. get(src : sourceUrl, dest : target, verbose : true )
105+ }
106+ }
0 commit comments