diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index 15f16b04..73b85a49 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -21,8 +21,3 @@ jobs: - uses: gradle/gradle-build-action@v2.7.1 with: arguments: detekt --stacktrace - - uses: github/codeql-action/upload-sarif@v2 - if: ${{ always() }} - with: - sarif_file: ./build/reports/detekt/merge.sarif - category: detekt diff --git a/build.gradle.kts b/build.gradle.kts index c6d15cf9..d8e38cf2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,22 +1,15 @@ -import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.DetektPlugin import io.gitlab.arturbosch.detekt.extensions.DetektExtension -import io.gitlab.arturbosch.detekt.report.ReportMergeTask -import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.cqfn.diktat.plugin.gradle.DiktatExtension +import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin import org.jetbrains.kotlin.gradle.dsl.KotlinCompile -import org.jetbrains.reflekt.buildutils.* -import java.net.URL -@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369 plugins { `maven-publish` + alias(libs.plugins.detekt) + alias(libs.plugins.diktat) alias(libs.plugins.buildconfig) apply false - alias(libs.plugins.dokka) - id(libs.plugins.kotlin.jvm.get().pluginId) -} - -val detektReportMerge by tasks.registering(ReportMergeTask::class) { - output = rootProject.layout.buildDirectory.file("reports/detekt/merge.sarif") + alias(libs.plugins.kotlin.jvm) } group = "org.jetbrains.reflekt" @@ -26,6 +19,7 @@ description = "Reflekt is a compile-time reflection library that leverages the f allprojects { apply(plugin = "kotlin") + apply(plugin = "maven-publish") tasks.withType> { kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" @@ -44,97 +38,101 @@ allprojects { repositories { mavenCentral() - // Uncomment it for using the last kotlin compiler version - // The full list of the build can be found here: - // https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_BuildNumber?mode=builds&tag=bootstrap - // (see builds with tag) - // Note: uncomment it also in the settings.gradle.kts - // maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") } // We should publish the project in the local maven repository before the tests running tasks.withType { - dependsOn(tasks.withType(), ":reflekt-plugin:jar", ":reflekt-dsl:jar") + dependsOn( + tasks.withType(), + ":reflekt-plugin:jar", + gradle.includedBuild("using-embedded-kotlin").task(":reflekt-dsl:jar") + ) + } + + apply() + configure { + diktatConfigFile = rootProject.file("diktat-analysis.yml") + + inputs { + include("src/main/**/*.kt") + } } - configureDiktat() apply() configure { config.setFrom(rootProject.files("detekt.yml")) buildUponDefaultConfig = true - debug = true } - tasks.withType { - finalizedBy(detektReportMerge) - reports.sarif.required = true - detektReportMerge.get().input.from(sarifReportFile) + publishing.repositories.maven("https://packages.jetbrains.team/maven/p/reflekt/reflekt") { + name = "SpacePackages" + + credentials { + username = System.getenv("JB_SPACE_CLIENT_ID").orEmpty() + password = System.getenv("JB_SPACE_CLIENT_SECRET").orEmpty() + } } } -createDiktatTask() +configure { + diktatConfigFile = rootProject.file("diktat-analysis.yml") + inputs { + include("./*.kts") + } +} -subprojects { - apply(plugin = "maven-publish") +tasks.register("diktatCheckAll") { + group = LifecycleBasePlugin.VERIFICATION_GROUP + + allprojects { + this@register.dependsOn(tasks.getByName("diktatCheck")) + } - if (this@subprojects.name != "reflekt-plugin") { - apply(plugin = "org.jetbrains.dokka") + this@register.dependsOn(gradle.includedBuild("using-embedded-kotlin").task(":diktatCheckAll")) +} - tasks.withType { - dokkaSourceSets.configureEach { - sourceLink { - localDirectory = this@subprojects.file("src/main/kotlin") +tasks.register("diktatFixAll") { + group = LifecycleBasePlugin.VERIFICATION_GROUP - remoteUrl = - URL("https://github.com/JetBrains-Research/${rootProject.name}/tree/master/${this@subprojects.name}/src/main/kotlin/") - } - } - } + allprojects { + this@register.dependsOn(tasks.getByName("diktatFix")) } + this@register.dependsOn(gradle.includedBuild("using-embedded-kotlin").task(":diktatFixAll")) +} - if (this@subprojects.name != "gradle-plugin") { - publishing { - publications { - @Suppress("unused") - val mavenJava by creating(MavenPublication::class) { - from(this@subprojects.components["java"]) - - pom { - description = rootProject.description - inceptionYear = "2020" - url = "https://github.com/JetBrains-Research/${rootProject.name}" - - licenses { - license { - comments = "Open-source license" - distribution = "repo" - name = "Apache License" - url = "https://github.com/JetBrains-Research/${rootProject.name}/blob/master/LICENSE" - } - } - - scm { - connection = "scm:git:git@github.com:JetBrains-Research/${rootProject.name}.git" - developerConnection = "scm:git:git@github.com:JetBrains-Research/${rootProject.name}.git" - url = "git@github.com:JetBrains-Research/${rootProject.name}.git" - } - } - } - } - } - } +subprojects { + publishing.publications.create("mavenJava") { - publishing { - repositories { - maven("https://packages.jetbrains.team/maven/p/reflekt/reflekt") { - name = "SpacePackages" + from(this@subprojects.components["java"]) - credentials { - username = System.getenv("JB_SPACE_CLIENT_ID").orEmpty() - password = System.getenv("JB_SPACE_CLIENT_SECRET").orEmpty() + pom { + description = rootProject.description + inceptionYear = "2020" + url = "https://github.com/JetBrains-Research/reflekt" + + licenses { + license { + comments = "Open-source license" + distribution = "repo" + name = "Apache License" + url = "https://github.com/JetBrains-Research/reflekt/blob/master/LICENSE" } } + + scm { + connection = "scm:git:git@github.com:JetBrains-Research/reflekt.git" + developerConnection = "scm:git:git@github.com:JetBrains-Research/reflekt.git" + url = "git@github.com:JetBrains-Research/reflekt.git" + } } } } + +for (it in listOf("publishAllPublicationsToSpacePackagesRepository", "publishToMavenLocal")) { + tasks[it].dependsOn( + gradle.includedBuild("using-embedded-kotlin").task(":reflekt-core:$it"), + gradle.includedBuild("using-embedded-kotlin").task(":reflekt-dsl:$it"), + gradle.includedBuild("using-embedded-kotlin").task(":gradle-plugin:$it"), + ) +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 3948f8e9..00000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -plugins { - `kotlin-dsl` -} - -repositories { - mavenCentral() - google() - // Uncomment it for using the last kotlin compiler version - // The full list of the build can be found here: - // https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_BuildNumber?mode=builds&tag=bootstrap - // (see builds with tag) - // Note: uncomment it also in the settings.gradle.kts - // maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") -} - -dependencies { - implementation(libs.gradle.plugin.kotlin) - implementation(libs.gradle.plugin.diktat) - implementation(libs.gradle.plugin.detekt) -} - -java { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 -} - -tasks.withType { - kotlinOptions.jvmTarget = "11" -} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts deleted file mode 100644 index ec22a169..00000000 --- a/buildSrc/settings.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -dependencyResolutionManagement { - versionCatalogs { - create("libs") { - from(files("../gradle/libs.versions.toml")) - } - } -} - -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - // Uncomment it for using the last kotlin compiler version - // The full list of the build can be found here: - // https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_BuildNumber?mode=builds&tag=bootstrap - // (see builds with tag) - // Note: uncomment it also in the build.gradle.kts - // maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") - } -} diff --git a/buildSrc/src/main/kotlin/org/jetbrains/reflekt/buildutils/DiktatConfiguration.kt b/buildSrc/src/main/kotlin/org/jetbrains/reflekt/buildutils/DiktatConfiguration.kt deleted file mode 100644 index ce7eaedd..00000000 --- a/buildSrc/src/main/kotlin/org/jetbrains/reflekt/buildutils/DiktatConfiguration.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Configuration for diktat static analysis - */ - -package org.jetbrains.reflekt.buildutils - -import org.cqfn.diktat.plugin.gradle.DiktatExtension -import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.configure - -/** - * Applies diktat gradle plugin and configures diktat for [this] project - */ -fun Project.configureDiktat() { - apply() - configure { - inputs { - include("src/main/**/*.kt") - } - } -} - -/** - * Creates unified tasks to run diktat on all projects - */ -fun Project.createDiktatTask() { - if (this == rootProject) { - configure { - diktatConfigFile = rootProject.file("diktat-analysis.yml") - inputs { - include("./*.kts") - include("./buildSrc/**/*.kt") - } - } - } - tasks.register("diktatCheckAll") { - allprojects { - this@register.dependsOn(tasks.getByName("diktatCheck")) - } - } - tasks.register("diktatFixAll") { - allprojects { - this@register.dependsOn(tasks.getByName("diktatFix")) - } - } -} diff --git a/docs/contributing.md b/docs/contributing.md index cdf50a4e..8df3c370 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -33,8 +33,8 @@ which will help keep your pull request simple and easy to apply. ## Search and fix formatting issues 0. Run building without running detekt: `./gradlew build` -1. To run detekt static analysis checks, use: `./gradlew detektCheckAll` (associated with gitHub Action) -2. To run diktat static analysis checks, use: `./gradlew diktatCheckAll` (associated with gitHub Action) +1. To run detekt static analysis checks, use: `./gradlew detekt` (associated with GitHub Action) +2. To run diktat static analysis checks, use: `./gradlew diktatCheckAll` (associated with GitHub Action) 3. To try to automatically fix issues detected by diktat, use: `./gradlew diktatFixAll` 4. Make sure you're following our Kotlin docs formatting rules.
diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index bbf772b4..346f5afd 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -4,8 +4,8 @@ group = rootProject.group version = rootProject.version plugins { - id("org.jetbrains.reflekt") version "1.8.21" - id("org.jetbrains.kotlin.jvm") version "1.8.21" + id("org.jetbrains.reflekt") version "1.8.20" + kotlin("jvm") version "1.8.20" } allprojects { @@ -14,6 +14,11 @@ allprojects { plugin("org.jetbrains.reflekt") } + java { + targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_11 + } + tasks.withType { kotlinOptions { jvmTarget = "11" @@ -23,7 +28,7 @@ allprojects { } dependencies { - implementation("org.jetbrains.reflekt", "reflekt-dsl", "1.8.21") + implementation("org.jetbrains.reflekt", "reflekt-dsl", "1.8.20") } repositories { @@ -33,6 +38,4 @@ allprojects { // Uncomment to use a released version // maven("https://packages.jetbrains.team/maven/p/reflekt/reflekt") } - - reflekt.enabled = true } diff --git a/examples/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/wrapper/gradle-wrapper.jar index 41d9927a..7f93135c 100644 Binary files a/examples/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/wrapper/gradle-wrapper.properties index 92f06b50..3fa8f862 100644 --- a/examples/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradlew b/examples/gradlew index 1b6c7873..1aa94a42 100755 --- a/examples/gradlew +++ b/examples/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/examples/gradlew.bat b/examples/gradlew.bat index 107acd32..93e3f59f 100644 --- a/examples/gradlew.bat +++ b/examples/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/examples/settings.gradle.kts b/examples/settings.gradle.kts index a483f42c..0631bbd2 100644 --- a/examples/settings.gradle.kts +++ b/examples/settings.gradle.kts @@ -1,7 +1,6 @@ rootProject.name = "example" -include(":first-module") -include(":second-module") +include(":first-module", ":second-module") pluginManagement { repositories { diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts deleted file mode 100644 index 2e06aa0a..00000000 --- a/gradle-plugin/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369 -plugins { - `kotlin-dsl` - alias(libs.plugins.kotlin.plugin.serialization) - alias(libs.plugins.plugin.publish) -} - -group = rootProject.group -version = rootProject.version - -dependencies { - implementation(embeddedKotlin("gradle-plugin-api")) - implementation(projects.reflektCore) - api(projects.reflektDsl) - implementation(libs.kotlinx.serialization.protobuf) -} - -gradlePlugin { - website = "https://github.com/JetBrains-Research/reflekt" - vcsUrl = "https://github.com/JetBrains-Research/reflekt" - plugins { - val reflekt by creating { - id = "org.jetbrains.reflekt" - displayName = "Gradle Reflekt plugin" - description = rootProject.description - implementationClass = "org.jetbrains.reflekt.plugin.ReflektSubPlugin" - tags.addAll(listOf("kotlin", "reflection", "reflekt")) - } - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68a1bacd..3fdac26f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,11 +32,6 @@ junit-platform-commons = { module = "org.junit.platform:junit-platform-commons", junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" } junit-platform-runner = { module = "org.junit.platform:junit-platform-runner", version.ref = "junit-platform" } junit-platform-suite-api = { module = "org.junit.platform:junit-platform-suite-api", version.ref = "junit-platform" } -kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } -kotlin-compiler-internal-test-framework = { module = "org.jetbrains.kotlin:kotlin-compiler-internal-test-framework", version.ref = "kotlin" } -kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -kotlin-script-runtime = { module = "org.jetbrains.kotlin:kotlin-script-runtime", version.ref = "kotlin" } -kotlin-annotations-jvm = { module = "org.jetbrains.kotlin:kotlin-annotations-jvm", version.ref = "kotlin" } # -------Tests------- gradle-plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" } @@ -47,6 +42,8 @@ zip4j = { module = "net.lingala.zip4j:zip4j", version.ref = "zip4j" } [plugins] buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +diktat = { id = "org.cqfn.diktat.diktat-gradle-plugin", version.ref = "diktat" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a..7f93135c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b93c46a5..3fa8f862 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/reflekt-plugin/build.gradle.kts b/reflekt-plugin/build.gradle.kts index ced5a117..b03a1daf 100644 --- a/reflekt-plugin/build.gradle.kts +++ b/reflekt-plugin/build.gradle.kts @@ -1,5 +1,3 @@ - -@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369 plugins { alias(libs.plugins.kotlin.plugin.serialization) } @@ -8,29 +6,22 @@ group = rootProject.group version = rootProject.version dependencies { - implementation(kotlin("scripting-jvm-host-unshaded")) - - implementation(projects.reflektCore) - implementation(projects.reflektDsl) + api(kotlin("scripting-jvm-host-unshaded")) - implementation(libs.kotlinpoet) - implementation(libs.reflections) + api("org.jetbrains.reflekt:reflekt-core") + api("org.jetbrains.reflekt:reflekt-dsl") - implementation(libs.kotlinx.serialization.protobuf) + api(libs.kotlinpoet) + api(libs.reflections) - // TODO: disable runtime after deleting kotlin script - kotlin("compiler") -// .let { -// compileOnly(it) -// testImplementation(it) -// } + api(libs.kotlinx.serialization.protobuf) - testRuntimeOnly(libs.kotlin.test) - testRuntimeOnly(libs.kotlin.script.runtime) - testRuntimeOnly(libs.kotlin.annotations.jvm) + testRuntimeOnly(kotlin("test")) + testRuntimeOnly(kotlin("script-runtime")) + testRuntimeOnly(kotlin("annotations-jvm")) - testImplementation(libs.kotlin.reflect) - testImplementation(libs.kotlin.compiler.internal.test.framework) + testImplementation(kotlin("reflect")) + testImplementation(kotlin("compiler-internal-test-framework")) testImplementation(libs.junit.jupiter) testImplementation(libs.junit.platform.commons) @@ -62,13 +53,12 @@ tasks.processTestResources.configure { } fun Test.setLibraryProperty(propName: String, jarName: String) { - val path = - project.configurations.testRuntimeClasspath - .get() - .files - .find { """$jarName-\d.*jar""".toRegex().matches(it.name) } - ?.absolutePath - ?: return + val path = project.configurations.testRuntimeClasspath + .get() + .files + .find { """$jarName-\d.*jar""".toRegex().matches(it.name) } + ?.absolutePath + ?: return systemProperty(propName, path) } diff --git a/reflekt-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/analysis/serialization/ClassIdSerializer.kt b/reflekt-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/analysis/serialization/ClassIdSerializer.kt index 0146cb9c..574c1992 100644 --- a/reflekt-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/analysis/serialization/ClassIdSerializer.kt +++ b/reflekt-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/analysis/serialization/ClassIdSerializer.kt @@ -7,16 +7,12 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import org.jetbrains.kotlin.name.* -@OptIn(ExperimentalSerializationApi::class) -@Serializer(forClass = FqName::class) object FqNameSerializer : KSerializer { override val descriptor: SerialDescriptor = String.serializer().descriptor override fun deserialize(decoder: Decoder): FqName = FqName(decoder.decodeString()) override fun serialize(encoder: Encoder, value: FqName) = encoder.encodeString(value.asString()) } -@OptIn(ExperimentalSerializationApi::class) -@Serializer(forClass = Name::class) object NameSerializer : KSerializer { override val descriptor: SerialDescriptor = NameSurrogate.serializer().descriptor override fun deserialize(decoder: Decoder): Name { @@ -32,8 +28,6 @@ object NameSerializer : KSerializer { encoder.encodeSerializableValue(NameSurrogate.serializer(), NameSurrogate(value.asString(), value.isSpecial)) } -@OptIn(ExperimentalSerializationApi::class) -@Serializer(forClass = ClassId::class) object ClassIdSerializer : KSerializer { override val descriptor: SerialDescriptor = ClassIdSurrogate.serializer().descriptor @@ -48,7 +42,6 @@ object ClassIdSerializer : KSerializer { } } -@OptIn(ExperimentalSerializationApi::class) object CallableIdSerializer : KSerializer { override val descriptor: SerialDescriptor = CallableIdSurrogate.serializer().descriptor diff --git a/reflekt-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar b/reflekt-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar similarity index 100% rename from reflekt-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar rename to reflekt-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar diff --git a/reflekt-plugin/src/test/kotlin/org/jetbrains/reflekt/plugin/util/ReflektClasspathProvider.kt b/reflekt-plugin/src/test/kotlin/org/jetbrains/reflekt/plugin/util/ReflektClasspathProvider.kt index 75e9151c..baa153d4 100644 --- a/reflekt-plugin/src/test/kotlin/org/jetbrains/reflekt/plugin/util/ReflektClasspathProvider.kt +++ b/reflekt-plugin/src/test/kotlin/org/jetbrains/reflekt/plugin/util/ReflektClasspathProvider.kt @@ -6,17 +6,18 @@ import java.io.File import java.io.FilenameFilter object ReflektClasspathProvider { - const val REFLEKT_PLUGIN = "reflekt-plugin" - const val REFLEKT_DSL = "reflekt-dsl" + data class DirectoryAndModule(val jarDirectory: String, val module: String) - fun findJar(moduleName: String, testServices: TestServices? = null): File { - val libDir = File(jarDir(moduleName)) - testServices?.assertions?.assertTrue(libDir.exists() && libDir.isDirectory) { failMessage(moduleName) } - return libDir.listFiles(jarFilter(moduleName))?.firstOrNull() ?: testServices?.assertions?.fail { failMessage(moduleName) } - ?: error(failMessage(moduleName)) - } + val REFLEKT_PLUGIN = DirectoryAndModule("reflekt-plugin/build/libs/", "reflekt-plugin") + val REFLEKT_DSL = DirectoryAndModule("using-embedded-kotlin/reflekt-dsl/build/libs/", "reflekt-dsl") - private fun jarDir(moduleName: String) = "$moduleName/build/libs/" + fun findJar(directoryAndModule: DirectoryAndModule, testServices: TestServices? = null): File { + val libDir = File(directoryAndModule.jarDirectory) + testServices?.assertions?.assertTrue(libDir.exists() && libDir.isDirectory) { failMessage(directoryAndModule.module) } + return libDir.listFiles(jarFilter(directoryAndModule.module))?.firstOrNull() + ?: testServices?.assertions?.fail { failMessage(directoryAndModule.module) } + ?: error(failMessage(directoryAndModule.module)) + } private fun jarFilter(moduleName: String) = FilenameFilter { _, name -> name.startsWith(moduleName) && name.endsWith(".jar") && !name.contains("-sources") @@ -25,7 +26,7 @@ object ReflektClasspathProvider { private fun failMessage(moduleName: String) = "Jar with Reflekt for the module: $moduleName does not exist. Please run :$moduleName:jar" } -object CodeGenTestPaths{ +object CodeGenTestPaths { private const val ROOT_COMPILER_TEST_FOLDER = "reflekt-plugin/src/test/resources/org/jetbrains/reflekt/plugin/compiler" private val additionalSourcesFolder = "$ROOT_COMPILER_TEST_FOLDER/additional-sources" val additionalSourcesCommonFilesFolder = "$additionalSourcesFolder/common-files" diff --git a/settings.gradle.kts b/settings.gradle.kts index 58a85963..0991cf6e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,23 +1,17 @@ -enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") - rootProject.name = "reflekt" -include( - ":reflekt-core", - ":reflekt-dsl", - ":reflekt-plugin", - ":gradle-plugin", -) +include(":reflekt-plugin") pluginManagement { repositories { mavenCentral() gradlePluginPortal() - // Uncomment it for using the last kotlin compiler version - // The full list of the build can be found here: - // https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_BuildNumber?mode=builds&tag=bootstrap - // (see builds with tag) - // Note: uncomment it also in the build.gradle.kts - // maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") + } +} + +includeBuild("using-embedded-kotlin") { + dependencySubstitution { + substitute(module("org.jetbrains.reflekt:reflekt-core")).using(project(":reflekt-core")) + substitute(module("org.jetbrains.reflekt:reflekt-dsl")).using(project(":reflekt-dsl")) } } diff --git a/using-embedded-kotlin/build.gradle.kts b/using-embedded-kotlin/build.gradle.kts new file mode 100644 index 00000000..ed0a7150 --- /dev/null +++ b/using-embedded-kotlin/build.gradle.kts @@ -0,0 +1,138 @@ +import io.gitlab.arturbosch.detekt.DetektPlugin +import io.gitlab.arturbosch.detekt.extensions.DetektExtension +import org.cqfn.diktat.plugin.gradle.DiktatExtension +import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin +import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.dsl.KotlinCompile +import java.net.URL + +plugins { + `maven-publish` + alias(libs.plugins.buildconfig) apply false + alias(libs.plugins.detekt) + alias(libs.plugins.diktat) + alias(libs.plugins.dokka) + `embedded-kotlin` +} + +group = "org.jetbrains.reflekt" +version = libs.versions.kotlin.get() +description = "Reflekt is a compile-time reflection library that leverages the flows of the standard reflection approach and can find classes, objects " + + "(singleton classes) or functions by some conditions in compile-time." + +allprojects { + apply(plugin = "maven-publish") + apply(plugin = "kotlin") + apply() + + tasks.withType> { + kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" + } + + java { + targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_11 + } + + tasks.withType().all { + kotlinOptions { + jvmTarget = "11" + } + } + + repositories { + mavenCentral() + } + + // We should publish the project in the local maven repository before the tests running + tasks.withType { + dependsOn(tasks.withType(), ":reflekt-plugin:jar", ":reflekt-dsl:jar") + } + + configure { + diktatConfigFile = rootProject.file("../diktat-analysis.yml") + + inputs { + include("src/main/**/*.kt") + } + } + + apply() + + configure { + config.setFrom(rootProject.files("../detekt.yml")) + buildUponDefaultConfig = true + debug = true + } + + publishing.repositories.maven("https://packages.jetbrains.team/maven/p/reflekt/reflekt") { + name = "SpacePackages" + + credentials { + username = System.getenv("JB_SPACE_CLIENT_ID").orEmpty() + password = System.getenv("JB_SPACE_CLIENT_SECRET").orEmpty() + } + } +} + +configure { + diktatConfigFile = rootProject.file("../diktat-analysis.yml") + inputs { + include("./*.kts") + } +} + +tasks.register("diktatCheckAll") { + allprojects { + this@register.dependsOn(tasks.getByName("diktatCheck")) + } +} +tasks.register("diktatFixAll") { + allprojects { + this@register.dependsOn(tasks.getByName("diktatFix")) + } +} + +subprojects { + if (this@subprojects.name != "reflekt-plugin") { + apply(plugin = "org.jetbrains.dokka") + + tasks.withType { + dokkaSourceSets.configureEach { + sourceLink { + localDirectory = this@subprojects.file("src/main/kotlin") + + remoteUrl = + URL("https://github.com/JetBrains-Research/reflekt/tree/master/using-embedded-kotlin/${this@subprojects.name}/src/main/kotlin/") + } + } + } + } + + if (this@subprojects.name != "gradle-plugin") { + publishing.publications.create("mavenJava") { + from(this@subprojects.components["java"]) + + pom { + description = rootProject.description + inceptionYear = "2020" + url = "https://github.com/JetBrains-Research/reflekt" + + licenses { + license { + comments = "Open-source license" + distribution = "repo" + name = "Apache License" + url = "https://github.com/JetBrains-Research/reflekt/blob/master/LICENSE" + } + } + + scm { + connection = "scm:git:git@github.com:JetBrains-Research/reflekt.git" + developerConnection = "scm:git:git@github.com:JetBrains-Research/reflekt.git" + url = "git@github.com:JetBrains-Research/reflekt.git" + } + } + } + } +} diff --git a/using-embedded-kotlin/gradle-plugin/build.gradle.kts b/using-embedded-kotlin/gradle-plugin/build.gradle.kts new file mode 100644 index 00000000..e15f7fbc --- /dev/null +++ b/using-embedded-kotlin/gradle-plugin/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + kotlin("plugin.serialization") version embeddedKotlinVersion + alias(libs.plugins.plugin.publish) +} + +group = rootProject.group +version = rootProject.version + +dependencies { + compileOnly(embeddedKotlin("gradle-plugin-api")) + implementation(projects.reflektCore) + implementation(libs.kotlinx.serialization.protobuf) +} + +gradlePlugin { + website = "https://github.com/JetBrains-Research/reflekt" + vcsUrl = "https://github.com/JetBrains-Research/reflekt" + + plugins.create("reflekt") { + id = "org.jetbrains.reflekt" + displayName = "Gradle Reflekt plugin" + description = rootProject.description + implementationClass = "org.jetbrains.reflekt.plugin.ReflektSubPlugin" + tags.addAll(listOf("kotlin", "reflection", "reflekt")) + } +} diff --git a/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektGradleExtension.kt b/using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektGradleExtension.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektGradleExtension.kt rename to using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektGradleExtension.kt diff --git a/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektSubPlugin.kt b/using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektSubPlugin.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektSubPlugin.kt rename to using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/ReflektSubPlugin.kt diff --git a/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/SerializationUtils.kt b/using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/SerializationUtils.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/SerializationUtils.kt rename to using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/SerializationUtils.kt diff --git a/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/Util.kt b/using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/Util.kt similarity index 100% rename from gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/Util.kt rename to using-embedded-kotlin/gradle-plugin/src/main/kotlin/org/jetbrains/reflekt/plugin/util/Util.kt diff --git a/using-embedded-kotlin/gradle.properties b/using-embedded-kotlin/gradle.properties new file mode 100644 index 00000000..41c5beed --- /dev/null +++ b/using-embedded-kotlin/gradle.properties @@ -0,0 +1,2 @@ +kotlin.code.style=official +org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m diff --git a/reflekt-core/build.gradle.kts b/using-embedded-kotlin/reflekt-core/build.gradle.kts similarity index 76% rename from reflekt-core/build.gradle.kts rename to using-embedded-kotlin/reflekt-core/build.gradle.kts index f8f7e433..9c43982d 100644 --- a/reflekt-core/build.gradle.kts +++ b/using-embedded-kotlin/reflekt-core/build.gradle.kts @@ -7,5 +7,5 @@ dependencies { tasks.processResources.configure { duplicatesStrategy = DuplicatesStrategy.INCLUDE - from(rootProject.file("gradle/libs.versions.toml")) + from(rootProject.file("../gradle/libs.versions.toml")) } diff --git a/reflekt-core/src/main/kotlin/org/jetbrains/reflekt/util/Util.kt b/using-embedded-kotlin/reflekt-core/src/main/kotlin/org/jetbrains/reflekt/util/Util.kt similarity index 100% rename from reflekt-core/src/main/kotlin/org/jetbrains/reflekt/util/Util.kt rename to using-embedded-kotlin/reflekt-core/src/main/kotlin/org/jetbrains/reflekt/util/Util.kt diff --git a/reflekt-dsl/build.gradle.kts b/using-embedded-kotlin/reflekt-dsl/build.gradle.kts similarity index 52% rename from reflekt-dsl/build.gradle.kts rename to using-embedded-kotlin/reflekt-dsl/build.gradle.kts index fa067ceb..c8257905 100644 --- a/reflekt-dsl/build.gradle.kts +++ b/using-embedded-kotlin/reflekt-dsl/build.gradle.kts @@ -2,5 +2,5 @@ group = rootProject.group version = rootProject.version dependencies { - api(kotlin("compiler")) + api(kotlin("compiler", version = libs.versions.kotlin.get())) } diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/InternalReflektApi.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/InternalReflektApi.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/InternalReflektApi.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/InternalReflektApi.kt diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/Reflekt.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/Reflekt.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/Reflekt.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/Reflekt.kt diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektClass.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektClass.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektClass.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektClass.kt diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektImpl.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektImpl.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektImpl.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/ReflektImpl.kt diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/SmartReflekt.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/SmartReflekt.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/SmartReflekt.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/SmartReflekt.kt diff --git a/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/util/TypeStringRepresentationUtil.kt b/using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/util/TypeStringRepresentationUtil.kt similarity index 100% rename from reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/util/TypeStringRepresentationUtil.kt rename to using-embedded-kotlin/reflekt-dsl/src/main/kotlin/org/jetbrains/reflekt/util/TypeStringRepresentationUtil.kt diff --git a/using-embedded-kotlin/settings.gradle.kts b/using-embedded-kotlin/settings.gradle.kts new file mode 100644 index 00000000..5cef72c2 --- /dev/null +++ b/using-embedded-kotlin/settings.gradle.kts @@ -0,0 +1,22 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +rootProject.name = "using-embedded-kotlin" + +include( + ":reflekt-core", + ":reflekt-dsl", + ":gradle-plugin", +) + +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement.versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } +}