diff --git a/build.gradle b/build.gradle index f18cfd3051..c4da1c528d 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,16 @@ subprojects { apply plugin: 'java' apply plugin: 'maven-publish' + publishing { + publications { + jar(MavenPublication) { + from components.java + groupId 'org.utbot' + artifactId project.name + } + } + } + repositories { mavenCentral() maven { url 'https://jitpack.io' } diff --git a/utbot-gradle/build.gradle b/utbot-gradle/build.gradle index 2b9cb3b008..a23c2f34cd 100644 --- a/utbot-gradle/build.gradle +++ b/utbot-gradle/build.gradle @@ -18,8 +18,8 @@ configurations.all { gradlePlugin { plugins { sarifReportPlugin { - id = 'org.utbot.sarif' - implementationClass = 'org.utbot.sarif.SarifGradlePlugin' + id = 'org.utbot.gradle.plugin' + implementationClass = 'org.utbot.gradle.plugin.SarifGradlePlugin' } } } diff --git a/utbot-gradle/docs/utbot-gradle.md b/utbot-gradle/docs/utbot-gradle.md index 31116201e8..33c8d9b89e 100644 --- a/utbot-gradle/docs/utbot-gradle.md +++ b/utbot-gradle/docs/utbot-gradle.md @@ -43,14 +43,14 @@ In addition, it creates one big SARIF-report containing the results from all the
Groovy
-  apply plugin: 'org.utbot.sarif'
+  apply plugin: 'org.utbot.gradle.plugin'
   
Kotlin DSL
-  apply(plugin = "org.utbot.sarif")
+  apply(plugin = "org.utbot.gradle.plugin")
   
@@ -195,11 +195,8 @@ There are two ways to do it. buildscript { repositories { mavenLocal() - maven { - url "http://[your-ip]:[your-port]/repository/utbot-uber/" - allowInsecureProtocol true - } mavenCentral() + maven { url 'https://jitpack.io' } }   dependencies { @@ -215,11 +212,8 @@ There are two ways to do it. buildscript { repositories { mavenLocal() - maven { - url = uri("http://[your-ip]:[your-port]/repository/utbot-uber/") - isAllowInsecureProtocol = true - } mavenCentral() + maven { url 'https://jitpack.io' } }   dependencies { @@ -239,11 +233,8 @@ There are two ways to do it. buildscript { repositories { mavenLocal() - maven { - url "http://[your-ip]:[your-port]/repository/utbot-uber/" - allowInsecureProtocol true - } mavenCentral() + maven { url 'https://jitpack.io' } }   dependencies { @@ -262,11 +253,8 @@ There are two ways to do it. buildscript { repositories { mavenLocal() - maven { - url = uri("http://[your-ip]:[your-port]/repository/utbot-uber/") - isAllowInsecureProtocol = true - } mavenCentral() + maven { url 'https://jitpack.io' } }   dependencies { diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/CreateSarifReportTask.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/CreateSarifReportTask.kt similarity index 94% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/CreateSarifReportTask.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/CreateSarifReportTask.kt index 003e8dc39c..d3743297c7 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/CreateSarifReportTask.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/CreateSarifReportTask.kt @@ -1,5 +1,8 @@ -package org.utbot.sarif +package org.utbot.gradle.plugin +import mu.KLogger +import org.gradle.api.DefaultTask +import org.gradle.api.tasks.TaskAction import org.utbot.common.bracket import org.utbot.common.debug import org.utbot.framework.codegen.ForceStaticMocking @@ -9,18 +12,16 @@ import org.utbot.framework.plugin.api.UtBotTestCaseGenerator import org.utbot.framework.plugin.api.UtTestCase import org.utbot.framework.plugin.api.util.UtContext import org.utbot.framework.plugin.api.util.withUtContext -import org.utbot.sarif.extension.SarifGradleExtensionProvider -import org.utbot.sarif.wrappers.GradleProjectWrapper -import org.utbot.sarif.wrappers.SourceFindingStrategyGradle -import org.utbot.sarif.wrappers.SourceSetWrapper -import org.utbot.sarif.wrappers.TargetClassWrapper +import org.utbot.gradle.plugin.extension.SarifGradleExtensionProvider +import org.utbot.gradle.plugin.wrappers.GradleProjectWrapper +import org.utbot.gradle.plugin.wrappers.SourceFindingStrategyGradle +import org.utbot.gradle.plugin.wrappers.SourceSetWrapper +import org.utbot.gradle.plugin.wrappers.TargetClassWrapper +import org.utbot.sarif.SarifReport import org.utbot.summary.summarize import java.net.URLClassLoader import java.nio.file.Path import javax.inject.Inject -import mu.KLogger -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.TaskAction /** * The main class containing the entry point [createSarifReport]. @@ -59,7 +60,7 @@ open class CreateSarifReportTask @Inject constructor( // internal // overwriting the getLogger() function from the DefaultTask - private val logger: KLogger = org.utbot.sarif.logger + private val logger: KLogger = org.utbot.gradle.plugin.logger /** * Generates tests and a SARIF report for classes in the [gradleProject] and in all its child projects. diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/SarifGradlePlugin.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/SarifGradlePlugin.kt similarity index 97% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/SarifGradlePlugin.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/SarifGradlePlugin.kt index e190eb772d..1638303d33 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/SarifGradlePlugin.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/SarifGradlePlugin.kt @@ -1,14 +1,14 @@ -package org.utbot.sarif +package org.utbot.gradle.plugin -import org.utbot.sarif.extension.SarifGradleExtension -import org.utbot.sarif.extension.SarifGradleExtensionProvider -import java.io.File +import mu.KotlinLogging import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.TaskProvider -import mu.KotlinLogging +import org.utbot.gradle.plugin.extension.SarifGradleExtension +import org.utbot.gradle.plugin.extension.SarifGradleExtensionProvider +import java.io.File internal val logger = KotlinLogging.logger {} diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtension.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtension.kt similarity index 98% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtension.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtension.kt index 394ffd3c6e..7a14de1d43 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtension.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtension.kt @@ -1,4 +1,4 @@ -package org.utbot.sarif.extension +package org.utbot.gradle.plugin.extension import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProvider.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProvider.kt similarity index 93% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProvider.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProvider.kt index a42201f1ec..b5d291d3b8 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProvider.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProvider.kt @@ -1,21 +1,14 @@ -package org.utbot.sarif.extension +package org.utbot.gradle.plugin.extension +import org.gradle.api.Project import org.utbot.common.PathUtil.toPath import org.utbot.engine.Mocker -import org.utbot.framework.codegen.ForceStaticMocking -import org.utbot.framework.codegen.Junit4 -import org.utbot.framework.codegen.Junit5 -import org.utbot.framework.codegen.MockitoStaticMocking -import org.utbot.framework.codegen.NoStaticMocking -import org.utbot.framework.codegen.StaticsMocking -import org.utbot.framework.codegen.TestFramework -import org.utbot.framework.codegen.TestNg +import org.utbot.framework.codegen.* import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.MockFramework import org.utbot.framework.plugin.api.MockStrategyApi import java.io.File -import org.gradle.api.Project /** * Provides all [SarifGradleExtension] fields in a convenient form: diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapper.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapper.kt similarity index 94% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapper.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapper.kt index e79aba126f..6f8b099a8a 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapper.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapper.kt @@ -1,12 +1,12 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers -import org.utbot.common.FileUtil.createNewFileWithParentDirectories -import org.utbot.sarif.extension.SarifGradleExtensionProvider -import java.io.File -import java.nio.file.Paths import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.tasks.SourceSet +import org.utbot.common.FileUtil.createNewFileWithParentDirectories +import org.utbot.gradle.plugin.extension.SarifGradleExtensionProvider +import java.io.File +import java.nio.file.Paths /** * Contains information about the gradle project for which we are creating a SARIF report. diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradle.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradle.kt similarity index 97% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradle.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradle.kt index 9d09c8b8ad..e45a190a17 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradle.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradle.kt @@ -1,4 +1,4 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers import org.utbot.common.PathUtil import org.utbot.common.PathUtil.toPath diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceSetWrapper.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapper.kt similarity index 99% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceSetWrapper.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapper.kt index 2f78023680..6220bb7cf4 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/SourceSetWrapper.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapper.kt @@ -1,5 +1,6 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers +import org.gradle.api.tasks.SourceSet import org.utbot.common.FileUtil.createNewFileWithParentDirectories import org.utbot.common.FileUtil.findAllFilesOnly import org.utbot.common.PathUtil.classFqnToPath @@ -14,7 +15,6 @@ import java.io.File import java.net.URLClassLoader import java.nio.file.Path import java.nio.file.Paths -import org.gradle.api.tasks.SourceSet class SourceSetWrapper( val sourceSet: SourceSet, diff --git a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/TargetClassWrapper.kt b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/TargetClassWrapper.kt similarity index 94% rename from utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/TargetClassWrapper.kt rename to utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/TargetClassWrapper.kt index 87bc84f857..b4c8812ea7 100644 --- a/utbot-gradle/src/main/kotlin/org/utbot/sarif/wrappers/TargetClassWrapper.kt +++ b/utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/wrappers/TargetClassWrapper.kt @@ -1,4 +1,4 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers import org.utbot.framework.plugin.api.UtMethod import java.io.File diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradlePluginTest.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradlePluginTest.kt similarity index 96% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradlePluginTest.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradlePluginTest.kt index 062e7f43d8..486d714c07 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradlePluginTest.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradlePluginTest.kt @@ -1,4 +1,4 @@ -package org.utbot.sarif +package org.utbot.gradle.plugin import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradleTestUtil.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradleTestUtil.kt similarity index 88% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradleTestUtil.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradleTestUtil.kt index 9f98304da9..1ac588475f 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/SarifGradleTestUtil.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/SarifGradleTestUtil.kt @@ -1,4 +1,4 @@ -package org.utbot.sarif +package org.utbot.gradle.plugin import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginConvention @@ -8,7 +8,7 @@ import org.gradle.testfixtures.ProjectBuilder internal fun buildProject(): Project { val project = ProjectBuilder.builder().build() project.pluginManager.apply("java") - project.pluginManager.apply("org.utbot.sarif") + project.pluginManager.apply("org.utbot.gradle.plugin") return project } diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProviderTest.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProviderTest.kt similarity index 96% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProviderTest.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProviderTest.kt index b3d9fb8f71..9597f982fc 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/extension/SarifGradleExtensionProviderTest.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProviderTest.kt @@ -1,27 +1,20 @@ -package org.utbot.sarif.extension +package org.utbot.gradle.plugin.extension +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import org.mockito.Mockito import org.utbot.common.PathUtil.toPath import org.utbot.engine.Mocker -import org.utbot.framework.codegen.ForceStaticMocking -import org.utbot.framework.codegen.Junit4 -import org.utbot.framework.codegen.Junit5 -import org.utbot.framework.codegen.MockitoStaticMocking -import org.utbot.framework.codegen.NoStaticMocking -import org.utbot.framework.codegen.StaticsMocking -import org.utbot.framework.codegen.TestFramework -import org.utbot.framework.codegen.TestNg +import org.utbot.framework.codegen.* import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.MockFramework import org.utbot.framework.plugin.api.MockStrategyApi -import org.utbot.sarif.buildProject +import org.utbot.gradle.plugin.buildProject import java.io.File -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Nested -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows -import org.mockito.Mockito class SarifGradleExtensionProviderTest { diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapperTest.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapperTest.kt similarity index 94% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapperTest.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapperTest.kt index 4ba75428e8..8eb307b023 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/GradleProjectWrapperTest.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/GradleProjectWrapperTest.kt @@ -1,17 +1,15 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers -import org.utbot.sarif.buildProject -import org.utbot.sarif.extension.SarifGradleExtensionProvider -import java.io.File import org.gradle.api.Project import org.gradle.api.tasks.SourceSet -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.mockito.Mockito +import org.utbot.gradle.plugin.buildProject +import org.utbot.gradle.plugin.extension.SarifGradleExtensionProvider +import java.io.File class GradleProjectWrapperTest { diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradleTest.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradleTest.kt similarity index 98% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradleTest.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradleTest.kt index 718ff3730f..2accab875d 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceFindingStrategyGradleTest.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceFindingStrategyGradleTest.kt @@ -1,12 +1,12 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers -import org.utbot.common.PathUtil.toPath -import java.nio.file.Paths import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.mockito.Mockito +import org.utbot.common.PathUtil.toPath +import java.nio.file.Paths class SourceFindingStrategyGradleTest { diff --git a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceSetWrapperTest.kt b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapperTest.kt similarity index 93% rename from utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceSetWrapperTest.kt rename to utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapperTest.kt index f640c21f22..5a98a7354c 100644 --- a/utbot-gradle/src/test/kotlin/org/utbot/sarif/wrappers/SourceSetWrapperTest.kt +++ b/utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/wrappers/SourceSetWrapperTest.kt @@ -1,20 +1,19 @@ -package org.utbot.sarif.wrappers +package org.utbot.gradle.plugin.wrappers -import org.utbot.common.FileUtil.createNewFileWithParentDirectories -import org.utbot.framework.plugin.api.CodegenLanguage -import org.utbot.framework.util.* -import org.utbot.sarif.buildProject -import org.utbot.sarif.extension.SarifGradleExtensionProvider -import org.utbot.sarif.mainSourceSet -import java.nio.file.Paths import org.gradle.api.Project -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotNull -import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test import org.mockito.Mockito +import org.utbot.common.FileUtil.createNewFileWithParentDirectories +import org.utbot.framework.plugin.api.CodegenLanguage +import org.utbot.framework.util.Snippet +import org.utbot.framework.util.compileClassFile +import org.utbot.gradle.plugin.buildProject +import org.utbot.gradle.plugin.extension.SarifGradleExtensionProvider +import org.utbot.gradle.plugin.mainSourceSet +import java.nio.file.Paths class SourceSetWrapperTest {