@@ -18,6 +18,7 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
1818import org.gradle.api.attributes.*
1919import org.gradle.api.component.AdhocComponentWithVariants
2020import org.gradle.api.plugins.JavaPluginExtension
21+ import org.gradle.api.provider.*
2122import org.gradle.api.tasks.*
2223import org.gradle.api.tasks.compile.JavaCompile
2324import org.gradle.api.tasks.testing.*
@@ -59,25 +60,28 @@ val Project.buildLogicProjectName
5960val Project .isSharedProject
6061 get() = name == sharedProjectName
6162
62- // val debug: String? by project
63- val Project .debugEnabled
64- get() = providers.gradleProperty(" debug" ).map(String ::toBoolean).getOrElse(false )
65-
6663val Project .skipTest
67- get() = providers.gradleProperty (" skip.test" ).map( String ::toBoolean).getOrElse( false )
64+ get() = gradleBooleanProperty (" skip.test" ).get( )
6865
6966val Project .hasCleanTask
7067 get() = gradle.startParameter.taskNames.any { it in listOf (" clean" , " cleanAll" ) }
7168
72- val Project .isSnapshotVersion
73- get() = version.toString().endsWith(" SNAPSHOT" , true )
74-
7569val Project .runsOnCI
7670 get() = providers.environmentVariable(" CI" ).isPresent
7771
72+ // val debug: String? by project
73+ val Project .debugEnabled
74+ get() = gradleBooleanProperty(" debug" ).get()
75+
76+ val Project .isSnapshotVersion
77+ get() = version.toString().endsWith(" SNAPSHOT" , true )
78+
7879val Project .isKmpExecEnabled
7980 get() = extra.has(" enableKmpExec" ) && extra[" enableKmpExec" ] as Boolean
8081
82+ val Project .isWinTargetEnabled: Boolean
83+ get() = gradleBooleanProperty(" kotlin.target.win.enabled" ).get()
84+
8185/* * Java version properties. */
8286val Project .javaVersion
8387 get() = libs.versions.java.asProvider().map { JavaVersion .toVersion(it) }
@@ -110,6 +114,9 @@ val Project.kotlinLangVersion
110114val Project .orgName
111115 get() = libs.versions.org.name.get()
112116
117+ val Project .orgUrl
118+ get() = libs.versions.org.url.get()
119+
113120val Project .githubUser
114121 get() = libs.versions.dev.name.get().lowercase()
115122
@@ -713,6 +720,9 @@ fun Project.addFileToJavaComponent(file: File) {
713720 }
714721}
715722
723+ fun Project.gradleBooleanProperty (name : String ): Provider <Boolean > =
724+ providers.gradleProperty(name).map(String ::toBoolean).orElse(false )
725+
716726/* * Lazy version of [TaskContainer.maybeCreate] */
717727inline fun <reified T : Task > TaskContainer.maybeRegister (
718728 name : String ,
@@ -727,23 +737,3 @@ inline fun <reified T : Task> TaskContainer.maybeRegister(
727737 it.configure(action)
728738 }
729739 }
730-
731- /* *
732- * Generates the URL for the GitHub package repository based on the owner and repository name.
733- *
734- * @param owner The owner of the GitHub repository.
735- * @param repository The name of the GitHub repository.
736- * @return The URL of the GitHub package repository.
737- */
738- fun githubPackage (owner : String , repository : String ) =
739- " https://maven.pkg.github.com/${owner.lowercase()} /$repository "
740-
741- /* *
742- * Returns the latest download URL for a given [groupId] and [artifactId] from Maven Central.
743- *
744- * @param groupId the group ID of the Maven artifact
745- * @param artifactId the artifact ID of the Maven artifact
746- * @return the latest download URL for the specified Maven artifact
747- */
748- fun mavenDownloadUrl (groupId : String , artifactId : String ) =
749- " https://search.maven.org/remote_content?g=${groupId} &a=${artifactId} &v=LATEST"
0 commit comments