@@ -8,23 +8,22 @@ In addition, it creates one big SARIF-report containing the results from all the
88
99### How to use
1010
11- _ TODO: The plugin has not been published yet. _
11+ Please, check for the available versions [ here ] ( https://plugins.gradle.org/plugin/org.utbot.gradle.plugin ) .
1212
1313- Apply the plugin:
14-
15- <details >
16- <summary >Groovy</summary >
17- <pre >
18- apply plugin: 'org.utbot.gradle.plugin'
19- </pre >
20- </details >
2114
22- <details >
23- <summary >Kotlin DSL</summary >
24- <pre >
25- apply(plugin = "org.utbot.gradle.plugin")
26- </pre >
27- </details >
15+ __ Groovy:__
16+ ``` Groovy
17+ plugins {
18+ id "org.utbot.gradle.plugin" version "..."
19+ }
20+ ```
21+ __ Kotlin DSL:__
22+ ``` Kotlin
23+ plugins {
24+ id(" org.utbot.gradle.plugin" ) version " ..."
25+ }
26+ ```
2827
2928- Run gradle task ` utbot/generateTestsAndSarifReport ` to create a report.
3029
@@ -33,48 +32,42 @@ _TODO: The plugin has not been published yet._
3332
3433For example, the following configuration may be used:
3534
36- <details >
37- <summary >Groovy</summary >
38- <pre >
39- sarifReport {
40- targetClasses = ['com.abc.Main', 'com.qwerty.Util']
41- projectRoot = 'C:/.../SomeDirectory'
42- generatedTestsRelativeRoot = 'build/generated/test'
43- sarifReportsRelativeRoot = 'build/generated/sarif'
44- markGeneratedTestsDirectoryAsTestSourcesRoot = true
45- testFramework = 'junit5'
46- mockFramework = 'mockito'
47- generationTimeout = 60000L
48- codegenLanguage = 'java'
49- mockStrategy = 'package-based'
50- staticsMocking = 'mock-statics'
51- forceStaticMocking = 'force'
52- classesToMockAlways = ['org.slf4j.Logger', 'java.util.Random']
53- }
54- </pre >
55- </details >
56-
57-
58- <details >
59- <summary >Kotlin DSL</summary >
60- <pre >
61- configure< ; SarifGradleExtension> ; {
62- targetClasses.set(listOf("com.abc.Main", "com.qwerty.Util"))
63- projectRoot.set("C:/.../SomeDirectory")
64- generatedTestsRelativeRoot.set("build/generated/test")
65- sarifReportsRelativeRoot.set("build/generated/sarif")
66- markGeneratedTestsDirectoryAsTestSourcesRoot.set(true)
67- testFramework.set("junit5")
68- mockFramework.set("mockito")
69- generationTimeout.set(60000L)
70- codegenLanguage.set("java")
71- mockStrategy.set("package-based")
72- staticsMocking.set("mock-statics")
73- forceStaticMocking.set("force")
74- classesToMockAlways.set(listOf("org.slf4j.Logger", "java.util.Random"))
75- }
76- </pre >
77- </details >
35+ __ Groovy:__
36+ ``` Groovy
37+ sarifReport {
38+ targetClasses = ['com.abc.Main', 'com.qwerty.Util']
39+ projectRoot = 'C:/.../SomeDirectory'
40+ generatedTestsRelativeRoot = 'build/generated/test'
41+ sarifReportsRelativeRoot = 'build/generated/sarif'
42+ markGeneratedTestsDirectoryAsTestSourcesRoot = true
43+ testFramework = 'junit5'
44+ mockFramework = 'mockito'
45+ generationTimeout = 60000L
46+ codegenLanguage = 'java'
47+ mockStrategy = 'package-based'
48+ staticsMocking = 'mock-statics'
49+ forceStaticMocking = 'force'
50+ classesToMockAlways = ['org.slf4j.Logger', 'java.util.Random']
51+ }
52+ ```
53+ __ Kotlin DSL:__
54+ ``` Kotlin
55+ configure<SarifGradleExtension > {
56+ targetClasses.set(listOf (" com.abc.Main" , " com.qwerty.Util" ))
57+ projectRoot.set(" C:/.../SomeDirectory" )
58+ generatedTestsRelativeRoot.set(" build/generated/test" )
59+ sarifReportsRelativeRoot.set(" build/generated/sarif" )
60+ markGeneratedTestsDirectoryAsTestSourcesRoot.set(true )
61+ testFramework.set(" junit5" )
62+ mockFramework.set(" mockito" )
63+ generationTimeout.set(60000L )
64+ codegenLanguage.set(" java" )
65+ mockStrategy.set(" package-based" )
66+ staticsMocking.set(" mock-statics" )
67+ forceStaticMocking.set(" force" )
68+ classesToMockAlways.set(listOf (" org.slf4j.Logger" , " java.util.Random" ))
69+ }
70+ ```
7871
7972** Note:** All configuration fields have default values, so there is no need to configure the plugin if you don't want to.
8073
@@ -151,94 +144,45 @@ configure<SarifGradleExtension> {
151144
152145If you want to change the source code of the plugin or even the whole utbot-project,
153146you need to do the following:
154- - Publish the modified project to the local maven repository
155- - Correctly specify the dependencies in the build file (in your project)
156- - Apply the plugin (see the section __ How to use__ ).
157-
158- There are two ways to do it.
159-
160- - ** The first way**
161- - Run ` publishing/publishToMavenLocal ` (** utbot root** gradle task)
162-
163- - Add to your build file:
164-
165- <details >
166- <summary >Groovy</summary >
167- <pre >
168- buildscript {
169- repositories {
170- mavenLocal()
171- mavenCentral()
172- maven { url 'https://jitpack.io' }
173- }
174-   ;
175- dependencies {
176- classpath group: 'org.utbot', name: 'utbot-gradle', version: '1.0-SNAPSHOT'
177- }
147+
148+ - Publish plugin to the local maven repository:
149+ ` utbot-gradle/publishing/publishToMavenLocal `
150+
151+ - Add to your build file:
152+
153+ __ Groovy:__
154+ ``` Groovy
155+ buildscript {
156+ repositories {
157+ mavenLocal()
178158 }
179- </pre >
180- </details >
181-
182- <details >
183- <summary >Kotlin DSL</summary >
184- <pre >
185- buildscript {
186- repositories {
187- mavenLocal()
188- mavenCentral()
189- maven { url 'https://jitpack.io' }
190- }
191-   ;
192- dependencies {
193- classpath("org.utbot:utbot-gradle:1.0-SNAPSHOT")
194- }
159+ dependencies {
160+ classpath "org.utbot:utbot-gradle:1.0-SNAPSHOT"
195161 }
196- </pre >
197- </details >
198-
199- - ** The second way** (faster, but more difficult)
200- - Run ` publishing/publishToMavenLocal ` (** utbot-gradle** gradle task)
201- - Add to your ` build.gradle ` :
202-
203- <details >
204- <summary >Groovy</summary >
205- <pre >
206- buildscript {
207- repositories {
208- mavenLocal()
209- mavenCentral()
210- maven { url 'https://jitpack.io' }
211- }
212-   ;
213- dependencies {
214- classpath group: 'org.utbot', name: 'utbot-gradle', version: '1.0-SNAPSHOT'
215- classpath files('C:/..[your-path]../UTBotJava/utbot-framework/build/libs/utbot-framework-1.0-SNAPSHOT.jar')
216- classpath files('C:/..[your-path]../UTBotJava/utbot-framework-api/build/libs/utbot-framework-api-1.0-SNAPSHOT.jar')
217- classpath files('C:/..[your-path]../UTBotJava/utbot-instrumentation/build/libs/utbot-instrumentation-1.0-SNAPSHOT.jar')
218- }
162+ }
163+ ```
164+ __ Kotlin DSL:__
165+ ``` Kotlin
166+ buildscript {
167+ repositories {
168+ mavenLocal()
219169 }
220- </pre >
221- </details >
222-
223- <details >
224- <summary >Kotlin DSL</summary >
225- <pre >
226- buildscript {
227- repositories {
228- mavenLocal()
229- mavenCentral()
230- maven { url 'https://jitpack.io' }
231- }
232-   ;
233- dependencies {
234- classpath("org.utbot:utbot-gradle:1.0-SNAPSHOT")
235- classpath(files("C:/..[your-path]../UTBotJava/utbot-framework/build/libs/utbot-framework-1.0-SNAPSHOT.jar"))
236- classpath(files("C:/..[your-path]../UTBotJava/utbot-framework-api/build/libs/utbot-framework-api-1.0-SNAPSHOT.jar"))
237- classpath(files("C:/..[your-path]../UTBotJava/utbot-instrumentation/build/libs/utbot-instrumentation-1.0-SNAPSHOT.jar"))
238- }
170+ dependencies {
171+ classpath(" org.utbot:utbot-gradle:1.0-SNAPSHOT" )
239172 }
240- </pre >
241- </details >
173+ }
174+ ```
175+
176+ - Apply the plugin:
177+
178+ __ Groovy:__
179+ ``` Groovy
180+ apply plugin: 'org.utbot.gradle.plugin'
181+ ```
182+ __ Kotlin DSL:__
183+ ``` Kotlin
184+ apply (plugin = " org.utbot.gradle.plugin" )
185+ ```
242186
243187### How to configure the log level
244188
@@ -252,6 +196,16 @@ Also note that the standard way to configure the log level (using the `log4j2.xm
252196
253197[ Read more about gradle log levels] ( https://docs.gradle.org/current/userguide/logging.html )
254198
199+ ### Publishing
200+
201+ 1 . Read the [ documentation] ( https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html ) about plugin publishing
202+ 2 . Sign in to our [ account] ( https://plugins.gradle.org/u/utbot ) to get API keys (if you don't have a password, please contact [ Nikita Stroganov] ( https://github.com/IdeaSeeker ) )
203+ 3 . Run ` utbot-gradle/plugin portal/publishPlugins ` gradle task
204+
205+ You can check the published artifacts in the [ remote repository] ( https://plugins.gradle.org/m2/org/utbot/utbot-gradle/ ) .
206+
207+ Please note that the maximum archive size for publishing on the Gradle Plugin Portal is ~ 60Mb.
208+
255209### Requirements
256210
257211UTBot gradle plugin requires Gradle 6.8+
0 commit comments