1+ import org.codehaus.groovy.runtime.DefaultGroovyMethods.head
2+
13// :buildSrc
24plugins {
35 alias(buildSrc.plugins.maven.publish)
@@ -43,7 +45,6 @@ gradlePlugin {
4345 }
4446}
4547
46-
4748tasks.withType<Test >().configureEach {
4849 useJUnitPlatform()
4950}
@@ -62,7 +63,7 @@ val implCls: Configuration by configurations.creating {
6263val javadocs by tasks.registering(Javadoc ::class ) {
6364 title = " ${project.ext.get(" plugin_display_name" )} ${project.ext.get(" plugin_version" )} API"
6465 classpath + = implCls.asFileTree.filter {it.extension == " jar" }
65- setDestinationDir(project .file(" / build/javadoc" ) )
66+ destinationDir = rootProject .file(" build/javadoc" )
6667 source = sourceSets.main.get().allJava
6768 // options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
6869 // options.linkSource = true
@@ -72,7 +73,7 @@ val javadocs by tasks.registering(Javadoc::class) {
7273
7374val javadocJar by tasks.registering(Jar ::class ) {
7475 archiveClassifier.set(" javadoc" )
75- from(project .file(" / build/javadoc" ))
76+ from(rootProject .file(" build/javadoc" ))
7677 dependsOn(javadocs)
7778}
7879
@@ -89,25 +90,55 @@ artifacts {
8990 archives(sourcesJar)
9091}
9192
92- afterEvaluate {
93- publishing {
94- publications {
95- create<MavenPublication >(" release" ) {
96- from(components.getByName(" java" ))
97- groupId = " ${project.ext.get(" group_id" )} "
98- artifactId = " ${project.ext.get(" plugin_identifier" )} "
99- version = " ${project.ext.get(" plugin_version" )} "
100- pom {
101- name = " ${project.ext.get(" plugin_display_name" )} "
102- description = " ${project.ext.get(" plugin_description" )} "
103- url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} "
104- scm {
105- connection = " scm:git:git://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
106- developerConnection = " scm:git:ssh://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
107- url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} /"
108- }
93+ configure<PublishingExtension > {
94+ repositories {
95+ maven {
96+ name = " GitHubPackages"
97+ url = uri(" https://maven.pkg.github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} " )
98+ credentials {
99+ username = System .getenv(" GITHUB_ACTOR" )
100+ password = System .getenv(" GITHUB_TOKEN" )
101+ }
102+ }
103+ }
104+
105+ publications {
106+ register<MavenPublication >(" GPR" ) {
107+ from(components.getByName(" java" ))
108+ groupId = " ${project.ext.get(" group_id" )} "
109+ artifactId = " ${project.ext.get(" plugin_identifier" )} "
110+ version = " ${project.ext.get(" plugin_version" )} "
111+ pom {
112+ name = " ${project.ext.get(" plugin_display_name" )} "
113+ description = " ${project.ext.get(" plugin_description" )} "
114+ url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} "
115+ scm {
116+ connection = " scm:git:git://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
117+ developerConnection = " scm:git:ssh://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
118+ url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} /"
119+ }
120+ }
121+ }
122+
123+ register<MavenPublication >(" JitPack" ) {
124+ from(components.getByName(" java" ))
125+ groupId = " ${project.ext.get(" group_id" )} "
126+ artifactId = " ${project.ext.get(" plugin_identifier" )} "
127+ version = " ${project.ext.get(" plugin_version" )} "
128+ pom {
129+ name = " ${project.ext.get(" plugin_display_name" )} "
130+ description = " ${project.ext.get(" plugin_description" )} "
131+ url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} "
132+ scm {
133+ connection = " scm:git:git://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
134+ developerConnection = " scm:git:ssh://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} .git"
135+ url = " https://github.com/${project.ext.get(" github_handle" )} /${project.ext.get(" plugin_identifier" )} /"
109136 }
110137 }
111138 }
112139 }
113140}
141+
142+ tasks.withType<MavenPublication >().forEach { pub: MavenPublication ->
143+
144+ }
0 commit comments