-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
360 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
plugin-core/src/main/kotlin/net/meilcli/librarian/plugin/extensions/ProjectExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.meilcli.librarian.plugin.extensions | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
|
||
const val librarianGroup = "librarian" | ||
|
||
inline fun <reified T : Task> Project.createTask(name: String): T { | ||
val task = tasks.create(name, T::class.java) | ||
task.group = librarianGroup | ||
return task | ||
} |
29 changes: 29 additions & 0 deletions
29
plugin-core/src/main/kotlin/net/meilcli/librarian/plugin/internal/GroupWriter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.meilcli.librarian.plugin.internal | ||
|
||
import kotlinx.serialization.UnstableDefault | ||
import kotlinx.serialization.json.Json | ||
import net.meilcli.librarian.plugin.LibrarianExtension | ||
import net.meilcli.librarian.plugin.entities.LibraryGroup | ||
import org.gradle.api.Project | ||
import java.io.File | ||
|
||
object GroupWriter { | ||
|
||
@UnstableDefault | ||
fun write(project: Project, extension: LibrarianExtension, groups: Collection<LibraryGroup>) { | ||
val outputDirectory = File(project.rootProject.rootDir, "${extension.dataFolderName}/${extension.groupsFolderName}") | ||
if (outputDirectory.exists().not()) { | ||
outputDirectory.mkdirs() | ||
} | ||
|
||
val json = Json { | ||
this.prettyPrint = true | ||
} | ||
|
||
for (group in groups) { | ||
val outputFile = File(outputDirectory, "${group.name}.json") | ||
val text = json.stringify(LibraryGroup.serializer(), group) | ||
outputFile.writeText(text, Charsets.UTF_8) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import net.meilcli.librarian.gradle.Dependencies | ||
|
||
apply plugin: 'java-gradle-plugin' | ||
apply plugin: 'kotlin' | ||
apply plugin: 'KotlinLibraryPlugin' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.bintray' | ||
apply plugin: 'MavenPublishPlugin' | ||
|
||
dependencies { | ||
implementation project(':plugin-core') | ||
implementation Dependencies.Kotlin.Serialization.runtime | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
librarianPlugin { | ||
id = "librarian-preset" | ||
displayName = "Librarian Preset Plugin" | ||
description = "Librarian is generate notice that library used in gradle module" | ||
implementationClass = "net.meilcli.librarian.plugin.LibrarianPresetPlugin" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
plugin-preset/src/main/kotlin/net/meilcli/librarian/plugin/LibrarianPresetPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package net.meilcli.librarian.plugin | ||
|
||
import net.meilcli.librarian.plugin.extensions.createTask | ||
import net.meilcli.librarian.plugin.tasks.GeneratePresetGroupsTask | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
class LibrarianPresetPlugin : Plugin<Project> { | ||
|
||
override fun apply(project: Project) { | ||
val extension = checkNotNull(project.extensions.findByType(LibrarianExtension::class.java)) { "must apply plugin librarian" } | ||
|
||
project.createTask<GeneratePresetGroupsTask>("librarianGeneratePresetGroups").apply { | ||
this.extension = extension | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
plugin-preset/src/main/kotlin/net/meilcli/librarian/plugin/presets/Kotlin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
@file:Suppress("SpellCheckingInspection") | ||
|
||
package net.meilcli.librarian.plugin.presets | ||
|
||
fun kotlin(){ | ||
PresetGroups += group( | ||
"Kotlin", | ||
"org.jetbrains.kotlin", | ||
"kotlin-stdlib", | ||
"kotlin-stdlib-jdk8", | ||
"kotlin-stdlib-jdk7", | ||
"kotlin-stdlib-jre7", | ||
"kotlin-stdlib-jre8", | ||
"kotlin-stdlib-js", | ||
"kotlin-stdlib-common", | ||
"kotlin-reflect", | ||
"kotlin-test", | ||
"kotlin-test-junit", | ||
"kotlin-test-junit5", | ||
"kotlin-test-common", | ||
"kotlin-test-js", | ||
"kotlin-android-extensions-runtime", | ||
"kotlin-android-extensions", | ||
"kotlin-gradle-plugin", | ||
"kotlin-noarg", | ||
"kotlin-allopen" | ||
) | ||
PresetGroups += group( | ||
"kotlinx.serialization", | ||
"org.jetbrains.kotlinx", | ||
"kotlinx-serialization-runtime", | ||
"kotlinx-serialization-runtime-common", | ||
"kotlinx-serialization-runtime-js", | ||
"kotlinx-serialization-runtime-native", | ||
"kotlinx-serialization-runtime-iosx64", | ||
"kotlinx-serialization-runtime-macosx64", | ||
"kotlinx-serialization-runtime-iosarm64", | ||
"kotlinx-serialization-runtime-tvosarm64", | ||
"kotlinx-serialization-runtime-linuxx64", | ||
"kotlinx-serialization-runtime-watchosx86", | ||
"kotlinx-serialization-runtime-watchosarm64", | ||
"kotlinx-serialization-runtime-tvosx64", | ||
"kotlinx-serialization-runtime-mingwx64", | ||
"kotlinx-serialization-runtime-iosarm32", | ||
"kotlinx-serialization-runtime-watchosarm32", | ||
"kotlinx-serialization-runtime-jsonparser", | ||
"kotlinx-serialization-runtime-linuxarm32hfp", | ||
"kotlinx-serialization-runtime-mingwx86", | ||
"kotlinx-serialization-runtime-linuxarm64", | ||
"kotlinx-serialization-runtime-wasm32", | ||
"kotlinx-serialization-protobuf-common", | ||
"kotlinx-serialization-protobuf", | ||
"kotlinx-serialization-cbor" | ||
) | ||
PresetGroups += group( | ||
"kotlinx.coroutines", | ||
"org.jetbrains.kotlinx", | ||
"kotlinx-coroutines-core", | ||
"kotlinx-coroutines-android", | ||
"kotlinx-coroutines-jdk8", | ||
"kotlinx-coroutines-rx2", | ||
"kotlinx-coroutines-reactor", | ||
"kotlinx-coroutines-javafx", | ||
"kotlinx-coroutines-reactive", | ||
"kotlinx-coroutines-core-common", | ||
"kotlinx-coroutines-core-native", | ||
"kotlinx-coroutines-core-js", | ||
"kotlinx-coroutines-core-iosx64", | ||
"kotlinx-coroutines-core-iosarm64", | ||
"kotlinx-coroutines-core-macosx64", | ||
"kotlinx-coroutines-core-linuxx64", | ||
"kotlinx-coroutines-core-iosarm32", | ||
"kotlinx-coroutines-core-windowsx64", | ||
"kotlinx-coroutines-core-mingwx64", | ||
"kotlinx-coroutines-core-tvosarm64", | ||
"kotlinx-coroutines-core-watchosx86", | ||
"kotlinx-coroutines-core-watchosarm64", | ||
"kotlinx-coroutines-core-tvosx64", | ||
"kotlinx-coroutines-core-watchosarm32", | ||
"kotlinx-coroutines-test" | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
plugin-preset/src/main/kotlin/net/meilcli/librarian/plugin/presets/PresetGroups.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package net.meilcli.librarian.plugin.presets | ||
|
||
import net.meilcli.librarian.plugin.entities.LibraryGroup | ||
|
||
object PresetGroups { | ||
|
||
private val mutableGroups = mutableListOf<LibraryGroup>() | ||
val groups: List<LibraryGroup> | ||
get() = mutableGroups | ||
|
||
operator fun plusAssign(group: LibraryGroup) { | ||
mutableGroups += group | ||
} | ||
|
||
init { | ||
kotlin() | ||
square() | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
plugin-preset/src/main/kotlin/net/meilcli/librarian/plugin/presets/Square.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
@file:Suppress("SpellCheckingInspection") | ||
|
||
package net.meilcli.librarian.plugin.presets | ||
|
||
fun square() { | ||
PresetGroups += group( | ||
"Okio", | ||
"com.squareup.okio", | ||
"okio-parent", | ||
"okio", | ||
"okio-js", | ||
"okio-metadata", | ||
"okio-multiplatform", | ||
"okio-iosx64", | ||
"okio-macosx64", | ||
"okio-iosarm64", | ||
"okio-linuxx64" | ||
) | ||
PresetGroups += group( | ||
"OkHttp", | ||
"com.squareup.okhttp3", | ||
"parent", | ||
"okhttp", | ||
"logging-interceptor", | ||
"mockwebserver", | ||
"okhttp-urlconnection", | ||
"okhttp-testing-support", | ||
"okhttp-tls", | ||
"okhttp-sse", | ||
"okhttp-dnsoverhttps", | ||
"okcurl", | ||
"okhttp-bom", | ||
"okhttp-brotli" | ||
) | ||
PresetGroups += group( | ||
"Retrofit", | ||
"com.squareup.retrofit2", | ||
"parent", | ||
"retrofit", | ||
"retrofit-mock", | ||
"retrofit-converters", | ||
"retrofit-adapters", | ||
"converter-jackson", | ||
"converter-scalars", | ||
"converter-simplexml", | ||
"converter-jaxb", | ||
"converter-java8", | ||
"converter-guava", | ||
"converter-gson", | ||
"converter-moshi", | ||
"converter-wire", | ||
"converter-protobuf", | ||
"adapter-rxjava", | ||
"adapter-rxjava2", | ||
"adapter-scala", | ||
"adapter-java8", | ||
"adapter-guava" | ||
) | ||
PresetGroups += group( | ||
"Picasso", | ||
"com.squareup.picasso", | ||
"picasso-parent", | ||
"picasso", | ||
"picasso-pollexor" | ||
) | ||
PresetGroups += group( | ||
"Moshi", | ||
"com.squareup.moshi", | ||
"moshi-parent", | ||
"moshi", | ||
"moshi-kotlin", | ||
"moshi-adapters", | ||
"moshi-kotlin-codegen" | ||
) | ||
PresetGroups += group( | ||
"LeakCanary", | ||
"com.squareup.leakcanary", | ||
"leakcanary-android", | ||
"leakcanary-android-no-op", | ||
"leakcanary-android-core", | ||
"leakcanary-android-process", | ||
"leakcanary-android-instrumentation", | ||
"leakcanary-object-watcher", | ||
"leakcanary-deobfuscation-gradle-plugin", | ||
"leakcanary-object-watcher-android-support-fragments", | ||
"leakcanary-object-watcher-android", | ||
"leakcanary-object-watcher-android-androidx", | ||
"shark-log", | ||
"shark-graph", | ||
"shark-android", | ||
"shark", | ||
"shark-cli", | ||
"shark-hprof" | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
plugin-preset/src/main/kotlin/net/meilcli/librarian/plugin/presets/group.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.meilcli.librarian.plugin.presets | ||
|
||
import net.meilcli.librarian.plugin.entities.LibraryGroup | ||
|
||
fun group(name: String, groupName: String, vararg artifactNames: String): LibraryGroup { | ||
return LibraryGroup(artifactNames.map { "$groupName:$it" }, name) | ||
} |
Oops, something went wrong.