diff --git a/build.gradle.kts b/build.gradle.kts index 72ec308b..dee8ec5a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -93,7 +93,6 @@ val dependentCompositeTasks = setOf( "setSnapshotVersion", "setReleaseVersion", "publishToMavenLocal", - "publishAllPublicationsToOSSRHSnapshotRepository", "publishAllPublicationsToOSSRHReleaseRepository", ) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ebcfe519..cf8e4b48 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -8,7 +8,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the Lice nse is distributed on an "AS IS" BASIS, + * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. diff --git a/docs/QUICKSTART.md b/docs/QUICKSTART.md index bf04816f..7982453c 100644 --- a/docs/QUICKSTART.md +++ b/docs/QUICKSTART.md @@ -163,15 +163,10 @@ dependencies { ksp("org.eclipse.kuksa:vss-processor:") } -// Copies the given specification file to the KSP processor -tasks.register("ProvideVssDefinition") { - val vssDefinitionFilePath = "$projectDir/src/main/assets/" - val regularFile = RegularFile { File(vssDefinitionFilePath) } - vssDefinitionFile.add(regularFile) -} - -tasks.withType { - dependsOn(tasks.withType()) +// Optional - See plugin documentation. Files inside the main assets are used automatically. +vssProcessor { + searchPath = "$projectDir/src/main/assets" + fileName = "vss_rel_4.0.yaml" } ``` diff --git a/kuksa-sdk/build.gradle.kts b/kuksa-sdk/build.gradle.kts index d26ed2ce..dbfe1be4 100644 --- a/kuksa-sdk/build.gradle.kts +++ b/kuksa-sdk/build.gradle.kts @@ -122,5 +122,3 @@ protobuf { } } } - - diff --git a/settings.gradle.kts b/settings.gradle.kts index 92ea4cd7..d0d432c5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -28,7 +28,7 @@ pluginManagement { plugins { id("com.google.devtools.ksp") version "1.9.0-1.0.11" - id("org.eclipse.kuksa.vss-processor-plugin") version "0.1.3" + id("org.eclipse.kuksa.vss-processor-plugin") // Always take the newest version since it's locally included kotlin("jvm") version "1.9.0-1.0.11" kotlin("plugin.serialization") version "1.9.0" } diff --git a/vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt b/vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt index d1418e03..d88c73bb 100644 --- a/vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt +++ b/vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt @@ -32,14 +32,10 @@ package org.eclipse.kuksa.vsscore.annotation * id("org.eclipse.kuksa.vss-processor-plugin") version "" * } * - * tasks.register("ProvideVssDefinition") { - * val vssDefinitionFilePath = "$projectDir/src/main/assets/vss_rel_4.0.yaml" - * val regularFile = RegularFile { File(vssDefinitionFilePath) } - * vssDefinitionFile.add(regularFile) - * } - * - * tasks.withType { - * dependsOn(tasks.withType()) + * // Optional - See plugin documentation. Files inside the main assets are used automatically. + * vssProcessor { + * searchPath = "$projectDir/src/main/assets" + * fileName = "vss_rel_4.0.yaml" * } * ``` * diff --git a/vss-processor-plugin/build.gradle.kts b/vss-processor-plugin/build.gradle.kts index 09ac1027..4938a919 100644 --- a/vss-processor-plugin/build.gradle.kts +++ b/vss-processor-plugin/build.gradle.kts @@ -21,7 +21,6 @@ plugins { alias(libs.plugins.pluginPublishing) signing `kotlin-dsl` -// publish version } @@ -56,15 +55,8 @@ afterEvaluate { password = System.getenv("ORG_OSSRH_PASSWORD") } } - maven { - name = "OSSRHSnapshot" - - url = uri("https://oss.sonatype.org/content/repositories/snapshots/") - credentials { - username = System.getenv("ORG_OSSRH_USERNAME") - password = System.getenv("ORG_OSSRH_PASSWORD") - } - } + // Snapshot are disabled for Plugins since the plugin marker has issues finding the correct jar with the + // automatic timestamps / build number being added as a postfix to the files. } publications { getByName("pluginMaven") { diff --git a/vss-processor-plugin/buildSrc/src/main/kotlin/publish.gradle.kts b/vss-processor-plugin/buildSrc/src/main/kotlin/publish.gradle.kts deleted file mode 100644 index c1ffd499..00000000 --- a/vss-processor-plugin/buildSrc/src/main/kotlin/publish.gradle.kts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * - */ - -plugins { -// id("com.gradle.plugin-publish") - signing -} - -interface PublishPluginExtension { - val description: Property -} - -val extension = project.extensions.create("publish") - -//afterEvaluate { -// publishing { -// repositories { -// maven { -// name = "OSSRHRelease" -// -// url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") -// credentials { -// username = System.getenv("ORG_OSSRH_USERNAME") -// password = System.getenv("ORG_OSSRH_PASSWORD") -// } -// } -// maven { -// name = "OSSRHSnapshot" -// -// url = uri("https://oss.sonatype.org/content/repositories/snapshots/") -// credentials { -// username = System.getenv("ORG_OSSRH_USERNAME") -// password = System.getenv("ORG_OSSRH_PASSWORD") -// } -// } -// } -// publications { -// getByName("pluginMaven") { -// pom { -// name = "${project.group}:${project.name}" -// description = extension.description.get() -// url = "https://github.com/eclipse-kuksa/kuksa-android-sdk" -// licenses { -// license { -// name.set("The Apache Software License, Version 2.0") -// url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") -// } -// } -// developers { -// developer { -// name = "Mark Hüsers" -// email = "mark.huesers@etas.com" -// organization = "ETAS GmbH" -// organizationUrl = "https://www.etas.com" -// } -// developer { -// name = "Sebastian Schildt" -// email = "sebastian.schildt@etas.com" -// organization = "ETAS GmbH" -// organizationUrl = "https://www.etas.com" -// } -// developer { -// name = "Andre Weber" -// email = "andre.weber3@etas.com" -// organization = "ETAS GmbH" -// organizationUrl = "https://www.etas.com" -// } -// } -// scm { -// connection.set("scm:git:github.com/eclipse-kuksa/kuksa-android-sdk.git") -// developerConnection.set("scm:git:ssh://github.com/eclipse-kuksa/kuksa-android-sdk.git") -// url.set("https://github.com/eclipse-kuksa/kuksa-android-sdk/tree/main") -// } -// } -// } -// } -// } -// -// signing { -// var keyId: String? = System.getenv("ORG_GPG_KEY_ID") -// if (keyId != null && keyId.length > 8) { -// keyId = keyId.takeLast(8) -// } -// val privateKey = System.getenv("ORG_GPG_PRIVATE_KEY") -// val passphrase = System.getenv("ORG_GPG_PASSPHRASE") -// -// useInMemoryPgpKeys( -// keyId, -// privateKey, -// passphrase, -// ) -// } -//} - -//gradlePlugin { -// website = "" -// vcsUrl = "" -//} diff --git a/vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt b/vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt index 092b142d..3055957e 100644 --- a/vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt +++ b/vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt @@ -48,11 +48,12 @@ internal constructor(objectFactory: ObjectFactory) { val fileName: Property = objectFactory.property(String::class.java).convention("") } +private val fileSeparator = File.separator + /** * This Plugin searches for compatible specification files and copies them into an input folder for the * KSP VSS Processor. This is necessary because the Symbol Processor does not have access to the android assets folder. * The default search path is the main assets folder. - * */ class VssProcessorPlugin : Plugin { override fun apply(project: Project) { @@ -64,10 +65,10 @@ class VssProcessorPlugin : Plugin { val compatibleFiles = findFiles( directory = searchDirectory, fileName = extension.fileName.get(), - validExtensions = compatibleExtensions + validExtensions = compatibleExtensions, ) - val provideVssDefinitionTask = project.tasks.register("ProvideVssDefinition") { + val provideVssDefinitionTask = project.tasks.register(PROVIDE_VSS_DEFINITION_TASK) { compatibleFiles.forEach { definitionFile -> val regularFile = RegularFile { definitionFile } vssDefinitionFiles.add(regularFile) @@ -75,10 +76,11 @@ class VssProcessorPlugin : Plugin { } project.tasks.getByName("preBuild").finalizedBy( - provideVssDefinitionTask.get() + provideVssDefinitionTask.get(), ) } + @Suppress("SameParameterValue") private fun findFiles( directory: String, fileName: String = "", @@ -98,42 +100,22 @@ class VssProcessorPlugin : Plugin { companion object { private const val EXTENSION_NAME = "vssProcessor" + private const val PROVIDE_VSS_DEFINITION_TASK = "ProvideVssDefinition" private val compatibleExtensions = setOf("yaml") - private val fileSeparator = File.separator private val mainAssetsDirectory = "src$fileSeparator" + "main$fileSeparator" + "assets" } } +/** + * This task takes a collection of files + */ abstract class ProvideVssDefinitionTask : DefaultTask() { - @get:InputFiles abstract val vssDefinitionFiles: ListProperty @TaskAction fun provideFile() { -// val buildDirPath = project.buildDir.absolutePath -// val mainAssets = "${project.projectDir}$fileSeparator$mainAssetsDirectory" -// val mainAssetsFolder = File(mainAssets) - -// mainAssetsFolder -// .walk() -// .filter { compatibleExtensions.contains(it.extension) } -// .forEach { vssDefinitionInputFile -> -// val vssDefinitionBuildFile = File( -// "$buildDirPath$fileSeparator" + -// "$KSP_INPUT_BUILD_DIRECTORY$fileSeparator" + -// vssDefinitionInputFile.name, -// ) -// -// println( -// "Found VSS definition input file: ${vssDefinitionInputFile.name}, " + -// "copying to: $vssDefinitionBuildFile", -// ) -// -// vssDefinitionInputFile.copyTo(vssDefinitionBuildFile, true) -// } - val buildDirPath = project.buildDir.absolutePath vssDefinitionFiles.get().forEach { file -> val vssDefinitionInputFile = file.asFile @@ -152,7 +134,5 @@ abstract class ProvideVssDefinitionTask : DefaultTask() { companion object { private const val KSP_INPUT_BUILD_DIRECTORY = "kspInput" - - private val fileSeparator = File.separator } }