-
-
Notifications
You must be signed in to change notification settings - Fork 523
Refactor build and publishing setup #1409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
70b2e80
Migrate to Kotlin DSL and build version catalog
theimpulson 2dc75ed
Configure all javadoc tasks properly
theimpulson ea59782
Use the existing Gradle task to generate sources
theimpulson 77af123
Refactor and reconfigure publishing information for extractor
theimpulson 2dc56b6
Relocate testing configuration to extractor
theimpulson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de> | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.google.protobuf) apply false | ||
| } | ||
|
|
||
| allprojects { | ||
| apply(plugin = "java-library") | ||
|
|
||
| tasks.withType<JavaCompile> { | ||
| options.encoding = Charsets.UTF_8.toString() | ||
| } | ||
|
|
||
| extensions.configure<JavaPluginExtension> { | ||
| toolchain { | ||
| languageVersion.set(JavaLanguageVersion.of(11)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| subprojects { | ||
| // https://discuss.gradle.org/t/best-approach-gradle-multi-module-project-generate-just-one-global-javadoc/18657/21 | ||
| // Fixes unknown tag @implNote; the other two were added precautionary | ||
| tasks.withType<Javadoc>().configureEach { | ||
| (options as StandardJavadocDocletOptions).apply { | ||
| encoding = Charsets.UTF_8.toString() | ||
| links = listOf("https://docs.oracle.com/javase/11/docs/api/") | ||
| tags = listOf( | ||
| "apiNote:a:API Note:", | ||
| "implSpec:a:Implementation Requirements:", | ||
| "implNote:a:Implementation Note:" | ||
| ) | ||
| } | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| /* | ||
| * 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 | ||
| } | ||
theimpulson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // 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 | ||
| } | ||
|
|
||
| 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")) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # | ||
| # SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de> | ||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||
| # | ||
|
|
||
| [versions] | ||
| checkstyle = "10.26.1" | ||
| gson = "2.13.2" | ||
| jsr305 = "3.0.2" | ||
| junit = "5.14.1" | ||
| jsoup = "1.21.2" | ||
| okhttp = "5.3.2" | ||
| protobuf-lib = "4.33.2" | ||
| protobuf-plugin = "0.9.6" | ||
| rhino = "1.8.1" | ||
| teamnewpipe-nanojson = "e9d656ddb49a412a5a0a5d5ef20ca7ef09549996" | ||
|
|
||
| [libraries] | ||
| google-jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" } | ||
| google-gson = { module = "com.google.code.gson:gson", version.ref = "gson" } | ||
| google-protobuf = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf-lib" } | ||
| junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } | ||
| junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api" } | ||
| junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" } | ||
| junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" } | ||
| junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" } | ||
| jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } | ||
| mozilla-rhino-core = { module = "org.mozilla:rhino", version.ref = "rhino" } | ||
| mozilla-rhino-engine = { module = "org.mozilla:rhino-engine", version.ref = "rhino" } | ||
| newpipe-nanojson = { module = "com.github.TeamNewPipe:nanojson", version.ref = "teamnewpipe-nanojson" } | ||
| puppycrawl-checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } | ||
| squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } | ||
|
|
||
| [plugins] | ||
| google-protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.