@@ -6,6 +6,7 @@ plugins {
66}
77
88project.ext.set(" github_handle" , " syslogic" )
9+ project.ext.set(" group_id" , " io.syslogic" )
910project.ext.set(" plugin_display_name" , " AppGallery Connect Publishing Plugin" )
1011project.ext.set(" plugin_description" , " It uploads Android APK/ABB artifacts with AppGallery Connect Publishing API." )
1112project.ext.set(" plugin_identifier" , " agconnect-publishing-gradle-plugin" )
@@ -41,21 +42,27 @@ gradlePlugin {
4142 }
4243}
4344
44- tasks.withType< Jar >().configureEach {
45- archiveBaseName.set( " ${project.ext. get(" plugin_identifier " )} " )
46- archiveVersion.set( " ${project.ext.get( " plugin_version " )} " )
45+ configurations {
46+ val javadocImplementation = create( " javadocImplementation " ).extendsFrom(configurations.implementation. get() )
47+ javadocImplementation.isCanBeResolved = true
4748}
4849
50+
4951tasks.withType<Test >().configureEach {
5052 useJUnitPlatform()
5153}
5254
53- tasks.register<Javadoc >(" javadocs" ) {
54- setDestinationDir(project.file(" /build/outputs/javadoc" ))
55+ tasks.withType<Jar >().configureEach {
56+ archiveBaseName.set(" ${project.ext.get(" plugin_identifier" )} " )
57+ archiveVersion.set(" ${project.ext.get(" plugin_version" )} " )
58+ }
59+
60+
61+ val javadocs by tasks.registering(Javadoc ::class ) {
5562 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 " )
63+ classpath = configurations.named( " javadocImplementation " ).get().asFileTree.filter {it.extension == " jar " }
64+ setDestinationDir(project.file( " /build/outputs/javadoc " ))
65+ source = sourceSets.main.get().allJava
5966 // options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
6067 // options.linkSource = true
6168 // options.author = true
@@ -65,15 +72,15 @@ tasks.register<Javadoc>("javadocs") {
6572val javadocJar by tasks.registering(Jar ::class ) {
6673 archiveClassifier.set(" javadoc" )
6774 from(project.file(" /build/outputs/javadoc" ))
68- dependsOn(" javadocs" )
75+ dependsOn(javadocs)
6976}
7077
7178val sourcesJar by tasks.registering(Jar ::class ) {
7279 archiveClassifier.set(" sources" )
73- from(sourceSets.getByName( " main" ).java.srcDirs)
80+ from(sourceSets.main.get( ).java.srcDirs)
7481}
7582
76- group = " io.syslogic "
83+ group = " ${project.ext.get( " group_id " )} "
7784version = " ${project.ext.get(" plugin_version" )} "
7885artifacts {
7986 archives(javadocJar)
@@ -85,7 +92,7 @@ afterEvaluate {
8592 publications {
8693 create<MavenPublication >(" release" ) {
8794 from(components.getByName(" java" ))
88- groupId = " io.syslogic "
95+ groupId = " ${project.ext.get( " group_id " )} "
8996 artifactId = " ${project.ext.get(" plugin_identifier" )} "
9097 version = " ${project.ext.get(" plugin_version" )} "
9198 pom {
0 commit comments