Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Dec 8, 2024
1 parent 2083d50 commit e3e37e0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 67 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
lib = "2.0.0-alpha-09-SNAPSHOT"
lib = "2.0.0-alpha-09"
android = "8.4.2"
auto-service = "1.1.1"
kotlin = "2.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ open class SekretPlugin : Plugin<Project> {
}

companion object {
private const val VERSION = "2.0.0-alpha-09-SNAPSHOT"
private const val VERSION = "2.0.0-alpha-09"

internal fun getVersion(): String {
return runCatching {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ object BuildFileGenerator {
version: String = SekretPlugin.getVersion(),
targets: Iterable<Target>,
packageName: String,
versionCatalogSekretDependency: String?,
outputDir: File,
overwrite: Boolean = false
) {
Expand All @@ -23,7 +22,6 @@ object BuildFileGenerator {
.addSourceSets(
version = version,
commonJS = targets.any { it.isJS },
versionCatalogSekretDependency = versionCatalogSekretDependency,
sourceSets = targets.toSet()
)
.endControlFlow()
Expand Down Expand Up @@ -64,7 +62,6 @@ object BuildFileGenerator {
private fun FileSpec.Builder.addSourceSets(
version: String,
commonJS: Boolean,
versionCatalogSekretDependency: String?,
sourceSets: Set<Target>
): FileSpec.Builder {
var spec = this
Expand Down Expand Up @@ -93,7 +90,7 @@ object BuildFileGenerator {
spec = spec.beginControlFlow("sourceSets")

spec = spec.beginControlFlow("commonMain.dependencies")
spec = spec.addStatement("api(%S)", versionCatalogSekretDependency ?: "dev.datlag.sekret:sekret:$version")
spec = spec.addStatement("api(%S)", "dev.datlag.sekret:sekret:$version")
spec = spec.endControlFlow()
spec = spec.addStatement("")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package dev.datlag.sekret.gradle.tasks

import dev.datlag.sekret.gradle.SekretPlugin
import dev.datlag.sekret.gradle.SekretPluginExtension
import dev.datlag.sekret.gradle.Target
import dev.datlag.sekret.gradle.common.*
import dev.datlag.sekret.gradle.common.sekretExtension
import dev.datlag.sekret.gradle.common.targetsMapped
import dev.datlag.sekret.gradle.extension.PropertiesExtension
Expand All @@ -14,14 +12,11 @@ import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.ProjectLayout
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import java.io.File
import javax.inject.Inject

Expand All @@ -36,18 +31,6 @@ open class GenerateSekretBuildScriptTask : DefaultTask() {
@get:Input
open val targets: SetProperty<Target> = project.objects.setProperty(Target::class.java)

@get:Input
open val hasVersionCatalogs: Property<Boolean> = project.objects.property(Boolean::class.java)

@get:Input
open val usesVersionCatalogForPlugin: Property<Boolean> = project.objects.property(Boolean::class.java)

@get:Input
open val versionCatalogName: Property<String> = project.objects.property(String::class.java)

@get:Input
open val versionCatalogLibraryAlias: Property<String> = project.objects.property(String::class.java)

@get:OutputDirectory
open val outputDirectory: DirectoryProperty = project.objects.directoryProperty()

Expand Down Expand Up @@ -81,21 +64,9 @@ open class GenerateSekretBuildScriptTask : DefaultTask() {
logger.log(logLevel, "Following targets are used/required depending on your configuration: ${requiredTargets.joinToString { it.name }}.")
logger.log(logLevel, "Please report if you encounter any missing target.")

val hasVersionCatalogs = hasVersionCatalogs.getOrElse(false) ?: false
val usesVersionCatalogForPlugin = usesVersionCatalogForPlugin.getOrElse(false) ?: false

if (hasVersionCatalogs && !usesVersionCatalogForPlugin) {
logger.log(LogLevel.WARN, "Seems like you use version catalogs but not for the sekret plugin.")
}

BuildFileGenerator.generate(
targets = requiredTargets,
packageName = packageName.getOrElse(PropertiesExtension.sekretPackageName),
versionCatalogSekretDependency = versionCatalogLibraryAlias.orNull?.ifBlank { null }?.let { lib ->
versionCatalogName.orNull?.ifBlank { null }?.let { catalog ->
"${catalog}.${lib}"
}
},
outputDir = ModuleGenerator.createBase(outputDir),
overwrite = true
)
Expand All @@ -109,18 +80,6 @@ open class GenerateSekretBuildScriptTask : DefaultTask() {
targets.set(project.provider {
project.targetsMapped
})
hasVersionCatalogs.set(project.provider {
project.hasVersionCatalogs
})
usesVersionCatalogForPlugin.set(project.provider {
project.hasSekretVersionCatalog
})
versionCatalogName.set(project.provider {
project.sekretVersionCatalog?.name
})
versionCatalogLibraryAlias.set(project.provider {
project.sekretVersionCatalog?.sekretLibraryAlias
})

outputDirectory.set(project.findProject("sekret")?.projectDir ?: File(project.projectDir, "sekret"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.ProjectLayout
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import java.io.File
import javax.inject.Inject

Expand All @@ -40,12 +37,6 @@ open class GenerateSekretTask : DefaultTask() {
@get:Input
open val targets: SetProperty<Target> = project.objects.setProperty(Target::class.java)

@get:Input
open val versionCatalogName: Property<String> = project.objects.property(String::class.java)

@get:Input
open val versionCatalogLibraryAlias: Property<String> = project.objects.property(String::class.java)

@get:Input
open val encryptionKey: Property<String> = project.objects.property(String::class.java)

Expand Down Expand Up @@ -89,11 +80,6 @@ open class GenerateSekretTask : DefaultTask() {
BuildFileGenerator.generate(
targets = requiredTargets,
packageName = packageName.getOrElse(PropertiesExtension.sekretPackageName),
versionCatalogSekretDependency = versionCatalogLibraryAlias.orNull?.ifBlank { null }?.let { lib ->
versionCatalogName.orNull?.ifBlank { null }?.let { catalog ->
"${catalog}.${lib}"
}
},
outputDir = sekretDir,
overwrite = false
)
Expand Down Expand Up @@ -144,12 +130,6 @@ open class GenerateSekretTask : DefaultTask() {
targets.set(project.provider {
project.targetsMapped
})
versionCatalogName.set(project.provider {
project.sekretVersionCatalog?.name
})
versionCatalogLibraryAlias.set(project.provider {
project.sekretVersionCatalog?.sekretLibraryAlias
})

encryptionKey.set(extension.properties.encryptionKey)
outputDirectory.set(project.findProject("sekret")?.projectDir ?: File(project.projectDir, "sekret"))
Expand Down

0 comments on commit e3e37e0

Please sign in to comment.