Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create two UnitTestBot plugin versions for IC and IU #2491

Merged
merged 3 commits into from
Aug 14, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-run-tests-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:

- name: Run tests
run: |
gradle -PprojectType=ExperimentalLanguages --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}
gradle -PprojectType=Ultimate --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}

- name: Upload logs
if: ${{ always() }}
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
- name: Run tests
run: |
cd utbot-spring-test
gradle -PprojectType=Spring --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-spring-test:test
gradle -PprojectType=Community --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx6g -Dkotlin.daemon.jvm.options=-Xmx4g :utbot-spring-test:test

- name: Upload logs
if: ${{ always() }}
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/publish-plugin-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@ jobs:
matrix:
configuration:
- plugin_type: IC
extra_options: "-PideType=IC -PprojectType=PureJava"
extra_options: "-PideType=IC -PprojectType=Community"
- plugin_type: IU
extra_options: "-PideType=IU -PprojectType=ExperimentalLanguages"
- plugin_type: IC-Spring
extra_options: "-PideType=IC -PprojectType=Spring"
- plugin_type: IU-Spring
extra_options: "-PideType=IU -PprojectType=Spring"
extra_options: "-PideType=IU -PprojectType=Ultimate"
runs-on: ubuntu-20.04
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-chosen-tests-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Run chosen tests
run: |
gradle :${{ github.event.inputs.project-name }}:test -PprojectType=ExperimentalLanguages --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g --tests ${{ github.event.inputs.tests-bunch-name }}
gradle :${{ github.event.inputs.project-name }}:test -PprojectType=Ultimate --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g --tests ${{ github.event.inputs.tests-bunch-name }}

- name: Upload ${{ github.event.inputs.project-name }} tests report if tests have failed
if: ${{ failure() }}
Expand Down
10 changes: 3 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
kotlin.code.style=official

#Project Type
# - PureJava: no additional features
# - ExperimentalLanguages: for Java + { Python, JavaScript, Go }
# - Spring: for Java + Spring
# - Ultimate: for all supported functionality
# - Community: for Java + Spring + Python (IC supported features)
# - Ultimate: for Java + Spring + Python (IU supported features) + JavaScript + Go
projectType=Ultimate

pureJavaEdition=PureJava
languagesEdition=ExperimentalLanguages
springEdition=Spring
communityEdition = Community
ultimateEdition=Ultimate

# IU, IC, PC, PY
Expand Down
28 changes: 11 additions & 17 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
val projectType: String by settings
val communityEdition: String by settings
val ultimateEdition: String by settings
val springEdition: String by settings
val languagesEdition: String by settings
val pureJavaEdition: String by settings

val ideType: String by settings
val buildType: String by settings
Expand Down Expand Up @@ -61,14 +59,17 @@ include("utbot-spring-commons-api")
include("utbot-spring-commons")
include("utbot-spring-analyzer")

if (projectType == languagesEdition || projectType == ultimateEdition) {
if (pythonIde.split(",").contains(ideType)) {
include("utbot-python")
include("utbot-cli-python")
include("utbot-intellij-python")
include("utbot-python-parser")
}
if (pythonIde.split(",").contains(ideType)) {
include("utbot-python")
include("utbot-cli-python")
include("utbot-intellij-python")
include("utbot-python-parser")
}

include("utbot-spring-sample")
include("utbot-spring-test")

if (projectType == ultimateEdition) {
if (jsBuild == buildType || jsIde.split(",").contains(ideType)) {
include("utbot-js")
include("utbot-cli-js")
Expand All @@ -82,12 +83,5 @@ if (projectType == languagesEdition || projectType == ultimateEdition) {
}
}

if (projectType == springEdition || projectType == ultimateEdition) {
include("utbot-spring-sample")
include("utbot-spring-test")
}



include("utbot-light")

5 changes: 1 addition & 4 deletions utbot-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ dependencies {

implementation project(':utbot-spring-commons-api')
implementation project(':utbot-spring-analyzer')

if (projectType == springEdition || projectType==ultimateEdition) {
fetchSpringAnalyzerJar project(path: ':utbot-spring-analyzer', configuration: 'springAnalyzerJar')
}
fetchSpringAnalyzerJar project(path: ':utbot-spring-analyzer', configuration: 'springAnalyzerJar')
}

processResources {
Expand Down
10 changes: 1 addition & 9 deletions utbot-instrumentation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer

val projectType: String by rootProject
val ultimateEdition: String by rootProject
val springEdition: String by rootProject
val languagesEdition: String by rootProject
val pureJavaEdition: String by rootProject

val asmVersion: String by rootProject
val kryoVersion: String by rootProject
val kryoSerializersVersion: String by rootProject
Expand Down Expand Up @@ -63,9 +57,7 @@ dependencies {
implementation("org.mockito:mockito-inline:$mockitoInlineVersion")

implementation(project(":utbot-spring-commons-api"))
if (projectType == springEdition || projectType == ultimateEdition) {
fetchSpringCommonsJar(project(":utbot-spring-commons", configuration = "springCommonsJar"))
}
fetchSpringCommonsJar(project(":utbot-spring-commons", configuration = "springCommonsJar"))
}

/**
Expand Down
23 changes: 11 additions & 12 deletions utbot-intellij/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
val projectType: String by rootProject
val communityEdition: String by rootProject
val ultimateEdition: String by rootProject
val springEdition: String by rootProject
val languagesEdition: String by rootProject
val pureJavaEdition: String by rootProject

val intellijPluginVersion: String? by rootProject
val kotlinLoggingVersion: String? by rootProject
Expand Down Expand Up @@ -72,16 +70,16 @@ intellij {
val basePluginSet = jvmPlugins + kotlinPlugins + mavenUtilsPlugins + androidPlugins

plugins.set(
if (projectType == languagesEdition || projectType == ultimateEdition) {
when (ideType) {
when (projectType) {
communityEdition -> basePluginSet + pythonCommunityPlugins
ultimateEdition -> when (ideType) {
"IC" -> basePluginSet + pythonCommunityPlugins
"IU" -> basePluginSet + pythonUltimatePlugins + jsPlugins + goPlugins
"PC" -> pythonCommunityPlugins
"PY" -> pythonUltimatePlugins // something else, JS?
else -> basePluginSet
}
} else {
basePluginSet
else -> basePluginSet
}
)

Expand Down Expand Up @@ -167,12 +165,13 @@ dependencies {
implementation(project(":utbot-ui-commons"))

//Family
if (projectType == languagesEdition || projectType == ultimateEdition) {
if (pythonIde?.split(',')?.contains(ideType) == true) {
implementation(project(":utbot-python"))
implementation(project(":utbot-intellij-python"))
}

if (pythonIde?.split(',')?.contains(ideType) == true) {
implementation(project(":utbot-python"))
implementation(project(":utbot-intellij-python"))
}

if (projectType == ultimateEdition) {
if (jsIde?.split(',')?.contains(ideType) == true) {
implementation(project(":utbot-js"))
implementation(project(":utbot-intellij-js"))
Expand Down
41 changes: 19 additions & 22 deletions utbot-rd/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -257,34 +257,31 @@ task generateCommonModels(type: RdGenTask) {
}
}

if (projectType == springEdition || projectType == ultimateEdition) {
task generateSpringModels(type: RdGenTask) {
def currentProjectDir = project.projectDir
def ideaPluginProjectDir = project.rootProject.childProjects["utbot-spring-analyzer"].projectDir
def generatedOutputDir = new File(ideaPluginProjectDir, "src/main/kotlin/org/utbot/spring/generated")
def hashDir = generatedOutputDir
def sourcesDir = new File(currentProjectDir, "src/main/rdgen/org/utbot/rd/models")
def rdParams = extensions.getByName("params") as RdGenExtension
task generateSpringModels(type: RdGenTask) {
def currentProjectDir = project.projectDir
def ideaPluginProjectDir = project.rootProject.childProjects["utbot-spring-analyzer"].projectDir
def generatedOutputDir = new File(ideaPluginProjectDir, "src/main/kotlin/org/utbot/spring/generated")
def hashDir = generatedOutputDir
def sourcesDir = new File(currentProjectDir, "src/main/rdgen/org/utbot/rd/models")
def rdParams = extensions.getByName("params") as RdGenExtension

group = "rdgen"
rdParams.verbose = true
rdParams.sources(sourcesDir)
rdParams.hashFolder = hashDir.canonicalPath
// where to search roots
rdParams.packages = "org.utbot.rd.models"
group = "rdgen"
rdParams.verbose = true
rdParams.sources(sourcesDir)
rdParams.hashFolder = hashDir.canonicalPath
// where to search roots
rdParams.packages = "org.utbot.rd.models"

rdParams.generator {
language = "kotlin"
transform = "symmetric"
root = "org.utbot.rd.models.SpringAnalyzerRoot"
rdParams.generator {
language = "kotlin"
transform = "symmetric"
root = "org.utbot.rd.models.SpringAnalyzerRoot"

directory = generatedOutputDir.canonicalPath
namespace = "org.utbot.spring.generated"
}
directory = generatedOutputDir.canonicalPath
namespace = "org.utbot.spring.generated"
}
}


task generateCSharpModels(type: RdGenTask) {
def currentProjectDir = project.projectDir
def riderPluginProjectDir = project.rootProject.projectDir.toPath().resolve("utbot-rider").toFile()
Expand Down