Make createArchive put zip in expected location
This will help jetpad find it for publishing
Bug: 138375208
Test: ./gradlew createArchive -> it puts it in
dist/per-project-zips/*.zip
Change-Id: Ib90f087487df7b862f7b850b836bcdc53f1a8424
diff --git a/build.gradle.kts b/build.gradle.kts
index 6ae19c9..1589902 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,7 @@
+import com.android.tools.metalava.CREATE_ARCHIVE_TASK
+import com.android.tools.metalava.CREATE_BUILD_INFO_TASK
import com.android.tools.metalava.configureBuildInfoTask
+import com.android.tools.metalava.configurePublishingArchive
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream
@@ -20,7 +23,13 @@
buildDir = getBuildDirectory()
-defaultTasks = mutableListOf("installDist", "test", "createArchive", "ktlint")
+defaultTasks = mutableListOf(
+ "installDist",
+ "test",
+ CREATE_ARCHIVE_TASK,
+ CREATE_BUILD_INFO_TASK,
+ "ktlint"
+)
repositories {
google()
@@ -186,12 +195,12 @@
args = listOf("-F", "src/**/*.kt", "build.gradle.kts")
}
-val libraryName = "Metalava"
+val publicationName = "Metalava"
val repositoryName = "Dist"
publishing {
publications {
- create<MavenPublication>(libraryName) {
+ create<MavenPublication>(publicationName) {
from(components["java"])
pom {
licenses {
@@ -221,16 +230,6 @@
}
}
-tasks.register("createArchive", Zip::class.java) {
- description = "Create a zip of the library in a maven format"
- group = "publishing"
-
- from("${getDistributionDirectory().canonicalPath}/repo")
- archiveFileName.set("top-of-tree-m2repository-all-${getBuildId()}.zip")
- destinationDirectory.set(getDistributionDirectory())
- dependsOn("publish${libraryName}PublicationTo${repositoryName}Repository")
-}
-
// Workaround for https://github.com/gradle/gradle/issues/11717
tasks.withType(GenerateModuleMetadata::class.java).configureEach {
doLast {
@@ -244,4 +243,11 @@
}
}
-configureBuildInfoTask(project, getDistributionDirectory())
\ No newline at end of file
+configureBuildInfoTask(project, getDistributionDirectory())
+configurePublishingArchive(
+ project,
+ publicationName,
+ repositoryName,
+ getBuildId(),
+ getDistributionDirectory()
+)