Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
4 changes: 2 additions & 2 deletions utbot-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
Expand Down
24 changes: 6 additions & 18 deletions utbot-gradle/docs/utbot-gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ In addition, it creates one big SARIF-report containing the results from all the
<details>
<summary>Groovy</summary>
<pre>
apply plugin: 'org.utbot.sarif'
apply plugin: 'org.utbot.gradle.plugin'
</pre>
</details>

<details>
<summary>Kotlin DSL</summary>
<pre>
apply(plugin = "org.utbot.sarif")
apply(plugin = "org.utbot.gradle.plugin")
</pre>
</details>

Expand Down Expand Up @@ -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' }
}
&nbsp;
dependencies {
Expand All @@ -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' }
}
&nbsp;
dependencies {
Expand All @@ -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' }
}
&nbsp;
dependencies {
Expand All @@ -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' }
}
&nbsp;
dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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].
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.utbot.sarif
package org.utbot.gradle.plugin

import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginConvention
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down