Skip to content

Commit f40f4db

Browse files
committed
1 parent 31edd9f commit f40f4db

File tree

11 files changed

+242
-172
lines changed

11 files changed

+242
-172
lines changed

build.gradle

Lines changed: 0 additions & 91 deletions
This file was deleted.

build.gradle.kts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
7+
import org.gradle.api.tasks.testing.logging.TestLogEvent
8+
9+
plugins {
10+
alias(libs.plugins.google.protobuf) apply false
11+
}
12+
13+
allprojects {
14+
apply(plugin = "java-library")
15+
apply(plugin = "maven-publish")
16+
17+
tasks.withType<JavaCompile> {
18+
options.encoding = Charsets.UTF_8.toString()
19+
}
20+
21+
extensions.configure<JavaPluginExtension> {
22+
toolchain {
23+
languageVersion.set(JavaLanguageVersion.of(11))
24+
}
25+
}
26+
27+
version = "v0.24.8"
28+
group = "com.github.TeamNewPipe"
29+
30+
afterEvaluate {
31+
extensions.configure<PublishingExtension>("publishing") {
32+
publications {
33+
create<MavenPublication>("mavenJava") {
34+
from(components["java"])
35+
}
36+
}
37+
}
38+
}
39+
}
40+
41+
subprojects {
42+
43+
// sourcesJar task
44+
val sourcesJar by tasks.registering(Jar::class) {
45+
dependsOn("classes")
46+
archiveClassifier.set("sources")
47+
from(provider { the<JavaPluginExtension>().sourceSets["main"].allSource })
48+
}
49+
50+
// Prevent .proto files ending up in JARs
51+
tasks.withType<Jar>().configureEach {
52+
exclude("**/*.proto")
53+
includeEmptyDirs = false
54+
}
55+
56+
// Test logging setup
57+
tasks.withType<Test>().configureEach {
58+
testLogging {
59+
events = setOf(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
60+
showStandardStreams = true
61+
exceptionFormat = TestExceptionFormat.FULL
62+
}
63+
}
64+
65+
// Register sources JAR as artifact
66+
artifacts {
67+
add("archives", sourcesJar)
68+
}
69+
}
70+
71+
// https://discuss.gradle.org/t/best-approach-gradle-multi-module-project-generate-just-one-global-javadoc/18657/21
72+
tasks.register<Javadoc>("aggregatedJavadocs") {
73+
title = "${project.name} ${project.version}"
74+
setDestinationDir(layout.buildDirectory.dir("docs/javadoc").get().asFile)
75+
76+
(options as StandardJavadocDocletOptions).apply {
77+
encoding = Charsets.UTF_8.toString()
78+
links = listOf("https://docs.oracle.com/javase/11/docs/api/")
79+
tags = listOf(
80+
"apiNote:a:API Note:",
81+
"implSpec:a:Implementation Requirements:",
82+
"implNote:a:Implementation Note:"
83+
)
84+
}
85+
86+
subprojects.forEach { subProject ->
87+
subProject.tasks.withType<Javadoc>().forEach { javadocTask ->
88+
source = javadocTask.source
89+
classpath += javadocTask.classpath
90+
excludes += javadocTask.excludes
91+
includes += javadocTask.includes
92+
}
93+
}
94+
}

extractor/build.gradle

Lines changed: 0 additions & 71 deletions
This file was deleted.

extractor/build.gradle.kts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
plugins {
7+
alias(libs.plugins.google.protobuf)
8+
checkstyle
9+
}
10+
11+
tasks.test {
12+
// Pass on downloader type to tests for different CI jobs.
13+
if (System.getProperties().containsKey("downloader")) {
14+
systemProperty("downloader", System.getProperty("downloader"))
15+
}
16+
useJUnitPlatform()
17+
dependsOn(tasks.checkstyleMain) // run checkstyle when testing
18+
}
19+
20+
checkstyle {
21+
configDirectory = rootProject.file("checkstyle")
22+
isIgnoreFailures = false
23+
isShowViolations = true
24+
toolVersion = libs.versions.checkstyle.get()
25+
}
26+
27+
// Exclude Protobuf generated files from Checkstyle
28+
tasks.checkstyleMain {
29+
exclude("org/schabi/newpipe/extractor/services/youtube/protos")
30+
}
31+
32+
tasks.checkstyleTest {
33+
isEnabled = false // do not checkstyle test files
34+
}
35+
36+
dependencies {
37+
implementation(project(":timeago-parser"))
38+
39+
implementation(libs.newpipe.nanojson)
40+
implementation(libs.jsoup)
41+
implementation(libs.google.jsr305)
42+
implementation(libs.google.protobuf)
43+
44+
implementation(libs.mozilla.rhino.core)
45+
implementation(libs.mozilla.rhino.engine)
46+
47+
checkstyle(libs.puppycrawl.checkstyle)
48+
49+
testImplementation(platform(libs.junit.bom))
50+
testImplementation(libs.junit.jupiter.api)
51+
testRuntimeOnly(libs.junit.platform.launcher)
52+
testRuntimeOnly(libs.junit.jupiter.engine)
53+
testImplementation(libs.junit.jupiter.params)
54+
55+
testImplementation(libs.squareup.okhttp)
56+
testImplementation(libs.google.gson)
57+
}
58+
59+
protobuf {
60+
protoc {
61+
artifact = "com.google.protobuf:protoc:${libs.versions.protobuf.lib.get()}"
62+
}
63+
64+
generateProtoTasks {
65+
all().forEach { task ->
66+
task.builtins {
67+
named("java") {
68+
option("lite")
69+
}
70+
}
71+
}
72+
}
73+
}

gradle/libs.versions.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
#
5+
6+
[versions]
7+
checkstyle = "10.26.1"
8+
gson = "2.13.2"
9+
jsr305 = "3.0.2"
10+
junit = "5.14.1"
11+
jsoup = "1.21.2"
12+
okhttp = "4.12.0"
13+
protobuf-lib = "4.33.1"
14+
protobuf-plugin = "0.9.5"
15+
rhino = "1.8.0"
16+
teamnewpipe-nanojson = "e9d656ddb49a412a5a0a5d5ef20ca7ef09549996"
17+
18+
[libraries]
19+
google-jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" }
20+
google-gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
21+
google-protobuf = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf-lib" }
22+
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
23+
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" }
24+
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
25+
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
26+
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
27+
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
28+
mozilla-rhino-core = { module = "org.mozilla:rhino", version.ref = "rhino" }
29+
mozilla-rhino-engine = { module = "org.mozilla:rhino-engine", version.ref = "rhino" }
30+
newpipe-nanojson = { module = "com.github.TeamNewPipe:nanojson", version.ref = "teamnewpipe-nanojson" }
31+
puppycrawl-checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
32+
squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
33+
34+
[plugins]
35+
google-protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" }

settings.gradle

Lines changed: 0 additions & 2 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
pluginManagement {
7+
repositories {
8+
gradlePluginPortal()
9+
google()
10+
mavenCentral()
11+
}
12+
}
13+
dependencyResolutionManagement {
14+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
15+
repositories {
16+
google()
17+
mavenCentral()
18+
maven(url = "https://jitpack.io")
19+
}
20+
}
21+
include("extractor", "timeago-parser", "timeago-generator")
22+
rootProject.name = "NewPipeExtractor"

0 commit comments

Comments
 (0)