fix that race condition

This commit is contained in:
C10udburst 2022-08-19 15:07:54 +02:00
parent 3810f1a580
commit de10dccb38

View file

@ -10,6 +10,7 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.util.LinkedList
import java.lang.Thread
abstract class MakePluginsJsonTask : DefaultTask() {
@get:OutputFile
@ -20,7 +21,19 @@ abstract class MakePluginsJsonTask : DefaultTask() {
val lst = LinkedList<PluginEntry>()
for (subproject in project.allprojects) {
subproject.extensions.findCloudstream() ?: continue
val cloudstream = subproject.extensions.findCloudstream() ?: continue
/*
bruh why does gradle ignore task order
forcing me to do jank like this
*/
var timeout = 10000 // 10 s timeout
while (cloudstream.fileSize == null) {
Thread.sleep(100)
timeout -= 100
if (timeout <= 0)
throw RuntimeException("Timeout while fetching fileSize for ${subproject.name}")
}
lst.add(subproject.makePluginEntry())
}