Skip to content

Commit 6a06228

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 <aayushgupta219@gmail.com>
1 parent e9a74cd commit 6a06228

2 files changed

Lines changed: 60 additions & 36 deletions

File tree

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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
plugins {
77
alias(libs.plugins.google.protobuf)
88
checkstyle
9+
`maven-publish`
10+
}
11+
12+
java {
13+
withSourcesJar()
14+
withJavadocJar()
15+
}
16+
17+
// Prevent .proto files ending up in JARs
18+
tasks.jar {
19+
exclude("**/*.proto")
20+
includeEmptyDirs = false
921
}
1022

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

0 commit comments

Comments
 (0)