-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): move
build.gradle
to Kotlin DSL. Also move srtdroid
…
…package to `srtdroid-core`
- Loading branch information
1 parent
463b4d5
commit 841dc47
Showing
103 changed files
with
687 additions
and
521 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
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
import org.jetbrains.dokka.DokkaConfiguration.Visibility | ||
import org.jetbrains.dokka.gradle.DokkaTaskPartial | ||
import java.net.URL | ||
|
||
plugins { | ||
alias(libs.plugins.androidApplication).apply(false) | ||
alias(libs.plugins.jetbrainsKotlinAndroid).apply(false) | ||
alias(libs.plugins.androidLibrary).apply(false) | ||
alias(libs.plugins.dokka) | ||
} | ||
|
||
allprojects { | ||
group = "io.github.thibaultbee.srtdroid" | ||
version = "1.7.0" | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "org.jetbrains.dokka") | ||
|
||
tasks.withType<DokkaTaskPartial>().configureEach { | ||
dokkaSourceSets.configureEach { | ||
documentedVisibilities.set( | ||
setOf( | ||
Visibility.PUBLIC, | ||
Visibility.PROTECTED | ||
) | ||
) | ||
|
||
sourceLink { | ||
localDirectory.set(projectDir.resolve("src")) | ||
remoteUrl.set(URL("https://github.com/ThibaultBee/srtdroid/${project.name}/src")) | ||
remoteLineSuffix.set("#L") | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
/build |
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,23 @@ | ||
import org.gradle.kotlin.dsl.`kotlin-dsl` | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
gradlePluginPortal() | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
jvmTarget = "11" | ||
} | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} |
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,49 @@ | ||
object AndroidVersions { | ||
const val MIN_SDK = 19 | ||
const val TARGET_SDK = 34 | ||
const val COMPILE_SDK = 34 | ||
} | ||
|
||
object Publication { | ||
object Repository { | ||
val username: String? | ||
get() = Property.get(Property.SonatypeUsername) | ||
val password: String? | ||
get() = Property.get(Property.SonatypePassword) | ||
} | ||
|
||
object Pom { | ||
const val PACKAGING = "aar" | ||
const val URL = "https://github.com/ThibaultBee/srtdroid" | ||
|
||
object Scm { | ||
const val CONNECTION = "scm:git:git://github.com/ThibaultBee/srtdroid.git" | ||
const val DEVELOPER_CONNECTION = | ||
"scm:git:ssh://github.com/ThibaultBee/srtdroid.git" | ||
const val URL = "https://github.com/ThibaultBee/srtdroid" | ||
} | ||
|
||
object License { | ||
const val NAME = "Apache License, Version 2.0" | ||
const val URL = "https://www.apache.org/licenses/LICENSE-2.0.txt" | ||
const val DISTRIBUTION = "repo" | ||
} | ||
|
||
object Developer { | ||
const val URL = "https://github.com/ThibaultBee" | ||
const val NAME = "Thibault B." | ||
} | ||
} | ||
|
||
object Signing { | ||
val hasKey: Boolean | ||
get() = key != null && keyId != null && password != null | ||
|
||
val key: String? | ||
get() = Property.get(Property.GpgKey) | ||
val password: String? | ||
get() = Property.get(Property.GpgPassword) | ||
val keyId: String? | ||
get() = Property.get(Property.GpgKeyId) | ||
} | ||
} |
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,12 @@ | ||
enum class Property(val key: String) { | ||
SonatypeUsername("NEXUS_USERNAME"), | ||
SonatypePassword("NEXUS_PASSWORD"), | ||
GpgKey("GPG_KEY"), | ||
GpgKeyId("GPG_KEY_ID"), | ||
GpgPassword("GPG_PASSWORD"); | ||
|
||
companion object { | ||
fun get(property: Property): String? = | ||
System.getProperty(property.key) ?: System.getenv(property.key) | ||
} | ||
} |
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,98 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPom | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.kotlin.dsl.apply | ||
import org.gradle.kotlin.dsl.create | ||
import org.gradle.kotlin.dsl.the | ||
import org.gradle.plugins.signing.SigningExtension | ||
|
||
fun Project.configurePublication() { | ||
apply(plugin = "maven-publish") | ||
apply(plugin = "com.android.library") | ||
|
||
the<PublishingExtension>().apply { | ||
publications.create<MavenPublication>("release") { | ||
afterEvaluate { | ||
if (isAndroid) { | ||
from(components.getByName("release")) | ||
} else { | ||
from(components.getByName("java")) | ||
} | ||
} | ||
|
||
createPom { | ||
name.set(project.name) | ||
description.set(project.description) | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
if (isRelease) { | ||
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
} else { | ||
println("Using SNAPSHOT repository") | ||
setUrl("https://oss.sonatype.org/content/repositories/snapshots/") | ||
} | ||
|
||
credentials { | ||
username = Publication.Repository.username | ||
password = Publication.Repository.password | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (Publication.Signing.hasKey) { | ||
println("Signing publication") | ||
apply(plugin = "signing") | ||
|
||
the<SigningExtension>().apply { | ||
useInMemoryPgpKeys( | ||
Publication.Signing.keyId, | ||
Publication.Signing.key, | ||
Publication.Signing.password | ||
) | ||
sign(the<PublishingExtension>().publications) | ||
} | ||
} else { | ||
println("No signing key found. Publication will not be signed.") | ||
} | ||
} | ||
|
||
val Project.isRelease: Boolean | ||
get() = version.toString().endsWith("-SNAPSHOT").not() | ||
|
||
val Project.isAndroid: Boolean | ||
get() = project.hasProperty("android") | ||
|
||
fun MavenPublication.createPom( | ||
configure: MavenPom.() -> Unit = {} | ||
): Unit = | ||
pom { | ||
url.set(Publication.Pom.URL) | ||
packaging = Publication.Pom.PACKAGING | ||
|
||
scm { | ||
connection.set(Publication.Pom.Scm.CONNECTION) | ||
developerConnection.set(Publication.Pom.Scm.DEVELOPER_CONNECTION) | ||
url.set(Publication.Pom.Scm.URL) | ||
} | ||
|
||
developers { | ||
developer { | ||
name.set(Publication.Pom.Developer.NAME) | ||
url.set(Publication.Pom.Developer.URL) | ||
} | ||
} | ||
|
||
licenses { | ||
license { | ||
name.set(Publication.Pom.License.NAME) | ||
url.set(Publication.Pom.License.URL) | ||
distribution.set(Publication.Pom.License.DISTRIBUTION) | ||
} | ||
} | ||
configure() | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.