diff --git a/.gitignore b/.gitignore index 34977ee7..bf17dd79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules -.idea \ No newline at end of file +.idea +.gradle +build/ \ No newline at end of file diff --git a/fetcher/build.gradle.kts b/fetcher/build.gradle.kts new file mode 100644 index 00000000..a786a9eb --- /dev/null +++ b/fetcher/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + val kotlinVersion = "1.5.10" + + kotlin("jvm") version kotlinVersion + kotlin("plugin.serialization") version kotlinVersion +} + +dependencies { + implementation(libs.bundles.ktor.client) + implementation(libs.konsume.xml) + implementation(libs.kotlinx.serialization) + + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.ktor.client.mock) +} diff --git a/fetcher/src/main/kotlin/Fetcher.kt b/fetcher/src/main/kotlin/Fetcher.kt new file mode 100644 index 00000000..1ffc4bcc --- /dev/null +++ b/fetcher/src/main/kotlin/Fetcher.kt @@ -0,0 +1,245 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +import com.gitlab.mvysny.konsumexml.konsumeXml +import io.ktor.client.HttpClient +import io.ktor.client.request.get +import io.ktor.client.request.parameter +import io.ktor.client.request.url +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.coroutineScope +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonPrimitive + +class Fetcher( + private val json: Json, + private val httpClient: HttpClient, + private val searchPageSize: Int = 1000 +) { + + suspend fun fetch(): List { + val libs: List = coroutineScope { + searchAllPages() + .getOrThrow() + .map { async { docToLibraryInfo(it) } } + .awaitAll() + .mapNotNull { it } + } + return libs.map { it.path }.toSortedSet().map { path -> + libs.first { it.path == path } + } + } + + private suspend fun searchAllPages(): Result> { + var pageNumber = 0 + val results = mutableListOf() + while (true) { + val page: SearchResult = searchPage(page = pageNumber, limit = searchPageSize).getOrElse { + return Result.failure(it) + } + + val items: List = page.response.docs + results.addAll(items) + if (items.size < searchPageSize) break + else pageNumber++ + } + + return Result.success(results) + } + + private suspend fun searchPage(page: Int, limit: Int): Result { + return runCatching { + httpClient.get { + url("https://search.maven.org/solrsearch/select") + parameter("q", "l:metadata") + parameter("start", page * limit) + parameter("rows", limit) + } + }.map { json.decodeFromString(SearchResult.serializer(), it) } + } + + private suspend fun docToLibraryInfo(doc: SearchResult.Doc): LibraryInfo? { + val metadata: GradleMetadata = getGradleMetadata( + group = doc.group, + artifact = doc.artifact, + version = doc.version + ).getOrElse { + println("can't load gradle metadata for ${doc.id} because $it") + return null + } + val commonVariant: GradleMetadata.Variant? = metadata.variants.firstOrNull { variant -> + variant.attributes[GradleMetadata.Attributes.KOTLIN_PLATFORM_TYPE.key]?.contentOrNull == "common" + } + if (commonVariant == null) { + println("can't find common variant for ${doc.id}") + return null + } + val commonLocation: GradleMetadata.Location? = commonVariant.availableAt + if (commonLocation == null) { + println("can't find common location for $commonVariant") + return null + } + + val commonMavenMetadata: MavenMetadata = getMavenMetadata( + group = commonLocation.group, + artifact = commonLocation.module + ).getOrElse { + println("can't load common maven-metadata for $commonLocation because $it") + return null + } + + val latestVersion: String = commonMavenMetadata.versioning.latest + val lastUpdated: Long = commonMavenMetadata.versioning.lastUpdated + + val group = commonLocation.group + val artifact = commonLocation.module + + return LibraryInfo( + groupId = group, + artifactId = artifact, + path = "$group:$artifact", + latestVersion = latestVersion, + lastUpdated = lastUpdated.toString(), + versions = coroutineScope { + commonMavenMetadata.versioning + .versions + // TODO remove take last 2 versions + .takeLast(2) + .map { async { getVersionInfo(location = commonLocation, version = it) } } + .awaitAll() + .mapNotNull { result -> + result.getOrElse { + println("can't load version info for $commonLocation because $it") + null + } + } + } + ) + } + + private suspend fun getVersionInfo( + location: GradleMetadata.Location, + version: String + ): Result { + return getGradleMetadata( + group = location.group, + artifact = location.module, + version = version + ).map { commonMetadata -> + LibraryInfo.Version( + version = version, + mpp = true, + gradle = commonMetadata.createdBy["gradle"]?.version, + kotlin = getKotlinVersion(commonMetadata), + targets = commonMetadata.variants.mapNotNull { variant -> + val targetInfo: LibraryInfo.Target? = getLibraryInfoTarget(variant) + if (targetInfo == null) { + println("can't read target info for variant $variant") + null + } else { + targetInfo.let { variant.name to it } + } + }.toMap() + ) + } + } + + private fun getKotlinVersion(gradleMetadata: GradleMetadata): String? { + val stdLib: GradleMetadata.Dependency? = gradleMetadata.variants + .mapNotNull { it.dependencies } + .flatten() + .firstOrNull { dependency -> + dependency.group == "org.jetbrains.kotlin" && dependency.module.startsWith("kotlin-stdlib") + } + + if (stdLib == null) { + println("can't read kotlin version without stdlib in $gradleMetadata") + return null + } + + if (stdLib.version == null) { + println("can't read kotlin version without version of stdlib in $stdLib") + return null + } + + val resolved: String? = stdLib.version.resolved + + if (resolved == null) { + println("can't read kotlin version without versioning of stdlib in $stdLib") + return null + } + + return resolved + } + + private fun getLibraryInfoTarget(variant: GradleMetadata.Variant): LibraryInfo.Target? { + return LibraryInfo.Target( + platform = variant.attributes[GradleMetadata.Attributes.KOTLIN_PLATFORM_TYPE.key]?.contentOrNull + ?: return null, + target = variant.attributes[GradleMetadata.Attributes.KOTLIN_NATIVE_TARGET.key]?.contentOrNull + ) + } + + private suspend fun getMavenMetadata(group: String, artifact: String): Result { + val groupPath = group.replace('.', '/') + val mavenBase = "https://repo1.maven.org/maven2/$groupPath/$artifact" + val metadataUrl = "$mavenBase/maven-metadata.xml" + + return runCatching { + httpClient.get { + url(metadataUrl) + } + }.map { content -> + with(content.konsumeXml()) { + child("metadata") { + val groupId: String = childText("groupId") + val artifactId: String = childText("artifactId") + + val versioning: MavenMetadata.Versioning = child("versioning") { + val latest: String = childText("latest") + val release: String = childText("release") + val versions: List = child("versions") { + childrenText("version") + } + val lastUpdated: String = childText("lastUpdated") + MavenMetadata.Versioning( + latest = latest, + release = release, + lastUpdated = lastUpdated.toLong(), + versions = versions + ) + } + + MavenMetadata( + groupId = groupId, + artifactId = artifactId, + versioning = versioning + ) + } + } + } + } + + private suspend fun getGradleMetadata( + group: String, + artifact: String, + version: String + ): Result { + val groupPath = group.replace('.', '/') + val mavenBase = "https://repo1.maven.org/maven2/$groupPath/$artifact/$version" + val gradleMetadataUrl = "$mavenBase/$artifact-$version.module" + + return runCatching { + httpClient.get { + url(gradleMetadataUrl) + } + }.map { json.decodeFromString(GradleMetadata.serializer(), it) } + } + + private val JsonElement?.contentOrNull: String? get() = (this as? JsonPrimitive)?.content +} diff --git a/fetcher/src/main/kotlin/GradleMetadata.kt b/fetcher/src/main/kotlin/GradleMetadata.kt new file mode 100644 index 00000000..e7067232 --- /dev/null +++ b/fetcher/src/main/kotlin/GradleMetadata.kt @@ -0,0 +1,78 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonElement + +@Serializable +data class GradleMetadata( + val component: Component, + val createdBy: Map, + val variants: List +) { + @Serializable + data class Component( + val group: String, + val module: String, + val version: String, + val attributes: Map + ) + + @Serializable + data class Creator( + val version: String, + val buildId: String? = null + ) + + @Serializable + data class Variant( + val name: String, + val attributes: Map, + val dependencies: List? = null, + val files: List? = null, + @SerialName("available-at") + val availableAt: Location? = null + ) + + @Serializable + data class Dependency( + val group: String, + val module: String, + val version: Version? = null + ) { + @Serializable + data class Version( + val requires: String? = null, + val strictly: String? = null, + val prefers: String? = null + ) { + val resolved: String? = strictly ?: requires ?: prefers + } + } + + @Serializable + data class File( + val name: String, + val url: String + ) + + @Serializable + data class Location( + val url: String, + val group: String, + val module: String, + val version: String + ) + + enum class Attributes(val key: String) { + USAGE("org.gradle.usage"), + STATUS("org.gradle.status"), + KOTLIN_PLATFORM_TYPE("org.jetbrains.kotlin.platform.type"), + KOTLIN_NATIVE_TARGET("org.jetbrains.kotlin.native.target"), + ARTIFACT_TYPE("artifactType") + } +} diff --git a/fetcher/src/main/kotlin/LibraryInfo.kt b/fetcher/src/main/kotlin/LibraryInfo.kt new file mode 100644 index 00000000..e810f0e5 --- /dev/null +++ b/fetcher/src/main/kotlin/LibraryInfo.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class LibraryInfo( + val groupId: String, + val artifactId: String, + val path: String, + val latestVersion: String, + val lastUpdated: String, + val versions: List, + val github: GitHub? = null, + val category: String? = null +) { + @Serializable + data class Version( + val version: String, + val mpp: Boolean, + val gradle: String?, + val kotlin: String?, + val targets: Map + ) + + @Serializable + data class Target( + val platform: String, + val target: String? = null + ) + + @Serializable + data class GitHub( + val name: String, + @SerialName("full_name") + val fullName: String, + @SerialName("html_url") + val htmlUrl: String, + val description: String, + @SerialName("stars_count") + val starsCount: Int, + val topics: List + ) +} diff --git a/fetcher/src/main/kotlin/MavenMetadata.kt b/fetcher/src/main/kotlin/MavenMetadata.kt new file mode 100644 index 00000000..aa817498 --- /dev/null +++ b/fetcher/src/main/kotlin/MavenMetadata.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +data class MavenMetadata( + val groupId: String, + val artifactId: String, + val versioning: Versioning +) { + data class Versioning( + val latest: String, + val release: String, + val lastUpdated: Long, + val versions: List + ) +} diff --git a/fetcher/src/main/kotlin/SearchResult.kt b/fetcher/src/main/kotlin/SearchResult.kt new file mode 100644 index 00000000..c2ce37e3 --- /dev/null +++ b/fetcher/src/main/kotlin/SearchResult.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class SearchResult( + val response: Response +) { + @Serializable + data class Response( + val numFound: Int, + val start: Int, + val docs: List + ) + + @Serializable + data class Doc( + val id: String, + @SerialName("g") + val group: String, + @SerialName("a") + val artifact: String, + @SerialName("v") + val version: String, + @SerialName("p") + val packaging: String, + val timestamp: Long, + @SerialName("ec") + val classificators: List, + val tags: List? = null + ) +} diff --git a/fetcher/src/main/kotlin/main.kt b/fetcher/src/main/kotlin/main.kt new file mode 100644 index 00000000..53c85b18 --- /dev/null +++ b/fetcher/src/main/kotlin/main.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +package dev.icerock.kotlin.libraries.fetcher + +import io.ktor.client.HttpClient +import io.ktor.client.engine.cio.CIO +import io.ktor.client.features.HttpTimeout +import io.ktor.client.features.logging.LogLevel +import io.ktor.client.features.logging.Logger +import io.ktor.client.features.logging.Logging +import kotlinx.coroutines.runBlocking +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.json.Json +import java.io.File + +fun main() { + val json = Json { + ignoreUnknownKeys = true + } + val fetcher = Fetcher( + json = json, + httpClient = HttpClient(CIO) { + install(HttpTimeout) { + requestTimeoutMillis = 60_000 + connectTimeoutMillis = 60_000 + } + install(Logging) { + level = LogLevel.INFO + logger = object : Logger { + override fun log(message: String) { + println(message) + } + } + } + } + ) + val libs = runBlocking { fetcher.fetch() } + val output = File("output.json") + val writerJson = Json(json) { + prettyPrint = true + prettyPrintIndent = " " + } + val text = writerJson.encodeToString(ListSerializer(LibraryInfo.serializer()), libs) + output.writeText(text) +} diff --git a/fetcher/src/test/kotlin/FetcherTest.kt b/fetcher/src/test/kotlin/FetcherTest.kt new file mode 100644 index 00000000..109b9c2e --- /dev/null +++ b/fetcher/src/test/kotlin/FetcherTest.kt @@ -0,0 +1,69 @@ +/* + * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. + */ + +import dev.icerock.kotlin.libraries.fetcher.Fetcher +import dev.icerock.kotlin.libraries.fetcher.LibraryInfo +import io.ktor.client.HttpClient +import io.ktor.client.engine.mock.MockEngine +import io.ktor.client.engine.mock.respondBadRequest +import io.ktor.client.engine.mock.respondOk +import kotlinx.coroutines.runBlocking +import kotlinx.serialization.json.Json +import kotlin.test.Test +import kotlin.test.assertEquals + +class FetcherTest { + + @Test + fun `successful fetch`() { + val httpClient = HttpClient(MockEngine) { + engine { + addHandler { request -> + val url = request.url.toString() + val tweedleDir = "https://repo1.maven.org/maven2/io/github/tyczj/" + when { + url == "https://search.maven.org/solrsearch/select?q=l%3Ametadata&start=0&rows=20" -> { + respondOk(readMock("search-result.json")) + } + url.startsWith(tweedleDir) -> { + val resourcePath: String = url.removePrefix(tweedleDir) + respondOk(readMock("tyczj/$resourcePath")) + } + else -> { + respondBadRequest() + } + } + } + } + } + val fetcher = Fetcher( + json = Json { + ignoreUnknownKeys = true + }, + httpClient = httpClient, + searchPageSize = 20 + ) + val result = runBlocking { fetcher.fetch() } + + assertEquals( + expected = listOf( + LibraryInfo( + groupId = "io.github.tyczj", + artifactId = "tweedle", + path = "io.github.tyczj:tweedle", + latestVersion = "0.3.4", + lastUpdated = "20210530012749", + versions = result.first().versions + ) + ), + actual = result + ) + } + + private fun readMock(name: String): String { + val resource = this.javaClass.getResourceAsStream(name) + ?: throw IllegalArgumentException("can't find $name in resources") + return resource.readAllBytes().decodeToString() + } +} diff --git a/fetcher/src/test/resources/search-result.json b/fetcher/src/test/resources/search-result.json new file mode 100644 index 00000000..15f41661 --- /dev/null +++ b/fetcher/src/test/resources/search-result.json @@ -0,0 +1,75 @@ +{ + "responseHeader": { + "status": 0, + "QTime": 4, + "params": { + "q": "l:metadata", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "0", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + } + }, + "response": { + "numFound": 1, + "start": 0, + "docs": [ + { + "id": "io.github.tyczj:tweedle-iosx64:0.3.4", + "g": "io.github.tyczj", + "a": "tweedle-iosx64", + "v": "0.3.4", + "p": "klib", + "timestamp": 1622337970000, + "ec": [ + ".klib", + "-metadata.jar", + ".module.asc.sha256", + "-metadata.jar.asc.sha512", + "-metadata.jar.sha512", + ".pom.asc.sha512", + ".pom.sha256", + "-sources.jar.sha256", + "-javadoc.jar.asc.sha512", + ".klib.sha512", + ".module.asc.sha512", + ".pom", + "-metadata.jar.sha256", + "-sources.jar.asc.sha256", + ".pom.asc.sha256", + "-javadoc.jar", + "-sources.jar", + "-metadata.jar.asc.sha256", + ".module", + "-javadoc.jar.asc.sha256", + "-javadoc.jar.sha512", + "-sources.jar.sha512", + ".module.sha512", + ".klib.asc.sha512", + ".klib.sha256", + ".module.sha256", + "-sources.jar.asc.sha512", + ".klib.asc.sha256", + ".pom.sha512", + "-javadoc.jar.sha256" + ], + "tags": [ + "twitter", + "using", + "kotlin", + "android", + "library", + "tweedle", + "built", + "fully", + "coroutines", + "around" + ] + } + ] + } +} diff --git a/fetcher/src/test/resources/tyczj/tweedle-iosx64/0.3.4/tweedle-iosx64-0.3.4.module b/fetcher/src/test/resources/tyczj/tweedle-iosx64/0.3.4/tweedle-iosx64-0.3.4.module new file mode 100644 index 00000000..4ad37fbd --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle-iosx64/0.3.4/tweedle-iosx64-0.3.4.module @@ -0,0 +1,176 @@ +{ + "formatVersion": "1.1", + "component": { + "url": "../../tweedle/0.3.4/tweedle-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.4", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "6.7.1", + "buildId": "j3qxdeuq2bbmtk265fazutxyom" + } + }, + "variants": [ + { + "name": "iosX64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + } + ], + "files": [ + { + "name": "tweedle.klib", + "url": "tweedle-iosx64-0.3.4.klib", + "size": 261282, + "sha512": "feecd22128b1841af3f9a0344281649df4c80bf6fb496cdfe037a94c51f17fe9f3573e248eeeca0e30eb3c12f903aa220753caa05f7311acfea8365443f4813d", + "sha256": "0e3d24c48ca7f5e5cd940a7c0682f677356c9144a70a9a6e1fd60d0a4ccd5b39", + "sha1": "0fd3ce2ae06fbdd532df3a431fff58b50e269b5c", + "md5": "2b2138845b90417da4458b5c53379045" + } + ] + }, + { + "name": "iosX64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + } + ], + "files": [ + { + "name": "tweedle-iosx64-0.3.4-metadata.jar", + "url": "tweedle-iosx64-0.3.4-metadata.jar", + "size": 5330, + "sha512": "600d0a9d61e1bb21b3686ef44c4bbb28642b6d0ffb2da94d525c6862530047c27d43f37411ad2fdafe083615f97a72be39588905e01dda270db4abbde579a058", + "sha256": "26f05aa1b19d91dccbb1850593fd642705a05a4a4a475e83bf016200090649a0", + "sha1": "a446278888ced319fa461d63228ba46b578bcb4c", + "md5": "450f7b73c1aee2d25d4ca813b85a2c99" + } + ] + }, + { + "name": "metadataApiElements-published", + "attributes": { + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.platform.type": "common" + }, + "available-at": { + "url": "../../tweedle/0.3.4/tweedle-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.4" + } + }, + { + "name": "commonMainMetadataElements-published", + "attributes": { + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.platform.type": "common" + }, + "available-at": { + "url": "../../tweedle/0.3.4/tweedle-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.4" + } + } + ] +} diff --git a/fetcher/src/test/resources/tyczj/tweedle/0.3.0/tweedle-0.3.0.module b/fetcher/src/test/resources/tyczj/tweedle/0.3.0/tweedle-0.3.0.module new file mode 100644 index 00000000..74cc32bb --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle/0.3.0/tweedle-0.3.0.module @@ -0,0 +1,243 @@ +{ + "formatVersion": "1.1", + "component": { + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.0", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "6.7.1", + "buildId": "rsfc37wucvhbnbx2thw4xa4onu" + } + }, + "variants": [ + { + "name": "metadataApiElements-published", + "attributes": { + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-logging", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "ch.qos.logback", + "module": "logback-classic", + "version": { + "requires": "1.2.3" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + } + ], + "files": [ + { + "name": "tweedle-metadata-0.3.0-all.jar", + "url": "tweedle-0.3.0-all.jar", + "size": 35415, + "sha512": "55dc46fcba00a27975e10973e5546aba5cc4ef59b15cae024f0668b8a061a3c8bad7a61c9932df2086a591862ddbf580ab7bc6820b169062cf9cefb91b30aa41", + "sha256": "34e278ccd0722bc283a6b86e8a1003469bbde5e1ed74188c17566212344b83f3", + "sha1": "9aa8eda9752db9e830eefff0d3fc3dbe11472fda", + "md5": "7dcd42eee4b1af14679390bbe993d3ea" + } + ] + }, + { + "name": "commonMainMetadataElements-published", + "attributes": { + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + } + ], + "files": [ + { + "name": "tweedle-0.3.0.jar", + "url": "tweedle-0.3.0.jar", + "size": 76047, + "sha512": "eb731d4212d167d8f82369143aab35628f9d3679a722f2a6659145cb894ab9d135a5a1e9f648c1f82eb8258d171434c60882c45b3ac9e4aab546eade44df5716", + "sha256": "a1120a6badeb0b68442a7426da7089e89747efd8f4ec1c351cc22b49928ab616", + "sha1": "d09da794e37e8e05139f1b6c9c7a856924291634", + "md5": "dc036ed3782ff368bef629a262ce403f" + } + ] + }, + { + "name": "debugApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.0/tweedle-android-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.0" + } + }, + { + "name": "debugRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.0/tweedle-android-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.0" + } + }, + { + "name": "releaseApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.0/tweedle-android-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.0" + } + }, + { + "name": "releaseRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.0/tweedle-android-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.0" + } + }, + { + "name": "iosArm64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.0/tweedle-iosarm64-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.0" + } + }, + { + "name": "iosArm64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.0/tweedle-iosarm64-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.0" + } + }, + { + "name": "iosX64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.0/tweedle-iosx64-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.0" + } + }, + { + "name": "iosX64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.0/tweedle-iosx64-0.3.0.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.0" + } + } + ] +} diff --git a/fetcher/src/test/resources/tyczj/tweedle/0.3.1/tweedle-0.3.1.module b/fetcher/src/test/resources/tyczj/tweedle/0.3.1/tweedle-0.3.1.module new file mode 100644 index 00000000..2c26e52b --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle/0.3.1/tweedle-0.3.1.module @@ -0,0 +1,243 @@ +{ + "formatVersion": "1.1", + "component": { + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.1", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "6.7.1", + "buildId": "74zcsojdgfha5hy3ue6upotuiu" + } + }, + "variants": [ + { + "name": "metadataApiElements-published", + "attributes": { + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-logging", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "ch.qos.logback", + "module": "logback-classic", + "version": { + "requires": "1.2.3" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + } + ], + "files": [ + { + "name": "tweedle-metadata-0.3.1-all.jar", + "url": "tweedle-0.3.1-all.jar", + "size": 35415, + "sha512": "687dcccb6957726eece128feac2f127f2c86d60fb70eae669f11d6db5ac78875939c85c7cbf6f0592873ac1a5232d13181a45dbc1022dd2deffd15719e1e7849", + "sha256": "a2026ec25a80b7deaa4fdd2ccafcfa54fc02bcdb5943ad5d7478fe01f0ddb9d2", + "sha1": "1275bc93299d2923024a7f78950bd06752638398", + "md5": "da42ffaed17b24e52dd64681acf6b70e" + } + ] + }, + { + "name": "commonMainMetadataElements-published", + "attributes": { + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + } + ], + "files": [ + { + "name": "tweedle-0.3.1.jar", + "url": "tweedle-0.3.1.jar", + "size": 76047, + "sha512": "b7b168278cefcb87d85732e0e8f049477e8f3a7bb254f6af1d7c6111a0e62fa5859a6986815c239e55d53d6b9e1cc2fdd62a0008adaed408c9c3e2d54361dded", + "sha256": "ae60db4baf2229366d470c5aab413a8ba76108ad466a807a6df82091749dd5f9", + "sha1": "ff5df6e6d19717c0d6578d10711c53fa8d6e7bab", + "md5": "895fafd96ac2cc8fbcb6e64bca313546" + } + ] + }, + { + "name": "debugApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android-debug/0.3.1/tweedle-android-debug-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-android-debug", + "version": "0.3.1" + } + }, + { + "name": "debugRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android-debug/0.3.1/tweedle-android-debug-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-android-debug", + "version": "0.3.1" + } + }, + { + "name": "releaseApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.1/tweedle-android-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.1" + } + }, + { + "name": "releaseRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.1/tweedle-android-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.1" + } + }, + { + "name": "iosArm64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.1/tweedle-iosarm64-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.1" + } + }, + { + "name": "iosArm64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.1/tweedle-iosarm64-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.1" + } + }, + { + "name": "iosX64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.1/tweedle-iosx64-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.1" + } + }, + { + "name": "iosX64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.1/tweedle-iosx64-0.3.1.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.1" + } + } + ] +} diff --git a/fetcher/src/test/resources/tyczj/tweedle/0.3.2/tweedle-0.3.2.module b/fetcher/src/test/resources/tyczj/tweedle/0.3.2/tweedle-0.3.2.module new file mode 100644 index 00000000..3120b945 --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle/0.3.2/tweedle-0.3.2.module @@ -0,0 +1,273 @@ +{ + "formatVersion": "1.1", + "component": { + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.2", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "6.7.1", + "buildId": "oeptoinrjfcuvawb6xxbgqjkza" + } + }, + "variants": [ + { + "name": "metadataApiElements-published", + "attributes": { + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-logging", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "ch.qos.logback", + "module": "logback-classic", + "version": { + "requires": "1.2.3" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + } + ], + "files": [ + { + "name": "tweedle-metadata-0.3.2-all.jar", + "url": "tweedle-0.3.2-all.jar", + "size": 35426, + "sha512": "7adc6223e29d1799f9d947831be96490b88dc87547210027b5c8daac40d59468f3821892550cb9df313ffe540d81337675bb5778cffa04dc4d75ab7d1517a0f3", + "sha256": "35c6b523ccd57cdfcb48a8c879f6a17fbeaaf064bd39fb894faf07bd604fdfbc", + "sha1": "6b90c84f6e0d77679b415690189f6d7857482448", + "md5": "2147cf705378a9bfd8530a3a6c6c8955" + } + ] + }, + { + "name": "commonMainMetadataElements-published", + "attributes": { + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + } + ], + "files": [ + { + "name": "tweedle-0.3.2.jar", + "url": "tweedle-0.3.2.jar", + "size": 76047, + "sha512": "f1588073b18b20d684ce871bda16b21efceb1a7b6ca3ff0a3153f52151eea9b051b62d00b312dc9061631b6025c6d59ee23847ca838eb24b2df0836a3297970b", + "sha256": "cd71afab75b0245e834d2405d7f56f722656685d54175cf059f48824bdfd2025", + "sha1": "384443103512fe126580e575e5edae228db1184c", + "md5": "edddfc810940d402579f43120fec9694" + } + ] + }, + { + "name": "debugApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android-debug/0.3.2/tweedle-android-debug-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android-debug", + "version": "0.3.2" + } + }, + { + "name": "debugRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android-debug/0.3.2/tweedle-android-debug-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android-debug", + "version": "0.3.2" + } + }, + { + "name": "releaseApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.2/tweedle-android-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.2" + } + }, + { + "name": "releaseRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.2/tweedle-android-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.2" + } + }, + { + "name": "stagingApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "staging", + "com.android.build.api.attributes.VariantAttr": "staging", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.2/tweedle-android-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.2" + } + }, + { + "name": "stagingRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "staging", + "com.android.build.api.attributes.VariantAttr": "staging", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.2/tweedle-android-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.2" + } + }, + { + "name": "iosArm64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.2/tweedle-iosarm64-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.2" + } + }, + { + "name": "iosArm64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.2/tweedle-iosarm64-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.2" + } + }, + { + "name": "iosX64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.2/tweedle-iosx64-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.2" + } + }, + { + "name": "iosX64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.2/tweedle-iosx64-0.3.2.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.2" + } + } + ] +} diff --git a/fetcher/src/test/resources/tyczj/tweedle/0.3.4/tweedle-0.3.4.module b/fetcher/src/test/resources/tyczj/tweedle/0.3.4/tweedle-0.3.4.module new file mode 100644 index 00000000..300b05c5 --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle/0.3.4/tweedle-0.3.4.module @@ -0,0 +1,229 @@ +{ + "formatVersion": "1.1", + "component": { + "group": "io.github.tyczj", + "module": "tweedle", + "version": "0.3.4", + "attributes": { + "org.gradle.status": "release" + } + }, + "createdBy": { + "gradle": { + "version": "6.7.1", + "buildId": "j3qxdeuq2bbmtk265fazutxyom" + } + }, + "variants": [ + { + "name": "metadataApiElements-published", + "attributes": { + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-ios", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-core", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-json", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "io.ktor", + "module": "ktor-client-serialization", + "version": { + "requires": "1.5.1" + } + }, + { + "group": "org.jetbrains.kotlinx", + "module": "kotlinx-coroutines-core", + "version": { + "strictly": "1.4.2-native-mt", + "requires": "1.4.2-native-mt" + } + } + ], + "files": [ + { + "name": "tweedle-metadata-0.3.4-all.jar", + "url": "tweedle-0.3.4-all.jar", + "size": 35391, + "sha512": "c94f16429015326a26a7f82de42d666bd31a86645b77ad7aa0f509a30e757c14b4355710bea88db993b6b8c1f09d014f2291e8e6088a60d8573633f95eb788a5", + "sha256": "9db68b9874e66a1da1c674174ad982ddb5c6ae4c4c73374dfb52c6371acef2e4", + "sha1": "bf546041c76229c0cc5b140ff6b0bf2643316254", + "md5": "9c901e245e6355611a1af3a67a363c74" + } + ] + }, + { + "name": "commonMainMetadataElements-published", + "attributes": { + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.platform.type": "common" + }, + "dependencies": [ + { + "group": "org.jetbrains.kotlin", + "module": "kotlin-stdlib-common", + "version": { + "requires": "1.4.32" + } + } + ], + "files": [ + { + "name": "tweedle-0.3.4.jar", + "url": "tweedle-0.3.4.jar", + "size": 76047, + "sha512": "4c0cced069ed116d015aa3cb3cacdf4736f9bcb2869ee0900901cf98428db271b5f9bf4e1e6fa921aaf63416a15e7787c0fea02ab23aa9ca1e96af9f05ff9c79", + "sha256": "9c2046141d194210c330bcaa66bdec3b97174b9058b1ea0078530ef633d77cb0", + "sha1": "d008a6e57232aa39b96eec41f19dbd01c37c3399", + "md5": "bd22da88949739837a0c9651b95b963a" + } + ] + }, + { + "name": "debugApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.4/tweedle-android-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.4" + } + }, + { + "name": "debugRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "debug", + "com.android.build.api.attributes.VariantAttr": "debug", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.4/tweedle-android-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.4" + } + }, + { + "name": "releaseApiElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-api", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.4/tweedle-android-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.4" + } + }, + { + "name": "releaseRuntimeElements-published", + "attributes": { + "com.android.build.api.attributes.BuildTypeAttr": "release", + "com.android.build.api.attributes.VariantAttr": "release", + "org.gradle.usage": "java-runtime", + "org.jetbrains.kotlin.platform.type": "androidJvm" + }, + "available-at": { + "url": "../../tweedle-android/0.3.4/tweedle-android-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-android", + "version": "0.3.4" + } + }, + { + "name": "iosArm64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.4/tweedle-iosarm64-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.4" + } + }, + { + "name": "iosArm64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_arm64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosarm64/0.3.4/tweedle-iosarm64-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-iosarm64", + "version": "0.3.4" + } + }, + { + "name": "iosX64ApiElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-api", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.4/tweedle-iosx64-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.4" + } + }, + { + "name": "iosX64MetadataElements-published", + "attributes": { + "artifactType": "org.jetbrains.kotlin.klib", + "org.gradle.usage": "kotlin-metadata", + "org.jetbrains.kotlin.native.target": "ios_x64", + "org.jetbrains.kotlin.platform.type": "native" + }, + "available-at": { + "url": "../../tweedle-iosx64/0.3.4/tweedle-iosx64-0.3.4.module", + "group": "io.github.tyczj", + "module": "tweedle-iosx64", + "version": "0.3.4" + } + } + ] +} diff --git a/fetcher/src/test/resources/tyczj/tweedle/maven-metadata.xml b/fetcher/src/test/resources/tyczj/tweedle/maven-metadata.xml new file mode 100644 index 00000000..34a0529b --- /dev/null +++ b/fetcher/src/test/resources/tyczj/tweedle/maven-metadata.xml @@ -0,0 +1,16 @@ + + + io.github.tyczj + tweedle + + 0.3.4 + 0.3.4 + + 0.3.0 + 0.3.1 + 0.3.2 + 0.3.4 + + 20210530012749 + + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..f1a9d330 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +kotlin.code.style=official \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..886c5a0e --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,15 @@ +[versions] +ktor-client = "1.5.3" +kotlin = "1.5.10" + +[libraries] +ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor-client" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor-client" } +ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor-client" } +ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor-client" } +konsume-xml = { module = "com.gitlab.mvysny.konsume-xml:konsume-xml", version = "0.14" } +kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.2.1" } +kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } + +[bundles] +ktor-client = ["ktor-client-core", "ktor-client-cio", "ktor-client-logging"] \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0f80bbf5 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..4f906e0c --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..106efd58 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,20 @@ +enableFeaturePreview("VERSION_CATALOGS") + +rootProject.name = "multiplatform-libraries" + +pluginManagement { + repositories { + mavenCentral() + google() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + google() + } +} + +include("fetcher") \ No newline at end of file