Skip to content

Commit 1d1287d

Browse files
committed
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 <[email protected]>
1 parent e9a74cd commit 1d1287d

File tree

2 files changed

+61
-36
lines changed

2 files changed

+61
-36
lines changed

build.gradle.kts

Lines changed: 0 additions & 36 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,20 +21,6 @@ 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

@@ -53,12 +38,6 @@ subprojects {
5338
}
5439
}
5540

56-
// Prevent .proto files ending up in JARs
57-
tasks.withType<Jar>().configureEach {
58-
exclude("**/*.proto")
59-
includeEmptyDirs = false
60-
}
61-
6241
// Test logging setup
6342
tasks.withType<Test>().configureEach {
6443
testLogging {
@@ -68,18 +47,3 @@ subprojects {
6847
}
6948
}
7049
}
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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@
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 {
@@ -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:[email protected]:TeamNewPipe/NewPipeExtractor.git"
115+
developerConnection = "scm:git:[email protected]:TeamNewPipe/NewPipeExtractor.git"
116+
}
117+
118+
developers {
119+
developer {
120+
id = "newpipe"
121+
name = "Team NewPipe"
122+
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)