|
| 1 | +// :buildSrc |
| 2 | +plugins { |
| 3 | + alias(plugin.plugins.maven.publish) |
| 4 | + alias(plugin.plugins.gradle.plugin) |
| 5 | + alias(plugin.plugins.gradle.publish) |
| 6 | +} |
| 7 | + |
| 8 | +project.ext.set("github_handle", "syslogic") |
| 9 | +project.ext.set("plugin_display_name", "AppGallery Connect Publishing Plugin") |
| 10 | +project.ext.set("plugin_description", "It uploads Android APK/ABB artifacts with AppGallery Connect Publishing API.") |
| 11 | +project.ext.set("plugin_identifier", "agconnect-publishing-gradle-plugin") |
| 12 | +project.ext.set("plugin_class", "io.syslogic.agconnect.PublishingPlugin") |
| 13 | +project.ext.set("plugin_id", "io.syslogic.agconnect.publishing") |
| 14 | +project.ext.set("plugin_version", plugin.versions.plugin.version.get()) |
| 15 | + |
| 16 | +dependencies { |
| 17 | + |
| 18 | + compileOnly(dependencyNotation = gradleApi()) |
| 19 | + //noinspection DependencyNotationArgument |
| 20 | + implementation(dependencyNotation = plugin.android.gradle) |
| 21 | + //noinspection DependencyNotationArgument |
| 22 | + implementation(dependencyNotation = plugin.annotations) |
| 23 | + //noinspection DependencyNotationArgument |
| 24 | + implementation(dependencyNotation = plugin.bundles.http.components) |
| 25 | + |
| 26 | + testImplementation(dependencyNotation = plugin.junit) |
| 27 | + testImplementation(dependencyNotation = gradleTestKit()) |
| 28 | + //noinspection DependencyNotationArgument |
| 29 | + testImplementation(dependencyNotation = plugin.annotations) |
| 30 | + testImplementation(dependencyNotation = project) |
| 31 | +} |
| 32 | + |
| 33 | +gradlePlugin { |
| 34 | + plugins { |
| 35 | + create("PublishingPlugin") { |
| 36 | + id = "${project.ext.get("plugin_id")}" |
| 37 | + implementationClass = "${project.ext.get("plugin_class")}" |
| 38 | + displayName = "${project.ext.get("plugin_display_name")}" |
| 39 | + description = "${project.ext.get("plugin_description")}" |
| 40 | + } |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +tasks.withType<Jar>().configureEach { |
| 45 | + archiveBaseName.set("${project.ext.get("plugin_identifier")}") |
| 46 | + archiveVersion.set("${project.ext.get("plugin_version")}") |
| 47 | +} |
| 48 | + |
| 49 | +tasks.withType<Test>().configureEach { |
| 50 | + useJUnitPlatform() |
| 51 | +} |
| 52 | + |
| 53 | +tasks.register<Javadoc>("javadocs") { |
| 54 | + setDestinationDir(project.file("/build/outputs/javadoc")) |
| 55 | + title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API" |
| 56 | + source = sourceSets.getByName("main").java |
| 57 | + classpath = files(File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar")) |
| 58 | + classpath += configurations.getByName("implementation") |
| 59 | + // options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/" |
| 60 | + // options.linkSource = true |
| 61 | + // options.author = true |
| 62 | + isFailOnError = false |
| 63 | +} |
| 64 | +val javadocJar by tasks.registering(Jar::class) { |
| 65 | + archiveClassifier.set("javadoc") |
| 66 | + from(project.file("/build/outputs/javadoc")) |
| 67 | + dependsOn("javadocs") |
| 68 | +} |
| 69 | + |
| 70 | +val sourcesJar by tasks.registering(Jar::class) { |
| 71 | + archiveClassifier.set("sources") |
| 72 | + from(sourceSets.getByName("main").java.srcDirs) |
| 73 | +} |
| 74 | + |
| 75 | +group = "io.syslogic" |
| 76 | +version = "${project.ext.get("plugin_version")}" |
| 77 | +artifacts { |
| 78 | + archives(javadocJar) |
| 79 | + archives(sourcesJar) |
| 80 | +} |
| 81 | + |
| 82 | +afterEvaluate { |
| 83 | + publishing { |
| 84 | + publications { |
| 85 | + create<MavenPublication>("release") { |
| 86 | + from(components.getByName("java")) |
| 87 | + groupId = "io.syslogic" |
| 88 | + artifactId = "${project.ext.get("plugin_identifier")}" |
| 89 | + version = "${project.ext.get("plugin_version")}" |
| 90 | + pom { |
| 91 | + name = "${project.ext.get("plugin_display_name")}" |
| 92 | + description = "${project.ext.get("plugin_description")}" |
| 93 | + url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}" |
| 94 | + scm { |
| 95 | + connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git" |
| 96 | + developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git" |
| 97 | + url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/" |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + repositories { |
| 103 | + /* |
| 104 | + * JetBrains Spaces Repository (private) |
| 105 | + * https://lp.jetbrains.com/space-source-code-management/ |
| 106 | + */ |
| 107 | + if (System.getenv("JB_SPACE_MAVEN_REPO") != null) { |
| 108 | + maven { |
| 109 | + url = uri(System.getenv("JB_SPACE_MAVEN_REPO")) |
| 110 | + credentials { |
| 111 | + username = System.getenv("JB_SPACE_CLIENT_ID") |
| 112 | + password = System.getenv("JB_SPACE_CLIENT_SECRET") |
| 113 | + } |
| 114 | + } |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | +} |
0 commit comments