blob: 475f1958e79c9820e5790c82b600f350417a9b6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import org.gradle.api.provider.Property
import java.io.InputStream
import java.net.URI
import java.util.zip.ZipInputStream
abstract class DownloadZipFile : DownloadArchiveFile<ZipInputStream>() {
abstract class GitLabSource {
abstract val domain: Property<String>
abstract val owner: Property<String>
abstract val project: Property<String>
abstract val hash: Property<String>
fun toUrl(): URI {
return URI.create("https://${domain.get()}/${owner.get()}/${project.get()}/-/archive/${hash.get()}/${project.get()}-${hash.get()}.zip")
}
}
fun gitlab(configure: GitLabSource.() -> Unit) {
stripRoot.convention(true)
url.set(
project.provider(
project.objects.newInstance(GitLabSource::class.java).also(configure)::toUrl
)
)
}
override fun mapInputStream(inputStream: InputStream): ZipInputStream {
return ZipInputStream(inputStream)
}
override fun nextEntry(stream: ZipInputStream): String? {
return stream.nextEntry?.name
}
}
|