-
-
Notifications
You must be signed in to change notification settings - Fork 543
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
151 lines (127 loc) · 4.21 KB
/
build.gradle.kts
File metadata and controls
151 lines (127 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
alias(libs.plugins.google.protobuf)
checkstyle
`maven-publish`
}
java {
withSourcesJar()
withJavadocJar()
}
// Protobuf files would uselessly end up in the JAR otherwise, see
// https://github.com/google/protobuf-gradle-plugin/issues/390
tasks.jar {
exclude("**/*.proto")
includeEmptyDirs = false
}
tasks.test {
// Test logging setup
testLogging {
events = setOf(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
// Pass on downloader type to tests for different CI jobs. See DownloaderFactory.java and ci.yml
if (System.getProperties().containsKey("downloader")) {
systemProperty("downloader", System.getProperty("downloader"))
}
useJUnitPlatform()
dependsOn(tasks.checkstyleMain) // run checkstyle when testing
}
// https://checkstyle.org/#JRE_and_JDK
tasks.withType<Checkstyle>().configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
}
checkstyle {
configDirectory = rootProject.file("checkstyle")
isIgnoreFailures = false
isShowViolations = true
toolVersion = libs.versions.checkstyle.get()
}
// Exclude Protobuf generated files from Checkstyle
tasks.checkstyleMain {
exclude("org/schabi/newpipe/extractor/services/youtube/protos")
}
tasks.checkstyleTest {
isEnabled = false // do not checkstyle test files
}
dependencies {
implementation(project(":timeago-parser"))
implementation(libs.newpipe.nanojson)
implementation(libs.jsoup)
implementation(libs.google.jsr305)
implementation(libs.google.protobuf)
implementation(libs.mozilla.rhino.core)
implementation(libs.mozilla.rhino.engine)
checkstyle(libs.puppycrawl.checkstyle)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.platform.launcher)
testRuntimeOnly(libs.junit.jupiter.engine)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.squareup.okhttp)
testImplementation(libs.google.gson)
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${libs.versions.protobuf.lib.get()}"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
named("java") {
option("lite")
}
}
}
}
}
// Run "./gradlew publishReleasePublicationToLocalRepository" to generate release JARs locally
publishing {
publications {
create<MavenPublication>("release") {
groupId = "net.newpipe"
artifactId = "extractor"
version = "v0.24.8"
afterEvaluate {
from(components["java"])
}
pom {
name = "NewPipe Extractor"
description = "A library for extracting data from streaming websites, used in NewPipe"
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
licenses {
license {
name = "GNU GENERAL PUBLIC LICENSE, Version 3"
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
}
}
scm {
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
connection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
developerConnection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
}
developers {
developer {
id = "newpipe"
name = "Team NewPipe"
email = "team@newpipe.net"
}
}
}
}
repositories {
maven {
name = "local"
url = uri(layout.buildDirectory.dir("maven"))
}
}
}
}