Skip to content

Commit 77af123

Browse files
theimpulsonStypox
authored andcommitted
Refactor and reconfigure publishing information for extractor
* Add missing information in pom file * Add a new local maven repo to access the file easily * Relocate the publishing instructions to extractor module * Use the existing Gradle task to generate javadoc Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
1 parent ea59782 commit 77af123

2 files changed

Lines changed: 64 additions & 38 deletions

File tree

build.gradle.kts

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ plugins {
1212

1313
allprojects {
1414
apply(plugin = "java-library")
15-
apply(plugin = "maven-publish")
1615

1716
tasks.withType<JavaCompile> {
1817
options.encoding = Charsets.UTF_8.toString()
@@ -22,25 +21,12 @@ allprojects {
2221
toolchain {
2322
languageVersion.set(JavaLanguageVersion.of(11))
2423
}
25-
withSourcesJar()
26-
}
27-
28-
version = "v0.24.8"
29-
group = "com.github.TeamNewPipe"
30-
31-
afterEvaluate {
32-
extensions.configure<PublishingExtension>("publishing") {
33-
publications {
34-
create<MavenPublication>("mavenJava") {
35-
from(components["java"])
36-
}
37-
}
38-
}
3924
}
4025
}
4126

4227
subprojects {
43-
// Javadoc setup
28+
// https://discuss.gradle.org/t/best-approach-gradle-multi-module-project-generate-just-one-global-javadoc/18657/21
29+
// Fixes unknown tag @implNote; the other two were added precautionary
4430
tasks.withType<Javadoc>().configureEach {
4531
(options as StandardJavadocDocletOptions).apply {
4632
encoding = Charsets.UTF_8.toString()
@@ -53,12 +39,6 @@ subprojects {
5339
}
5440
}
5541

56-
// Prevent .proto files ending up in JARs
57-
tasks.withType<Jar>().configureEach {
58-
exclude("**/*.proto")
59-
includeEmptyDirs = false
60-
}
61-
6242
// Test logging setup
6343
tasks.withType<Test>().configureEach {
6444
testLogging {
@@ -68,18 +48,3 @@ subprojects {
6848
}
6949
}
7050
}
71-
72-
// https://discuss.gradle.org/t/best-approach-gradle-multi-module-project-generate-just-one-global-javadoc/18657/21
73-
tasks.register<Javadoc>("aggregatedJavadocs") {
74-
title = "${project.name} ${project.version}"
75-
setDestinationDir(layout.buildDirectory.dir("docs/javadoc").get().asFile)
76-
77-
subprojects.forEach { subProject ->
78-
subProject.tasks.withType<Javadoc>().forEach { javadocTask ->
79-
source = javadocTask.source
80-
classpath += javadocTask.classpath
81-
excludes += javadocTask.excludes
82-
includes += javadocTask.includes
83-
}
84-
}
85-
}

extractor/build.gradle.kts

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@
66
plugins {
77
alias(libs.plugins.google.protobuf)
88
checkstyle
9+
`maven-publish`
10+
}
11+
12+
java {
13+
withSourcesJar()
14+
withJavadocJar()
15+
}
16+
17+
// Protobuf files would uselessly end up in the JAR otherwise, see
18+
// https://github.com/google/protobuf-gradle-plugin/issues/390
19+
tasks.jar {
20+
exclude("**/*.proto")
21+
includeEmptyDirs = false
922
}
1023

1124
tasks.test {
12-
// Pass on downloader type to tests for different CI jobs.
25+
// Pass on downloader type to tests for different CI jobs. See DownloaderFactory.java and ci.yml
1326
if (System.getProperties().containsKey("downloader")) {
1427
systemProperty("downloader", System.getProperty("downloader"))
1528
}
@@ -71,3 +84,51 @@ protobuf {
7184
}
7285
}
7386
}
87+
88+
// Run "./gradlew publishReleasePublicationToLocalRepository" to generate release JARs locally
89+
publishing {
90+
publications {
91+
create<MavenPublication>("release") {
92+
groupId = "net.newpipe"
93+
artifactId = "extractor"
94+
version = "v0.24.8"
95+
96+
afterEvaluate {
97+
from(components["java"])
98+
}
99+
100+
pom {
101+
name = "NewPipe Extractor"
102+
description = "A library for extracting data from streaming websites, used in NewPipe"
103+
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
104+
105+
licenses {
106+
license {
107+
name = "GNU GENERAL PUBLIC LICENSE, Version 3"
108+
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
109+
}
110+
}
111+
112+
scm {
113+
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
114+
connection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
115+
developerConnection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
116+
}
117+
118+
developers {
119+
developer {
120+
id = "newpipe"
121+
name = "Team NewPipe"
122+
email = "team@newpipe.net"
123+
}
124+
}
125+
}
126+
}
127+
repositories {
128+
maven {
129+
name = "local"
130+
url = uri(layout.buildDirectory.dir("maven"))
131+
}
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)