-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve publishing configuration (#468)
- Loading branch information
Showing
10 changed files
with
107 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,6 @@ plugins { | |
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
dependencies { | ||
api(libs.android.gradle.api) | ||
} |
This file contains 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,19 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
|
||
dependencyResolutionManagement { | ||
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
This file contains 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
60 changes: 60 additions & 0 deletions
60
buildSrc/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxPublishingPlugin.kt
This file contains 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,60 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.gradle | ||
|
||
import VersionConfig | ||
import com.android.build.api.dsl.LibraryExtension | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.get | ||
import org.gradle.kotlin.dsl.register | ||
|
||
/** | ||
* Custom Gradle plugin to manage publication of a Pillarbox's library modules. | ||
*/ | ||
class PillarboxPublishingPlugin : Plugin<Project> { | ||
override fun apply(target: Project) = with(target) { | ||
pluginManager.apply("com.android.library") | ||
pluginManager.apply("org.gradle.maven-publish") | ||
|
||
extensions.configure<LibraryExtension> { | ||
defaultConfig { | ||
group = "ch.srgssr.pillarbox" | ||
version = VersionConfig.versionName() | ||
} | ||
|
||
publishing { | ||
singleVariant("release") { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
} | ||
} | ||
|
||
extensions.configure<PublishingExtension> { | ||
publications { | ||
register<MavenPublication>("gpr") { | ||
afterEvaluate { | ||
from(components["release"]) | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/SRGSSR/pillarbox-android") | ||
credentials { | ||
username = findProperty("gpr.user") as String? ?: System.getenv("USERNAME") | ||
password = findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...c/main/resources/META-INF/gradle-plugins/ch.srgssr.pillarbox.gradle.publishing.properties
This file contains 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 @@ | ||
implementation-class=ch.srgssr.pillarbox.gradle.PillarboxPublishingPlugin |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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