-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: prepare for 2.0.0-rc01 release
- Adds maven publishing configuration for both the library and the Gradle plugin. - Updates the version in `app.properties` to `2.0.0-rc01`. - Adds necessary metadata to the POM files, including project description, licenses, developers, and SCM information. - Configures publishing to Maven Central using the SonatypeHost.CENTRAL_PORTAL. - Adds signing for all publications. - Makes the `main` function in `Main.kt` private, as it's only for debugging purposes. - Refactors project properties into a dedicated class.
- Loading branch information
1 parent
7a4bc00
commit f81fd84
Showing
11 changed files
with
124 additions
and
39 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,7 @@ temp.kt | |
integrity-check/ | ||
local.properties | ||
.s2c/ | ||
publishing.properties | ||
|
||
github_issue_[0-9]*.svg | ||
|
||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
VERSION=2.0.0-alpha01 | ||
VERSION=2.0.0-rc01 |
1 change: 0 additions & 1 deletion
1
buildSrc/src/main/kotlin/dev.tonholo.s2c.conventions.common.gradle.kts
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
1 change: 1 addition & 0 deletions
1
buildSrc/src/main/kotlin/dev.tonholo.s2c.conventions.gradle.plugin.gradle.kts
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
41 changes: 5 additions & 36 deletions
41
buildSrc/src/main/kotlin/dev/tonholo/s2c/conventions/AppProperties.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 |
---|---|---|
@@ -1,45 +1,14 @@ | ||
package dev.tonholo.s2c.conventions | ||
|
||
import org.gradle.api.Project | ||
import java.io.IOException | ||
import java.util.Properties | ||
|
||
private const val GROUP = "dev.tonholo.s2c" | ||
|
||
internal object AppProperties { | ||
private var _appProperties: Properties? = null | ||
private val appProperties | ||
get() = requireNotNull(_appProperties) { | ||
"Missing app.properties initialization. " + | ||
"Did you miss applying the 'dev.tonholo.s2c.conventions.common' in the current project?" | ||
} | ||
internal object AppProperties : ProjectProperties( | ||
propertiesName = "app.properties", | ||
ownerPluginName = "dev.tonholo.s2c.conventions.common", | ||
) { | ||
val group: String get() = GROUP | ||
val version: String | ||
get() = requireNotNull(appProperties["VERSION"]?.toString()) { | ||
get() = requireNotNull(properties["VERSION"]?.toString()) { | ||
"VERSION property not found in app.properties" | ||
} | ||
|
||
fun init(project: Project) { | ||
val propertiesFile = project | ||
.file("app.properties") | ||
.takeIf { it.exists() } | ||
check(propertiesFile != null) { | ||
"The app.properties file is missing in the root project." | ||
} | ||
try { | ||
propertiesFile | ||
.reader() | ||
.use { reader -> | ||
_appProperties = Properties().apply { load(reader) } | ||
} | ||
} catch (e: IOException) { | ||
throw IllegalStateException("Failed to read properties from app.properties", e) | ||
} | ||
} | ||
|
||
inline fun forEach(action: (Map.Entry<String, Any>) -> Unit) { | ||
appProperties | ||
.mapKeys { (key, _) -> key.toString() } | ||
.forEach(action) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
buildSrc/src/main/kotlin/dev/tonholo/s2c/conventions/ProjectProperties.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,41 @@ | ||
package dev.tonholo.s2c.conventions | ||
|
||
import org.gradle.api.Project | ||
import java.io.IOException | ||
import java.util.Properties | ||
|
||
internal abstract class ProjectProperties( | ||
private val propertiesName: String, | ||
private val ownerPluginName: String, | ||
) { | ||
private var _properties: Properties? = null | ||
val properties | ||
get() = requireNotNull(_properties) { | ||
"Missing app.properties initialization. " + | ||
"Did you miss applying the '$ownerPluginName' in the current project?" | ||
} | ||
|
||
open fun init(project: Project) { | ||
val propertiesFile = project | ||
.file(propertiesName) | ||
.takeIf { it.exists() } | ||
check(propertiesFile != null) { | ||
"The $propertiesName file is missing in the root project." | ||
} | ||
try { | ||
propertiesFile | ||
.reader() | ||
.use { reader -> | ||
_properties = Properties().apply { load(reader) } | ||
} | ||
} catch (e: IOException) { | ||
throw IllegalStateException("Failed to read properties from app.properties", e) | ||
} | ||
} | ||
|
||
inline fun forEach(action: (Map.Entry<String, Any>) -> Unit) { | ||
properties | ||
.mapKeys { (key, _) -> key.toString() } | ||
.forEach(action) | ||
} | ||
} |
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