diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/app-dependencies.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/app-dependencies.json deleted file mode 100644 index b7546734..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/app-dependencies.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "format": "litheDependencies", - "version": 0, - "dependencies": [ - { - "name": "compileClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "runtimeClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "testCompileClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "testRuntimeClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/dependencies.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/dependencies.json deleted file mode 100644 index 417dcd81..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/dependencies.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "format": "litheDependencies", - "version": 0, - "dependencies": [ - { - "name": "multi", - "properties": { - "kind": "project", - "path": ":" - }, - "children": [] - }, - { - "name": "app", - "properties": { - "kind": "project", - "path": ":app" - }, - "children": [ - { - "name": "compileClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "runtimeClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "testCompileClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - }, - { - "name": "testRuntimeClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [] - } - ] - } - ] - }, - { - "name": "core", - "properties": { - "kind": "project", - "path": ":core" - }, - "children": [ - { - "name": "testCompileClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "junit", - "group": "junit", - "version": "4.13.2", - "properties": {}, - "children": [ - { - "name": "hamcrest-core", - "group": "org.hamcrest", - "version": "1.3", - "properties": {}, - "children": [] - } - ] - } - ] - }, - { - "name": "testRuntimeClasspath", - "properties": { - "kind": "configuration" - }, - "children": [ - { - "name": "junit", - "group": "junit", - "version": "4.13.2", - "properties": {}, - "children": [ - { - "name": "hamcrest-core", - "group": "org.hamcrest", - "version": "1.3", - "properties": {}, - "children": [] - } - ] - } - ] - } - ] - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/model.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/model.json deleted file mode 100644 index 912776f9..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/model.json +++ /dev/null @@ -1,1051 +0,0 @@ -{ - "format": "litheBuildModel", - "version": 0, - "projects": [ - { - "path": "${workspace}", - "name": "multi", - "properties": { - "path": ":", - "taskPrefix": ":", - "group": "demo", - "version": "1.0.0" - } - }, - { - "path": "${workspace}/app", - "name": "app", - "parent": "${workspace}", - "properties": { - "path": ":app", - "taskPrefix": ":app:", - "group": "demo", - "version": "1.0.0" - } - }, - { - "path": "${workspace}/core", - "name": "core", - "parent": "${workspace}", - "properties": { - "path": ":core", - "taskPrefix": ":core:", - "group": "demo", - "version": "1.0.0" - } - } - ], - "tasks": [ - { - "project": "${workspace}", - "name": "artifactTransforms", - "template": "gradle-task", - "description": "Displays the Artifact Transforms that can be executed in root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "artifactTransforms" - } - }, - { - "project": "${workspace}", - "name": "buildEnvironment", - "template": "gradle-task", - "description": "Displays all buildscript dependencies declared in root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "buildEnvironment" - } - }, - { - "project": "${workspace}", - "name": "dependencies", - "template": "gradle-task", - "description": "Displays all dependencies declared in root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "dependencies" - } - }, - { - "project": "${workspace}", - "name": "dependencyInsight", - "template": "gradle-task", - "description": "Displays the insight into a specific dependency in root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "dependencyInsight" - } - }, - { - "project": "${workspace}", - "name": "help", - "template": "gradle-task", - "description": "Displays a help message.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "help" - } - }, - { - "project": "${workspace}", - "name": "init", - "template": "gradle-task", - "description": "Initializes a new Gradle build.", - "category": [ - "Tasks", - "Build Setup" - ], - "properties": { - "path": "init" - } - }, - { - "project": "${workspace}", - "name": "javaToolchains", - "template": "gradle-task", - "description": "Displays the detected java toolchains.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "javaToolchains" - } - }, - { - "project": "${workspace}", - "name": "outgoingVariants", - "template": "gradle-task", - "description": "Displays the outgoing variants of root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "outgoingVariants" - } - }, - { - "project": "${workspace}", - "name": "prepareKotlinBuildScriptModel", - "template": "gradle-task", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": "prepareKotlinBuildScriptModel" - } - }, - { - "project": "${workspace}", - "name": "projects", - "template": "gradle-task", - "description": "Displays the sub-projects of root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "projects" - } - }, - { - "project": "${workspace}", - "name": "properties", - "template": "gradle-task", - "description": "Displays the properties of root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "properties" - } - }, - { - "project": "${workspace}", - "name": "resolvableConfigurations", - "template": "gradle-task", - "description": "Displays the configurations that can be resolved in root project 'multi'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "resolvableConfigurations" - } - }, - { - "project": "${workspace}", - "name": "tasks", - "template": "gradle-task", - "description": "Displays the tasks runnable from root project 'multi' (some of the displayed tasks may belong to subprojects).", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": "tasks" - } - }, - { - "project": "${workspace}", - "name": "updateDaemonJvm", - "template": "gradle-task", - "description": "Generates or updates the Gradle Daemon JVM criteria.", - "category": [ - "Tasks", - "Build Setup" - ], - "properties": { - "path": "updateDaemonJvm" - } - }, - { - "project": "${workspace}", - "name": "wrapper", - "template": "gradle-task", - "description": "Generates Gradle wrapper files.", - "category": [ - "Tasks", - "Build Setup" - ], - "properties": { - "path": "wrapper" - } - }, - { - "project": "${workspace}/app", - "name": "artifactTransforms", - "template": "gradle-task", - "description": "Displays the Artifact Transforms that can be executed in project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:artifactTransforms" - } - }, - { - "project": "${workspace}/app", - "name": "assemble", - "template": "gradle-task", - "description": "Assembles the outputs of this project.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:assemble" - } - }, - { - "project": "${workspace}/app", - "name": "assembleDist", - "template": "gradle-task", - "description": "Assembles the main distributions", - "category": [ - "Tasks", - "distribution" - ], - "properties": { - "path": ":app:assembleDist" - } - }, - { - "project": "${workspace}/app", - "name": "build", - "template": "gradle-task", - "description": "Assembles and tests this project.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:build" - } - }, - { - "project": "${workspace}/app", - "name": "buildDependents", - "template": "gradle-task", - "description": "Assembles and tests this project and all projects that depend on it.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:buildDependents" - } - }, - { - "project": "${workspace}/app", - "name": "buildEnvironment", - "template": "gradle-task", - "description": "Displays all buildscript dependencies declared in project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:buildEnvironment" - } - }, - { - "project": "${workspace}/app", - "name": "buildNeeded", - "template": "gradle-task", - "description": "Assembles and tests this project and all projects it depends on.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:buildNeeded" - } - }, - { - "project": "${workspace}/app", - "name": "check", - "template": "gradle-task", - "description": "Runs all checks.", - "category": [ - "Tasks", - "verification" - ], - "properties": { - "path": ":app:check" - } - }, - { - "project": "${workspace}/app", - "name": "classes", - "template": "gradle-task", - "description": "Assembles main classes.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:classes" - } - }, - { - "project": "${workspace}/app", - "name": "clean", - "template": "gradle-task", - "description": "Deletes the build directory.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:clean" - } - }, - { - "project": "${workspace}/app", - "name": "compileJava", - "template": "gradle-task", - "description": "Compiles main Java source.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":app:compileJava" - } - }, - { - "project": "${workspace}/app", - "name": "compileTestJava", - "template": "gradle-task", - "description": "Compiles test Java source.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":app:compileTestJava" - } - }, - { - "project": "${workspace}/app", - "name": "dependencies", - "template": "gradle-task", - "description": "Displays all dependencies declared in project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:dependencies" - } - }, - { - "project": "${workspace}/app", - "name": "dependencyInsight", - "template": "gradle-task", - "description": "Displays the insight into a specific dependency in project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:dependencyInsight" - } - }, - { - "project": "${workspace}/app", - "name": "distTar", - "template": "gradle-task", - "description": "Bundles the project as a distribution.", - "category": [ - "Tasks", - "distribution" - ], - "properties": { - "path": ":app:distTar" - } - }, - { - "project": "${workspace}/app", - "name": "distZip", - "template": "gradle-task", - "description": "Bundles the project as a distribution.", - "category": [ - "Tasks", - "distribution" - ], - "properties": { - "path": ":app:distZip" - } - }, - { - "project": "${workspace}/app", - "name": "help", - "template": "gradle-task", - "description": "Displays a help message.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:help" - } - }, - { - "project": "${workspace}/app", - "name": "installDist", - "template": "gradle-task", - "description": "Installs the project as a distribution as-is.", - "category": [ - "Tasks", - "distribution" - ], - "properties": { - "path": ":app:installDist" - } - }, - { - "project": "${workspace}/app", - "name": "jar", - "template": "gradle-task", - "description": "Assembles a jar archive containing the classes of the 'main' feature.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:jar" - } - }, - { - "project": "${workspace}/app", - "name": "javaToolchains", - "template": "gradle-task", - "description": "Displays the detected java toolchains.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:javaToolchains" - } - }, - { - "project": "${workspace}/app", - "name": "javadoc", - "template": "gradle-task", - "description": "Generates Javadoc API documentation for the 'main' feature.", - "category": [ - "Tasks", - "documentation" - ], - "properties": { - "path": ":app:javadoc" - } - }, - { - "project": "${workspace}/app", - "name": "outgoingVariants", - "template": "gradle-task", - "description": "Displays the outgoing variants of project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:outgoingVariants" - } - }, - { - "project": "${workspace}/app", - "name": "processResources", - "template": "gradle-task", - "description": "Processes main resources.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":app:processResources" - } - }, - { - "project": "${workspace}/app", - "name": "processTestResources", - "template": "gradle-task", - "description": "Processes test resources.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":app:processTestResources" - } - }, - { - "project": "${workspace}/app", - "name": "projects", - "template": "gradle-task", - "description": "Displays the sub-projects of project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:projects" - } - }, - { - "project": "${workspace}/app", - "name": "properties", - "template": "gradle-task", - "description": "Displays the properties of project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:properties" - } - }, - { - "project": "${workspace}/app", - "name": "resolvableConfigurations", - "template": "gradle-task", - "description": "Displays the configurations that can be resolved in project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:resolvableConfigurations" - } - }, - { - "project": "${workspace}/app", - "name": "run", - "template": "gradle-task", - "description": "Runs this project as a JVM application", - "category": [ - "Tasks", - "application" - ], - "execution": "application", - "properties": { - "path": ":app:run" - } - }, - { - "project": "${workspace}/app", - "name": "startScripts", - "template": "gradle-task", - "description": "Creates OS specific scripts to run the project as a JVM application.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":app:startScripts" - } - }, - { - "project": "${workspace}/app", - "name": "tasks", - "template": "gradle-task", - "description": "Displays the tasks runnable from project ':app'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":app:tasks" - } - }, - { - "project": "${workspace}/app", - "name": "test", - "template": "gradle-task", - "description": "Runs the test suite.", - "category": [ - "Tasks", - "verification" - ], - "properties": { - "path": ":app:test" - } - }, - { - "project": "${workspace}/app", - "name": "testClasses", - "template": "gradle-task", - "description": "Assembles test classes.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":app:testClasses" - } - }, - { - "project": "${workspace}/core", - "name": "artifactTransforms", - "template": "gradle-task", - "description": "Displays the Artifact Transforms that can be executed in project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:artifactTransforms" - } - }, - { - "project": "${workspace}/core", - "name": "assemble", - "template": "gradle-task", - "description": "Assembles the outputs of this project.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:assemble" - } - }, - { - "project": "${workspace}/core", - "name": "build", - "template": "gradle-task", - "description": "Assembles and tests this project.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:build" - } - }, - { - "project": "${workspace}/core", - "name": "buildDependents", - "template": "gradle-task", - "description": "Assembles and tests this project and all projects that depend on it.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:buildDependents" - } - }, - { - "project": "${workspace}/core", - "name": "buildEnvironment", - "template": "gradle-task", - "description": "Displays all buildscript dependencies declared in project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:buildEnvironment" - } - }, - { - "project": "${workspace}/core", - "name": "buildNeeded", - "template": "gradle-task", - "description": "Assembles and tests this project and all projects it depends on.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:buildNeeded" - } - }, - { - "project": "${workspace}/core", - "name": "check", - "template": "gradle-task", - "description": "Runs all checks.", - "category": [ - "Tasks", - "verification" - ], - "properties": { - "path": ":core:check" - } - }, - { - "project": "${workspace}/core", - "name": "classes", - "template": "gradle-task", - "description": "Assembles main classes.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:classes" - } - }, - { - "project": "${workspace}/core", - "name": "clean", - "template": "gradle-task", - "description": "Deletes the build directory.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:clean" - } - }, - { - "project": "${workspace}/core", - "name": "compileJava", - "template": "gradle-task", - "description": "Compiles main Java source.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":core:compileJava" - } - }, - { - "project": "${workspace}/core", - "name": "compileTestJava", - "template": "gradle-task", - "description": "Compiles test Java source.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":core:compileTestJava" - } - }, - { - "project": "${workspace}/core", - "name": "dependencies", - "template": "gradle-task", - "description": "Displays all dependencies declared in project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:dependencies" - } - }, - { - "project": "${workspace}/core", - "name": "dependencyInsight", - "template": "gradle-task", - "description": "Displays the insight into a specific dependency in project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:dependencyInsight" - } - }, - { - "project": "${workspace}/core", - "name": "help", - "template": "gradle-task", - "description": "Displays a help message.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:help" - } - }, - { - "project": "${workspace}/core", - "name": "jar", - "template": "gradle-task", - "description": "Assembles a jar archive containing the classes of the 'main' feature.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:jar" - } - }, - { - "project": "${workspace}/core", - "name": "javaToolchains", - "template": "gradle-task", - "description": "Displays the detected java toolchains.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:javaToolchains" - } - }, - { - "project": "${workspace}/core", - "name": "javadoc", - "template": "gradle-task", - "description": "Generates Javadoc API documentation for the 'main' feature.", - "category": [ - "Tasks", - "documentation" - ], - "properties": { - "path": ":core:javadoc" - } - }, - { - "project": "${workspace}/core", - "name": "outgoingVariants", - "template": "gradle-task", - "description": "Displays the outgoing variants of project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:outgoingVariants" - } - }, - { - "project": "${workspace}/core", - "name": "processResources", - "template": "gradle-task", - "description": "Processes main resources.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":core:processResources" - } - }, - { - "project": "${workspace}/core", - "name": "processTestResources", - "template": "gradle-task", - "description": "Processes test resources.", - "category": [ - "Tasks", - "other" - ], - "properties": { - "path": ":core:processTestResources" - } - }, - { - "project": "${workspace}/core", - "name": "projects", - "template": "gradle-task", - "description": "Displays the sub-projects of project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:projects" - } - }, - { - "project": "${workspace}/core", - "name": "properties", - "template": "gradle-task", - "description": "Displays the properties of project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:properties" - } - }, - { - "project": "${workspace}/core", - "name": "resolvableConfigurations", - "template": "gradle-task", - "description": "Displays the configurations that can be resolved in project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:resolvableConfigurations" - } - }, - { - "project": "${workspace}/core", - "name": "tasks", - "template": "gradle-task", - "description": "Displays the tasks runnable from project ':core'.", - "category": [ - "Tasks", - "help" - ], - "properties": { - "path": ":core:tasks" - } - }, - { - "project": "${workspace}/core", - "name": "test", - "template": "gradle-task", - "description": "Runs the test suite.", - "category": [ - "Tasks", - "verification" - ], - "properties": { - "path": ":core:test" - } - }, - { - "project": "${workspace}/core", - "name": "testClasses", - "template": "gradle-task", - "description": "Assembles test classes.", - "category": [ - "Tasks", - "build" - ], - "properties": { - "path": ":core:testClasses" - } - } - ], - "contentRoots": [ - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/main/java", - "kind": "source" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/main/resources", - "kind": "resource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/build/generated/sources/annotationProcessor/java/main", - "kind": "generatedSource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/test/java", - "kind": "testSource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/test/resources", - "kind": "testResource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/build/generated/sources/annotationProcessor/java/test", - "kind": "generatedTestSource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/main/java", - "kind": "source" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/main/resources", - "kind": "resource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/build/generated/sources/annotationProcessor/java/main", - "kind": "generatedSource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/test/java", - "kind": "testSource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/test/resources", - "kind": "testResource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/build/generated/sources/annotationProcessor/java/test", - "kind": "generatedTestSource" - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/plugin.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/plugin.json deleted file mode 100644 index f4e07a8c..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/gradle/plugin.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "schemaVersion": 0, - "id": "io.github.lithe-idea.gradle-build", - "displayName": "Gradle", - "version": "0.1.0", - "pluginAPIVersion": 0, - "requires": { "buildSystems": 0 }, - "vendor": { - "id": "io.github.lithe-idea", - "displayName": "Lithe Community", - "signatureRequirement": "none" - }, - "permissions": ["process.build"], - "activationEvents": ["onBuildSystem:gradle"], - "languages": [], - "buildSystems": [ - { - "id": "gradle", - "displayName": "Gradle", - "icon": { "path": "icons/gradle.svg" }, - "detection": { - "markers": ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"], - "nesting": "outermost" - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "gradlew", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["macos", "linux"] - }, - { - "kind": "projectFile", - "path": "gradlew.bat", - "requires": ["gradle/wrapper/gradle-wrapper.properties"], - "platforms": ["windows"] - }, - { "kind": "environment", "variable": "GRADLE_HOME", "path": "bin/gradle", "platforms": ["macos", "linux"] }, - { "kind": "environment", "variable": "GRADLE_HOME", "path": "bin/gradle.bat", "platforms": ["windows"] }, - { "kind": "command", "command": "gradle" } - ], - "environmentInputs": ["GRADLE_HOME"], - "runtimeDependencies": [{ "id": "java", "minimumVersion": "8" }], - "globalArguments": ["--console=plain", "${optionArguments}"], - "version": { "arguments": ["--version"], "pattern": "Gradle (\\d+(?:\\.\\d+){1,2})" }, - "minimumVersion": "7.6" - }, - "options": [ - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "presentation": "toolbar", - "icon": { "path": "icons/offline.svg" }, - "arguments": ["--offline"] - }, - { - "id": "gradleUserHome", - "displayName": "Gradle User Home", - "kind": "directory", - "arguments": ["--gradle-user-home", "${value}"] - } - ], - "model": { - "source": "command", - "arguments": [ - "-q", - "--no-configuration-cache", - "--no-configure-on-demand", - "--init-script", - "${pluginDir}/lithe.init.gradle", - "-PlitheModelOutput=${outputFile}", - "litheModel" - ], - "output": "outputFile", - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "tasks": [ - { - "id": "gradle-task", - "displayName": "Gradle Task", - "group": "other", - "category": ["Tasks", "other"], - "fromModel": true, - "arguments": ["${task.property:path}"] - }, - { - "id": "tasks", - "displayName": "Run Gradle Tasks…", - "group": "other", - "scopes": ["workspace", "project"], - "requiresUserArguments": true, - "arguments": [ - { "value": "--project-dir", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${userArguments}" - ] - } - ], - "run": [ - { - "id": "task", - "fromTasks": { "templates": ["gradle-task"], "executions": ["application"] }, - "workingDirectory": "root" - } - ], - "test": { - "scopes": ["workspace", "project"], - "filters": ["suite", "case"], - "arguments": [ - { "value": "${project.property:taskPrefix}test", "when": "nestedProjectSelected" }, - { "value": "test", "when": "noNestedProjectSelected" }, - { "value": "--tests", "when": "suiteSelected" }, - { "value": "${test.suite}", "when": ["suiteSelected", "noCaseSelected"] }, - { "value": "${test.suite}.${test.case}", "when": ["suiteSelected", "caseSelected"] } - ], - "results": { "decoder": "junitXml", "reports": ["build/test-results/test/TEST-*.xml"] } - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^(.+\\.java):(\\d+): (error|warning): (.+)$", - "file": 1, - "line": 2, - "severity": 3, - "message": 4 - }, - { - "regex": "^([ew]): file://(.+?\\.kts?):(\\d+):(\\d+) (.+)$", - "file": 2, - "line": 3, - "column": 4, - "message": 5, - "severity": 1, - "severities": { "e": "error", "w": "warning" } - } - ] - }, - "dependencies": { - "source": "command", - "scopes": ["workspace", "project"], - "arguments": [ - "-q", - "--no-configuration-cache", - "--no-configure-on-demand", - "--init-script", - "${pluginDir}/lithe.init.gradle", - "-PlitheDependenciesOutput=${outputFile}", - { "value": "-PlitheDependenciesProject=${project.property:path}", "when": "projectSelected" }, - "litheDependencyReport" - ], - "output": "outputFile", - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "sync": { - "watch": [ - "build.gradle", - "build.gradle.kts", - "gradle.properties", - "gradle/libs.versions.toml", - "gradle/wrapper/gradle-wrapper.properties", - "settings.gradle", - "settings.gradle.kts" - ] - }, - "layout": { "excluded": [".gradle", "build"] } - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/app-dependencies.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/app-dependencies.json deleted file mode 100644 index e63ee241..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/app-dependencies.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "format": "litheDependencies", - "version": 0, - "dependencies": [ - { - "name": "core", - "group": "demo", - "version": "1.0.0-SNAPSHOT", - "scope": "compile", - "properties": { - "type": "jar" - }, - "children": [] - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/dependencies.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/dependencies.json deleted file mode 100644 index 167fb578..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/dependencies.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "format": "litheDependencies", - "version": 0, - "dependencies": [ - { - "name": "reactor", - "group": "demo", - "version": "1.0.0-SNAPSHOT", - "properties": { - "kind": "project", - "packaging": "pom" - }, - "children": [] - }, - { - "name": "core", - "group": "demo", - "version": "1.0.0-SNAPSHOT", - "properties": { - "kind": "project", - "packaging": "jar" - }, - "children": [ - { - "name": "junit", - "group": "junit", - "version": "4.13.2", - "scope": "test", - "properties": { - "type": "jar" - }, - "children": [ - { - "name": "hamcrest-core", - "group": "org.hamcrest", - "version": "1.3", - "scope": "test", - "properties": { - "type": "jar" - }, - "children": [] - } - ] - } - ] - }, - { - "name": "app", - "group": "demo", - "version": "1.0.0-SNAPSHOT", - "properties": { - "kind": "project", - "packaging": "jar" - }, - "children": [ - { - "name": "core", - "group": "demo", - "version": "1.0.0-SNAPSHOT", - "scope": "compile", - "properties": { - "type": "jar" - }, - "children": [] - } - ] - } - ] -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/model.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/model.json deleted file mode 100644 index cd9b2bc3..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/model.json +++ /dev/null @@ -1,1123 +0,0 @@ -{ - "format": "litheBuildModel", - "version": 0, - "projects": [ - { - "path": "${workspace}", - "name": "reactor", - "displayName": "Demo Reactor", - "properties": { - "groupId": "demo", - "artifactId": "reactor", - "version": "1.0.0-SNAPSHOT", - "packaging": "pom" - } - }, - { - "path": "${workspace}/core", - "name": "core", - "parent": "${workspace}", - "properties": { - "groupId": "demo", - "artifactId": "core", - "version": "1.0.0-SNAPSHOT", - "packaging": "jar" - } - }, - { - "path": "${workspace}/app", - "name": "app", - "parent": "${workspace}", - "properties": { - "groupId": "demo", - "artifactId": "app", - "version": "1.0.0-SNAPSHOT", - "packaging": "jar" - } - } - ], - "tasks": [ - { - "project": "${workspace}", - "name": "clean:clean", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:clean" - } - }, - { - "project": "${workspace}", - "name": "clean:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:help" - } - }, - { - "project": "${workspace}", - "name": "install:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}", - "name": "install:install", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install" - } - }, - { - "project": "${workspace}", - "name": "install:install-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install-file" - } - }, - { - "project": "${workspace}", - "name": "deploy:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy" - } - }, - { - "project": "${workspace}", - "name": "deploy:deploy-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy-file" - } - }, - { - "project": "${workspace}", - "name": "deploy:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}", - "name": "site:attach-descriptor", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:attach-descriptor" - } - }, - { - "project": "${workspace}", - "name": "site:auto-refresh", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:auto-refresh" - } - }, - { - "project": "${workspace}", - "name": "site:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:deploy" - } - }, - { - "project": "${workspace}", - "name": "site:effective-site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:effective-site" - } - }, - { - "project": "${workspace}", - "name": "site:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:help" - } - }, - { - "project": "${workspace}", - "name": "site:jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:jar" - } - }, - { - "project": "${workspace}", - "name": "site:run", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:run" - } - }, - { - "project": "${workspace}", - "name": "site:site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:site" - } - }, - { - "project": "${workspace}", - "name": "site:stage", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage" - } - }, - { - "project": "${workspace}", - "name": "site:stage-deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage-deploy" - } - }, - { - "project": "${workspace}/core", - "name": "clean:clean", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:clean" - } - }, - { - "project": "${workspace}/core", - "name": "clean:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "resources:copy-resources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:copy-resources" - } - }, - { - "project": "${workspace}/core", - "name": "resources:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "resources:resources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:resources" - } - }, - { - "project": "${workspace}/core", - "name": "resources:testResources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:testResources" - } - }, - { - "project": "${workspace}/core", - "name": "jar:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:help" - } - }, - { - "project": "${workspace}/core", - "name": "jar:jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:jar" - } - }, - { - "project": "${workspace}/core", - "name": "jar:test-jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:test-jar" - } - }, - { - "project": "${workspace}/core", - "name": "compiler:compile", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile" - } - }, - { - "project": "${workspace}/core", - "name": "compiler:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "compiler:testCompile", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:testCompile" - } - }, - { - "project": "${workspace}/core", - "name": "surefire:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2", - "category": [ - "Plugins", - "surefire" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2:help" - } - }, - { - "project": "${workspace}/core", - "name": "surefire:test", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2", - "category": [ - "Plugins", - "surefire" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2:test" - } - }, - { - "project": "${workspace}/core", - "name": "install:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "install:install", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install" - } - }, - { - "project": "${workspace}/core", - "name": "install:install-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install-file" - } - }, - { - "project": "${workspace}/core", - "name": "deploy:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy" - } - }, - { - "project": "${workspace}/core", - "name": "deploy:deploy-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy-file" - } - }, - { - "project": "${workspace}/core", - "name": "deploy:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "site:attach-descriptor", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:attach-descriptor" - } - }, - { - "project": "${workspace}/core", - "name": "site:auto-refresh", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:auto-refresh" - } - }, - { - "project": "${workspace}/core", - "name": "site:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:deploy" - } - }, - { - "project": "${workspace}/core", - "name": "site:effective-site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:effective-site" - } - }, - { - "project": "${workspace}/core", - "name": "site:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:help" - } - }, - { - "project": "${workspace}/core", - "name": "site:jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:jar" - } - }, - { - "project": "${workspace}/core", - "name": "site:run", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:run" - } - }, - { - "project": "${workspace}/core", - "name": "site:site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:site" - } - }, - { - "project": "${workspace}/core", - "name": "site:stage", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage" - } - }, - { - "project": "${workspace}/core", - "name": "site:stage-deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage-deploy" - } - }, - { - "project": "${workspace}/app", - "name": "clean:clean", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:clean" - } - }, - { - "project": "${workspace}/app", - "name": "clean:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-clean-plugin:3.5.0", - "category": [ - "Plugins", - "clean" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "resources:copy-resources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:copy-resources" - } - }, - { - "project": "${workspace}/app", - "name": "resources:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "resources:resources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:resources" - } - }, - { - "project": "${workspace}/app", - "name": "resources:testResources", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-resources-plugin:3.5.0", - "category": [ - "Plugins", - "resources" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-resources-plugin:3.5.0:testResources" - } - }, - { - "project": "${workspace}/app", - "name": "jar:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:help" - } - }, - { - "project": "${workspace}/app", - "name": "jar:jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:jar" - } - }, - { - "project": "${workspace}/app", - "name": "jar:test-jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-jar-plugin:3.5.1", - "category": [ - "Plugins", - "jar" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-jar-plugin:3.5.1:test-jar" - } - }, - { - "project": "${workspace}/app", - "name": "compiler:compile", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile" - } - }, - { - "project": "${workspace}/app", - "name": "compiler:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "compiler:testCompile", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0", - "category": [ - "Plugins", - "compiler" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-compiler-plugin:3.13.0:testCompile" - } - }, - { - "project": "${workspace}/app", - "name": "surefire:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2", - "category": [ - "Plugins", - "surefire" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2:help" - } - }, - { - "project": "${workspace}/app", - "name": "surefire:test", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2", - "category": [ - "Plugins", - "surefire" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-surefire-plugin:3.5.2:test" - } - }, - { - "project": "${workspace}/app", - "name": "install:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "install:install", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install" - } - }, - { - "project": "${workspace}/app", - "name": "install:install-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-install-plugin:3.2.0", - "category": [ - "Plugins", - "install" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-install-plugin:3.2.0:install-file" - } - }, - { - "project": "${workspace}/app", - "name": "deploy:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy" - } - }, - { - "project": "${workspace}/app", - "name": "deploy:deploy-file", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:deploy-file" - } - }, - { - "project": "${workspace}/app", - "name": "deploy:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0", - "category": [ - "Plugins", - "deploy" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-deploy-plugin:3.2.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "site:attach-descriptor", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:attach-descriptor" - } - }, - { - "project": "${workspace}/app", - "name": "site:auto-refresh", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:auto-refresh" - } - }, - { - "project": "${workspace}/app", - "name": "site:deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:deploy" - } - }, - { - "project": "${workspace}/app", - "name": "site:effective-site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:effective-site" - } - }, - { - "project": "${workspace}/app", - "name": "site:help", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:help" - } - }, - { - "project": "${workspace}/app", - "name": "site:jar", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:jar" - } - }, - { - "project": "${workspace}/app", - "name": "site:run", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:run" - } - }, - { - "project": "${workspace}/app", - "name": "site:site", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:site" - } - }, - { - "project": "${workspace}/app", - "name": "site:stage", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage" - } - }, - { - "project": "${workspace}/app", - "name": "site:stage-deploy", - "template": "plugin-goal", - "description": "org.apache.maven.plugins:maven-site-plugin:3.22.0", - "category": [ - "Plugins", - "site" - ], - "properties": { - "goal": "org.apache.maven.plugins:maven-site-plugin:3.22.0:stage-deploy" - } - } - ], - "contentRoots": [ - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/main/java", - "kind": "source" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/main/resources", - "kind": "resource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/test/java", - "kind": "testSource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/src/test/resources", - "kind": "testResource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/target/generated-sources/annotations", - "kind": "generatedSource" - }, - { - "project": "${workspace}/core", - "path": "${workspace}/core/target/generated-test-sources/test-annotations", - "kind": "generatedTestSource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/main/java", - "kind": "source" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/main/resources", - "kind": "resource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/test/java", - "kind": "testSource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/src/test/resources", - "kind": "testResource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/target/generated-sources/annotations", - "kind": "generatedSource" - }, - { - "project": "${workspace}/app", - "path": "${workspace}/app/target/generated-test-sources/test-annotations", - "kind": "generatedTestSource" - } - ], - "optionValues": { - "profiles": [ - "ci", - "release" - ] - } -} diff --git a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/plugin.json b/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/plugin.json deleted file mode 100644 index 8d391675..00000000 --- a/rust/crates/core/src/tests/fixtures/published_build_plugins/maven/plugin.json +++ /dev/null @@ -1,301 +0,0 @@ -{ - "schemaVersion": 0, - "id": "io.github.lithe-idea.maven-build", - "displayName": "Maven", - "version": "0.1.0", - "pluginAPIVersion": 0, - "requires": { "buildSystems": 0 }, - "vendor": { - "id": "io.github.lithe-idea", - "displayName": "Lithe Community", - "signatureRequirement": "none" - }, - "permissions": ["process.build"], - "activationEvents": ["onBuildSystem:maven"], - "languages": [], - "buildSystems": [ - { - "id": "maven", - "displayName": "Maven", - "icon": { "path": "icons/maven.svg" }, - "detection": { - "markers": ["pom.xml"], - "nesting": "outermost" - }, - "invocation": { - "executables": [ - { - "kind": "projectFile", - "path": "mvnw", - "requires": [".mvn/wrapper/maven-wrapper.properties"], - "platforms": ["macos", "linux"] - }, - { - "kind": "projectFile", - "path": "mvnw.cmd", - "requires": [".mvn/wrapper/maven-wrapper.properties"], - "platforms": ["windows"] - }, - { "kind": "environment", "variable": "MAVEN_HOME", "path": "bin/mvn", "platforms": ["macos", "linux"] }, - { "kind": "environment", "variable": "MAVEN_HOME", "path": "bin/mvn.cmd", "platforms": ["windows"] }, - { "kind": "command", "command": "mvn" } - ], - "environmentInputs": ["MAVEN_HOME"], - "runtimeDependencies": [{ "id": "java", "minimumVersion": "8" }], - "globalArguments": [ - "-B", - "-ntp", - "${optionArguments:profiles}", - "${optionArguments:settingsFile}", - "${optionArguments:localRepository}", - "${optionArguments:offline}" - ], - "version": { "arguments": ["--version"], "pattern": "Apache Maven (\\d+\\.\\d+\\.\\d+)" }, - "minimumVersion": "3.6.3" - }, - "options": [ - { - "id": "profiles", - "displayName": "Profiles", - "kind": "multiSelect", - "choicesFromModel": true, - "allowCustom": true, - "presentation": "tree", - "arguments": ["-P", "${value}"] - }, - { "id": "settingsFile", "displayName": "Settings File", "kind": "file", "arguments": ["-s", "${value}"] }, - { - "id": "localRepository", - "displayName": "Local Repository", - "kind": "directory", - "arguments": ["-Dmaven.repo.local=${value}"] - }, - { - "id": "offline", - "displayName": "Offline", - "kind": "boolean", - "presentation": "toolbar", - "icon": { "path": "icons/offline.svg" }, - "arguments": ["-o"] - }, - { - "id": "skipTests", - "displayName": "Skip Tests", - "kind": "boolean", - "presentation": "toolbar", - "icon": { "path": "icons/skipTests.svg" }, - "arguments": ["-DskipTests"] - } - ], - "model": { - "source": "command", - "arguments": [ - "-Dmaven.ext.class.path=${pluginDir}/lib/lithe-maven-extension.jar", - "-Dlithe.modelOutput=${outputFile}", - "pre-clean" - ], - "output": "outputFile", - "decoder": "litheBuildModel", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "tasks": [ - { - "id": "clean", - "displayName": "clean", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "clean" - ] - }, - { - "id": "validate", - "displayName": "validate", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "validate" - ] - }, - { - "id": "compile", - "displayName": "compile", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "compile" - ] - }, - { - "id": "test", - "displayName": "test", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "test" - ] - }, - { - "id": "package", - "displayName": "package", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "package" - ] - }, - { - "id": "verify", - "displayName": "verify", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "verify" - ] - }, - { - "id": "install", - "displayName": "install", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "install" - ] - }, - { - "id": "site", - "displayName": "site", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "site" - ] - }, - { - "id": "deploy", - "displayName": "deploy", - "group": "lifecycle", - "category": ["Lifecycle"], - "scopes": ["workspace", "project"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "deploy" - ] - }, - { - "id": "plugin-goal", - "displayName": "Plugin Goal", - "group": "build", - "category": ["Plugins"], - "fromModel": true, - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "${task.property:goal}" - ] - }, - { - "id": "goal", - "displayName": "Run Maven Goal…", - "group": "other", - "scopes": ["workspace", "project"], - "requiresUserArguments": true, - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - "${optionArguments:skipTests}", - "${userArguments}" - ] - } - ], - "test": { - "scopes": ["workspace", "project"], - "filters": ["suite", "case"], - "arguments": [ - { "value": "-pl", "when": "nestedProjectSelected" }, - { "value": "${project.path}", "when": "nestedProjectSelected" }, - { "value": "-am", "when": ["nestedProjectSelected", "suiteSelected"] }, - { "value": "-Dtest=${test.suite}", "when": ["suiteSelected", "noCaseSelected"] }, - { "value": "-Dtest=${test.suite}#${test.case}", "when": ["suiteSelected", "caseSelected"] }, - { "value": "-Dsurefire.failIfNoSpecifiedTests=false", "when": "suiteSelected" }, - "test" - ], - "results": { - "decoder": "junitXml", - "reports": ["target/surefire-reports/TEST-*.xml", "target/failsafe-reports/TEST-*.xml"] - } - }, - "diagnostics": { - "decoder": "lineMatcher", - "patterns": [ - { - "regex": "^\\[(ERROR|WARNING)\\] (.+?\\.(?:java|kt|groovy|scala)):\\[(\\d+),(\\d+)\\] (.+)$", - "file": 2, - "line": 3, - "column": 4, - "message": 5, - "severity": 1, - "severities": { "ERROR": "error", "WARNING": "warning" } - }, - { - "regex": "^\\[(ERROR|WARNING)\\] file://(.+?\\.kts?):(\\d+):(\\d+) (.+)$", - "file": 2, - "line": 3, - "column": 4, - "message": 5, - "severity": 1, - "severities": { "ERROR": "error", "WARNING": "warning" } - } - ] - }, - "dependencies": { - "source": "command", - "scopes": ["workspace", "project"], - "arguments": [ - "-Dmaven.ext.class.path=${pluginDir}/lib/lithe-maven-extension.jar", - "-Dlithe.dependenciesOutput=${outputFile}", - { "value": "-Dlithe.dependenciesProject=${project.path}", "when": "projectSelected" }, - "pre-clean" - ], - "output": "outputFile", - "decoder": "litheDependencies", - "executesProjectCode": true, - "mayUseNetwork": true - }, - "sync": { "watch": [".mvn/extensions.xml", ".mvn/maven.config", "pom.xml"] }, - "layout": { "excluded": ["target"] } - } - ] -} diff --git a/rust/crates/core/src/tests/mod.rs b/rust/crates/core/src/tests/mod.rs index 2bc0e169..5b620f42 100644 --- a/rust/crates/core/src/tests/mod.rs +++ b/rust/crates/core/src/tests/mod.rs @@ -62,7 +62,6 @@ mod project; mod project_generators; mod project_tree; mod protocol; -mod published_build_plugins; mod rank_names; #[cfg(unix)] mod remote_attach; @@ -73,6 +72,7 @@ mod row_selection; mod run_configuration; mod run_configuration_arrangement; pub(crate) mod support; +mod synthetic_build_plugins; mod toolchain_definitions; mod toolchain_pins; mod toolchain_queries; diff --git a/rust/crates/core/src/tests/published_build_plugins.rs b/rust/crates/core/src/tests/published_build_plugins.rs deleted file mode 100644 index ffa0d679..00000000 --- a/rust/crates/core/src/tests/published_build_plugins.rs +++ /dev/null @@ -1,738 +0,0 @@ -//! The published Maven and Gradle build plugins, checked against what real -//! Maven and Gradle wrote for them. -//! -//! `fixtures/published_build_plugins/` holds each plugin's `plugin.json` and -//! the documents its own integration test captured from a real build: -//! -//! - Maven: `github.com/Lithe-IDEA/lithe-plugin-maven`, `plugin.json` at -//! 944552c, documents captured at ef40103 with Maven 3.10.0 on -//! `test/fixtures/reactor`; -//! - Gradle: `github.com/Lithe-IDEA/lithe-plugin-gradle`, `plugin.json` at -//! 581b84b, documents captured at d669dad with Gradle 9.6.1 on -//! `test/fixtures/multi`. -//! -//! Both `plugin.json` files declare `pluginAPIVersion` 0 with -//! `requires: {"buildSystems": 0}`, and the captured documents carry -//! `version` 0. -//! -//! The captured documents write the scratch workspace as `${workspace}`. To -//! refresh them, run `node scripts/package.mjs` and then -//! `LITHE_CAPTURE_DIR= node scripts/test.mjs` in the plugin repository, -//! and copy `/*.json` and `plugin.json` here. - -use super::support::temporary_root; -use crate::build::{ - build_decode_dependencies_command, build_decode_diagnostics_command, - build_decode_model_command, build_dependency_plan_command, build_detect_command, - build_model_plan_command, build_task_plan_command, build_test_plan_command, -}; -use lithe_plugin_manifest::validate_command; -use lithe_plugin_manifest::DeclarativePluginManifest as Manifest; -use lithe_plugin_marketplace::install_review_command; -use serde_json::{json, Value}; -use std::fs; -use std::path::PathBuf; - -macro_rules! plugin_file { - ($tool:literal, $name:literal) => { - include_str!(concat!( - "fixtures/published_build_plugins/", - $tool, - "/", - $name - )) - }; -} - -const MAVEN_MANIFEST: &str = plugin_file!("maven", "plugin.json"); -const MAVEN_MODEL: &str = plugin_file!("maven", "model.json"); -const MAVEN_DEPENDENCIES: &str = plugin_file!("maven", "dependencies.json"); -const MAVEN_APP_DEPENDENCIES: &str = plugin_file!("maven", "app-dependencies.json"); -const GRADLE_MANIFEST: &str = plugin_file!("gradle", "plugin.json"); -const GRADLE_MODEL: &str = plugin_file!("gradle", "model.json"); -const GRADLE_DEPENDENCIES: &str = plugin_file!("gradle", "dependencies.json"); -const GRADLE_APP_DEPENDENCIES: &str = plugin_file!("gradle", "app-dependencies.json"); - -fn maven() -> Value { - serde_json::from_str(MAVEN_MANIFEST).expect("Maven plugin.json is JSON") -} - -fn gradle() -> Value { - serde_json::from_str(GRADLE_MANIFEST).expect("Gradle plugin.json is JSON") -} - -/// Removes its directory when dropped, so a failed assertion cleans up too. -struct Workspace(PathBuf); - -impl Workspace { - fn new(label: &str) -> Self { - let root = temporary_root(label); - fs::create_dir_all(&root).unwrap(); - Self(root) - } - - fn write(&self, relative: &str, contents: &str) -> &Self { - let path = self.0.join(relative); - fs::create_dir_all(path.parent().unwrap()).unwrap(); - fs::write(path, contents).unwrap(); - self - } - - fn root(&self) -> String { - self.0.to_string_lossy().into_owned() - } - - fn path(&self, relative: &str) -> String { - self.0.join(relative).to_string_lossy().into_owned() - } - - /// Writes a captured document with `${workspace}` replaced by this root, - /// as the plugin would have written it here. - fn capture(&self, relative: &str, captured: &str) -> String { - self.write(relative, &capture_for_workspace(captured, &self.root())); - self.path(relative) - } -} - -impl Drop for Workspace { - fn drop(&mut self) { - let _ = fs::remove_dir_all(&self.0); - } -} - -fn capture_for_workspace(captured: &str, workspace_root: &str) -> String { - let encoded_root = - serde_json::to_string(workspace_root).expect("workspace root is a JSON string"); - // Placeholders are inside JSON strings, so insert the escaped contents - // without the serializer's surrounding quotes, including on Windows. - captured.replace("${workspace}", &encoded_root[1..encoded_root.len() - 1]) -} - -#[test] -fn published_captured_documents_escape_workspace_paths() { - let captured = r#"{ - "root": "${workspace}", - "nested": [{ "path": "${workspace}/core" }], - "unchanged": "already \"quoted\"" - }"#; - for workspace_root in [ - r"C:\Users\fixture\project", - r"C:\temp\new\target", - r"\\server\share\project", - "C:\\fixture\\\"quoted\"\tworkspace\n", - ] { - let document: Value = - serde_json::from_str(&capture_for_workspace(captured, workspace_root)) - .expect("substituted capture remains valid JSON"); - assert_eq!( - document, - json!({ - "root": workspace_root, - "nested": [{ "path": format!("{workspace_root}/core") }], - "unchanged": "already \"quoted\"", - }), - ); - } -} - -type Command = fn(Value) -> Result; - -/// Calls one build operation and requires an `ok` outcome. -fn ok(command: Command, manifest: Value, build_system: &str, request: Value) -> Value { - let outcome = command(json!({ - "manifest": manifest, - "buildSystemID": build_system, - "request": super::support::trusted(request), - })) - .expect("payload is well formed"); - assert_eq!(outcome["status"], "ok", "{outcome}"); - outcome -} - -fn arguments(outcome: &Value) -> Vec<&str> { - outcome["plan"]["arguments"] - .as_array() - .unwrap() - .iter() - .map(|argument| argument.as_str().unwrap()) - .collect() -} - -fn detected_ids(workspace: &Workspace, manifest: Value) -> Vec { - let outcome = build_detect_command::(json!({ - "workspaceRoot": workspace.root(), - "plugins": [{ "manifest": manifest }], - "options": {}, - })) - .expect("payload is well formed"); - assert_eq!(outcome["status"], "ok", "{outcome}"); - outcome["detection"]["instances"] - .as_array() - .unwrap() - .iter() - .map(|instance| instance["id"].as_str().unwrap().to_string()) - .collect() -} - -fn strings(value: &Value, key: &str) -> Vec { - value - .as_array() - .unwrap() - .iter() - .map(|item| item[key].as_str().unwrap().to_string()) - .collect() -} - -/// Both packages pass the checks Lithe runs before loading and installing a -/// plugin, and installing one shows the build tool it will run. -#[test] -fn published_build_plugins_validate_and_review() { - for (manifest, build_system) in [(maven(), "maven"), (gradle(), "gradle")] { - let outcome = validate_command(json!({ "manifest": manifest.clone() })).unwrap(); - assert_eq!(outcome["status"], "ok", "{build_system}: {outcome}"); - let review = install_review_command(json!({ "manifest": manifest })).unwrap(); - assert_eq!(review["status"], "ok", "{build_system}: {review}"); - let programs = review["review"]["programs"].as_array().unwrap(); - let entry = programs - .iter() - .find(|program| program["kind"] == "buildSystem") - .unwrap_or_else(|| panic!("{build_system}: no build system program: {programs:?}")); - assert_eq!(entry["buildSystemID"], build_system, "{entry}"); - } -} - -/// A multi-module build is one instance at its outermost build file. -#[test] -fn published_build_plugins_detect_one_instance_per_build() { - let workspace = Workspace::new("published-maven-detect"); - workspace - .write( - "pom.xml", - "app", - ) - .write("app/pom.xml", ""); - assert_eq!(detected_ids(&workspace, maven()), ["maven:."]); - - let workspace = Workspace::new("published-gradle-detect"); - workspace - .write("settings.gradle", "include 'app'\n") - .write("build.gradle", "\n") - .write("app/build.gradle", "plugins { id 'java' }\n"); - assert_eq!(detected_ids(&workspace, gradle()), ["gradle:."]); -} - -/// The model command loads the bundled extension or init script from the -/// installed plugin and writes to the file Lithe chose. -#[test] -fn published_model_plans_name_the_plugin_directory_and_output() { - let workspace = Workspace::new("published-model-plans"); - let plugin_directory = workspace.path("plugins/p"); - let output_file = workspace.path("state/model.json"); - let gradle_user_home = workspace.path("caches/gradle"); - // Plugin templates append literal `/` suffixes to the host-native directory. - let request = |options: Value| { - json!({ - "root": ".", - "pluginDirectory": plugin_directory, - "outputFile": output_file, - "options": options, - }) - }; - let outcome = ok( - build_model_plan_command::, - maven(), - "maven", - request(json!({ "profiles": ["release", "ci"], "offline": true })), - ); - assert_eq!( - arguments(&outcome), - [ - "-B", - "-ntp", - "-P", - "ci,release", - "-o", - &format!("-Dmaven.ext.class.path={plugin_directory}/lib/lithe-maven-extension.jar"), - &format!("-Dlithe.modelOutput={output_file}"), - "pre-clean", - ] - ); - assert_eq!(outcome["plan"]["decoder"], "litheBuildModel"); - assert_eq!(outcome["plan"]["executesProjectCode"], true); - - let outcome = ok( - build_model_plan_command::, - gradle(), - "gradle", - request(json!({ "offline": true, "gradleUserHome": gradle_user_home })), - ); - assert_eq!( - arguments(&outcome), - [ - "--console=plain", - "--offline", - "--gradle-user-home", - &gradle_user_home, - "-q", - "--no-configuration-cache", - "--no-configure-on-demand", - "--init-script", - &format!("{plugin_directory}/lithe.init.gradle"), - &format!("-PlitheModelOutput={output_file}"), - "litheModel", - ] - ); -} - -/// The Maven model lists the reactor, its plugin goals and source folders, -/// and offers the profiles the POMs declare. -#[test] -fn maven_captured_model_decodes() { - let workspace = Workspace::new("published-maven-model"); - let output = workspace.capture("state/model.json", MAVEN_MODEL); - let outcome = ok( - build_decode_model_command::, - maven(), - "maven", - json!({ "workspaceRoot": workspace.root(), "root": ".", "outputFile": output }), - ); - let model = &outcome["model"]; - // Core orders projects by path, not in reactor order. - assert_eq!(strings(&model["projects"], "path"), [".", "app", "core"]); - assert_eq!( - model["projects"][0]["displayName"], "Demo Reactor", - "{model}" - ); - assert_eq!(model["optionValues"]["profiles"], json!(["ci", "release"])); - - let tasks = model["tasks"].as_array().unwrap(); - let clean = tasks - .iter() - .find(|task| task["name"] == "clean:clean") - .unwrap_or_else(|| panic!("no clean:clean goal: {tasks:?}")); - assert_eq!(clean["template"], "plugin-goal", "{clean}"); - assert_eq!(clean["category"], json!(["Plugins", "clean"])); - assert!( - model["contentRoots"] - .as_array() - .unwrap() - .iter() - .any(|root| root["path"] == "core/src/test/java" && root["kind"] == "testSource"), - "{model}" - ); - assert!( - model["run"].as_array().is_none_or(Vec::is_empty), - "plugin goals are not run entries: {model}" - ); -} - -/// The Gradle model lists every project's tasks under their group, and a -/// JavaExec task becomes a run entry that runs by its task path. -#[test] -fn gradle_captured_model_decodes() { - let workspace = Workspace::new("published-gradle-model"); - let output = workspace.capture("state/model.json", GRADLE_MODEL); - let outcome = ok( - build_decode_model_command::, - gradle(), - "gradle", - json!({ "workspaceRoot": workspace.root(), "root": ".", "outputFile": output }), - ); - let model = &outcome["model"]; - assert_eq!(strings(&model["projects"], "path"), [".", "app", "core"]); - let tasks = model["tasks"].as_array().unwrap(); - let test = tasks - .iter() - .find(|task| task["name"] == "test" && task["properties"]["path"] == ":core:test") - .unwrap_or_else(|| panic!("no :core:test: {tasks:?}")); - assert_eq!(test["category"], json!(["Tasks", "verification"])); - assert!( - model["contentRoots"] - .as_array() - .unwrap() - .iter() - .any(|root| root["path"] - == "app/build/generated/sources/annotationProcessor/java/main" - && root["kind"] == "generatedSource"), - "{model}" - ); - - let run = model["run"].as_array().unwrap(); - assert_eq!(run.len(), 1, "only JavaExec tasks are run entries: {run:?}"); - assert_eq!(run[0]["name"], "run"); - assert_eq!(run[0]["execution"], "application"); - assert_eq!(run[0]["args"], json!(["--console=plain", ":app:run"])); - assert_eq!(run[0]["cwd"], "."); -} - -/// Lifecycle phases select a module with `-pl`, plugin goals from the model -/// run by their full coordinates, and toolbar options apply to both. -#[test] -fn maven_task_plans() { - let workspace = Workspace::new("published-maven-task-plans"); - let local_repository = workspace.path("m2"); - let app = json!({ "path": "app", "name": "app" }); - let outcome = ok( - build_task_plan_command::, - maven(), - "maven", - json!({ - "root": ".", - "task": "install", - "project": app, - "options": { "skipTests": true, "localRepository": local_repository }, - }), - ); - assert_eq!( - arguments(&outcome), - [ - "-B", - "-ntp", - &format!("-Dmaven.repo.local={local_repository}"), - "-pl", - "app", - "-DskipTests", - "install" - ] - ); - - let outcome = ok( - build_task_plan_command::, - maven(), - "maven", - json!({ - "root": ".", - "task": "plugin-goal", - "project": { "path": ".", "name": "reactor" }, - "modelTask": { - "name": "clean:clean", - "properties": { "goal": "org.apache.maven.plugins:maven-clean-plugin:3.5.0:clean" }, - }, - }), - ); - assert_eq!( - arguments(&outcome), - [ - "-B", - "-ntp", - "org.apache.maven.plugins:maven-clean-plugin:3.5.0:clean" - ] - ); - - let outcome = ok( - build_task_plan_command::, - maven(), - "maven", - json!({ - "root": ".", - "task": "goal", - "project": app, - "userArguments": ["dependency:tree"], - }), - ); - assert_eq!( - arguments(&outcome), - ["-B", "-ntp", "-pl", "app", "dependency:tree"] - ); -} - -/// Root tasks run as selectors, nested ones by path, and "Run Gradle -/// Tasks…" runs in the selected project's directory. -#[test] -fn gradle_task_plans() { - let task = |project: Value, path: &str| { - let outcome = ok( - build_task_plan_command::, - gradle(), - "gradle", - json!({ - "root": ".", - "task": "gradle-task", - "project": project, - "modelTask": { "name": "build", "properties": { "path": path } }, - }), - ); - arguments(&outcome).join(" ") - }; - let root = - json!({ "path": ".", "name": "multi", "properties": { "path": ":", "taskPrefix": ":" } }); - let core = json!({ "path": "core", "name": "core", "properties": { "path": ":core", "taskPrefix": ":core:" } }); - assert_eq!(task(root.clone(), "build"), "--console=plain build"); - assert_eq!( - task(core.clone(), ":core:build"), - "--console=plain :core:build" - ); - - let custom = |project: Value| { - let outcome = ok( - build_task_plan_command::, - gradle(), - "gradle", - json!({ - "root": ".", - "task": "tasks", - "project": project, - "options": { "offline": true }, - "userArguments": ["dependencies", "--configuration", "runtimeClasspath"], - }), - ); - arguments(&outcome).join(" ") - }; - assert_eq!( - custom(root), - "--console=plain --offline dependencies --configuration runtimeClasspath" - ); - assert_eq!( - custom(core), - "--console=plain --offline --project-dir core dependencies --configuration runtimeClasspath" - ); -} - -/// Test runs select a class or method and read the reports the build tool -/// writes for the selected project. -#[test] -fn published_test_plans() { - let outcome = ok( - build_test_plan_command::, - maven(), - "maven", - json!({ - "root": ".", - "project": { "path": "core", "name": "core" }, - "suite": "demo.core.GreeterTest", - "case": "greets", - }), - ); - assert_eq!( - arguments(&outcome), - [ - "-B", - "-ntp", - "-pl", - "core", - "-am", - "-Dtest=demo.core.GreeterTest#greets", - "-Dsurefire.failIfNoSpecifiedTests=false", - "test", - ] - ); - assert_eq!(outcome["plan"]["results"]["decoder"], "junitXml"); - - let core = json!({ "path": "core", "name": "core", "properties": { "path": ":core", "taskPrefix": ":core:" } }); - let outcome = ok( - build_test_plan_command::, - gradle(), - "gradle", - json!({ "root": ".", "project": core, "suite": "demo.core.GreeterTest" }), - ); - assert_eq!( - arguments(&outcome), - [ - "--console=plain", - ":core:test", - "--tests", - "demo.core.GreeterTest" - ] - ); - assert_eq!( - outcome["plan"]["results"], - json!({ "decoder": "junitXml", "reports": ["core/build/test-results/test/TEST-*.xml"] }) - ); - - let outcome = ok( - build_test_plan_command::, - gradle(), - "gradle", - json!({ "root": ".", "projects": [".", "app", "core"] }), - ); - assert_eq!(arguments(&outcome), ["--console=plain", "test"]); -} - -/// A project's dependency tree names the project in the build tool's own -/// terms; the workspace tree asks for every project. -#[test] -fn published_dependency_plans() { - let workspace = Workspace::new("published-dependency-plans"); - let plugin_directory = workspace.path("plugins/p"); - let output_file = workspace.path("state/deps.json"); - let request = |project: Option| { - let mut request = json!({ - "root": ".", - "pluginDirectory": plugin_directory, - "outputFile": output_file, - }); - if let Some(project) = project { - request["project"] = project; - } - request - }; - let app = json!({ "path": "app", "name": "app", "properties": { "path": ":app", "taskPrefix": ":app:" } }); - let outcome = ok( - build_dependency_plan_command::, - maven(), - "maven", - request(Some(app.clone())), - ); - assert_eq!( - arguments(&outcome), - [ - "-B", - "-ntp", - &format!("-Dmaven.ext.class.path={plugin_directory}/lib/lithe-maven-extension.jar"), - &format!("-Dlithe.dependenciesOutput={output_file}"), - "-Dlithe.dependenciesProject=app", - "pre-clean", - ] - ); - let outcome = ok( - build_dependency_plan_command::, - maven(), - "maven", - request(None), - ); - assert!( - !arguments(&outcome) - .iter() - .any(|argument| argument.contains("dependenciesProject")), - "{outcome}" - ); - - let outcome = ok( - build_dependency_plan_command::, - gradle(), - "gradle", - request(Some(app)), - ); - assert_eq!( - arguments(&outcome), - [ - "--console=plain", - "-q", - "--no-configuration-cache", - "--no-configure-on-demand", - "--init-script", - &format!("{plugin_directory}/lithe.init.gradle"), - &format!("-PlitheDependenciesOutput={output_file}"), - "-PlitheDependenciesProject=:app", - "litheDependencyReport", - ] - ); - assert_eq!(outcome["plan"]["decoder"], "litheDependencies"); -} - -/// The captured trees decode with their scopes, project nodes and -/// transitive children intact. -#[test] -fn published_captured_dependencies_decode() { - let decode = |manifest: Value, build_system: &str, captured: &str, project: Option<&str>| { - let workspace = Workspace::new("published-dependencies"); - let output = workspace.capture("state/deps.json", captured); - let mut request = - json!({ "workspaceRoot": workspace.root(), "root": ".", "outputFile": output }); - if let Some(project) = project { - request["project"] = json!(project); - } - ok( - build_decode_dependencies_command::, - manifest, - build_system, - request, - )["dependencies"]["dependencies"] - .clone() - }; - - let tree = decode(maven(), "maven", MAVEN_APP_DEPENDENCIES, Some("app")); - assert_eq!( - [&tree[0]["name"], &tree[0]["group"], &tree[0]["scope"]], - ["core", "demo", "compile"] - ); - let tree = decode(maven(), "maven", MAVEN_DEPENDENCIES, None); - assert_eq!(strings(&tree, "name"), ["reactor", "core", "app"]); - let junit = &tree[1]["children"][0]; - assert_eq!( - [&junit["name"], &junit["version"], &junit["scope"]], - ["junit", "4.13.2", "test"] - ); - assert_eq!(junit["children"][0]["name"], "hamcrest-core"); - - let tree = decode(gradle(), "gradle", GRADLE_APP_DEPENDENCIES, Some("app")); - assert_eq!( - strings(&tree, "name"), - [ - "compileClasspath", - "runtimeClasspath", - "testCompileClasspath", - "testRuntimeClasspath" - ] - ); - assert_eq!( - tree[0]["children"][0]["properties"], - json!({ "kind": "project", "path": ":core" }) - ); - let tree = decode(gradle(), "gradle", GRADLE_DEPENDENCIES, None); - assert_eq!(strings(&tree, "name"), ["multi", "app", "core"]); - let test_classpath = tree[2]["children"] - .as_array() - .unwrap() - .iter() - .find(|node| node["name"] == "testCompileClasspath") - .unwrap(); - assert_eq!(test_classpath["children"][0]["name"], "junit"); - assert_eq!( - test_classpath["children"][0]["children"][0]["name"], - "hamcrest-core" - ); -} - -/// Compiler output in each tool's format becomes workspace-relative problems. -#[test] -fn published_diagnostics_decode() { - let workspace = Workspace::new("published-diagnostics"); - let root = workspace.root(); - let decode = |manifest: Value, build_system: &str, output: String| { - ok( - build_decode_diagnostics_command::, - manifest, - build_system, - json!({ "workspaceRoot": root, "root": ".", "output": output }), - )["diagnostics"] - .clone() - }; - - let diagnostics = decode( - maven(), - "maven", - format!( - "[INFO] Compiling 1 source file\n\ - [ERROR] {root}/core/src/main/java/demo/core/Greeter.java:[7,9] cannot find symbol\n\ - [WARNING] {root}/app/src/main/java/demo/app/Main.java:[3,1] deprecated\n\ - [ERROR] file://{root}/core/src/main/kotlin/Util.kt:4:2 Unresolved reference: x\n" - ), - ); - assert_eq!( - diagnostics, - json!([ - { "path": "core/src/main/java/demo/core/Greeter.java", "line": 7, "column": 9, "severity": "error", "message": "cannot find symbol" }, - { "path": "app/src/main/java/demo/app/Main.java", "line": 3, "column": 1, "severity": "warning", "message": "deprecated" }, - { "path": "core/src/main/kotlin/Util.kt", "line": 4, "column": 2, "severity": "error", "message": "Unresolved reference: x" }, - ]) - ); - - let diagnostics = decode( - gradle(), - "gradle", - format!( - "> Task :core:compileJava\n\ - {root}/core/src/main/java/demo/core/Greeter.java:7: error: ';' expected\n\ - w: file://{root}/app/build.gradle.kts:3:5 Variable 'x' is never used\n" - ), - ); - assert_eq!( - strings(&diagnostics, "path"), - [ - "core/src/main/java/demo/core/Greeter.java", - "app/build.gradle.kts" - ] - ); - assert_eq!(strings(&diagnostics, "severity"), ["error", "warning"]); -} diff --git a/rust/crates/core/src/tests/synthetic_build_plugins.rs b/rust/crates/core/src/tests/synthetic_build_plugins.rs new file mode 100644 index 00000000..28cd44a9 --- /dev/null +++ b/rust/crates/core/src/tests/synthetic_build_plugins.rs @@ -0,0 +1,506 @@ +//! Build command integration using an inline, fictional plugin and documents. +//! Real build tools and their captured output belong to the plugin repositories; +//! these tests preserve Core's validation, planning and decoding boundaries. + +use super::support::temporary_root; +use crate::build::{ + build_decode_dependencies_command, build_decode_diagnostics_command, + build_decode_model_command, build_dependency_plan_command, build_detect_command, + build_model_plan_command, build_task_plan_command, build_test_plan_command, +}; +use lithe_plugin_manifest::{validate_command, DeclarativePluginManifest as Manifest}; +use lithe_plugin_marketplace::install_review_command; +use serde_json::{json, Value}; +use std::fs; +use std::path::PathBuf; + +fn manifest() -> Value { + json!({ + "schemaVersion": 0, + "id": "dev.lithe.test.build-bridge", + "displayName": "Synthetic Build Bridge", + "version": "0.1.0", + "pluginAPIVersion": 0, + "requires": { "buildSystems": 0 }, + "vendor": { + "id": "dev.lithe.test", "displayName": "Test", + "signatureRequirement": "publisherPackage", + }, + "permissions": ["process.build"], + "activationEvents": ["onBuildSystem:fixture-build"], + "languages": [], + "buildSystems": [{ + "id": "fixture-build", "displayName": "Fixture Build", + "detection": { "markers": ["Fixture.build"], "nesting": "outermost" }, + "invocation": { + "executables": [{ "kind": "command", "command": "fixture-build" }], + "globalArguments": ["--batch", "${optionArguments}"], + }, + "options": [ + { "id": "offline", "displayName": "Offline", "kind": "boolean", + "arguments": ["--offline"] }, + { "id": "modes", "displayName": "Modes", "kind": "multiSelect", + "choicesFromModel": true, "allowCustom": true, + "arguments": ["--modes", "${value}"] }, + { "id": "cache", "displayName": "Cache", "kind": "directory", + "arguments": ["--cache", "${value}"] }, + ], + "model": { + "source": "command", + "arguments": ["model", "${pluginDir}/fixture.bridge", "${outputFile}"], + "output": "outputFile", "decoder": "litheBuildModel", + "executesProjectCode": true, "mayUseNetwork": false, + }, + "tasks": [ + { "id": "compile", "displayName": "Compile", "group": "build", + "scopes": ["workspace", "project"], + "arguments": [ + { "value": "--project", "when": "nestedProjectSelected" }, + { "value": "${project.path}", "when": "nestedProjectSelected" }, + "compile", + ] }, + { "id": "model-task", "displayName": "Model Task", "group": "other", + "fromModel": true, "arguments": ["${task.property:selector}"] }, + { "id": "custom", "displayName": "Custom Task", "group": "other", + "scopes": ["workspace", "project"], "requiresUserArguments": true, + "arguments": [ + { "value": "--directory", "when": "nestedProjectSelected" }, + { "value": "${project.path}", "when": "nestedProjectSelected" }, + "${userArguments}", + ] }, + ], + "run": [{ + "id": "application", + "fromTasks": { "templates": ["model-task"], "executions": ["application"] }, + "workingDirectory": "root", + }], + "test": { + "scopes": ["workspace", "project"], "filters": ["suite", "case"], + "arguments": [ + "test", + { "value": "--project", "when": "nestedProjectSelected" }, + { "value": "${project.path}", "when": "nestedProjectSelected" }, + { "value": "--select", "when": "suiteSelected" }, + { "value": "${test.suite}", "when": ["suiteSelected", "noCaseSelected"] }, + { "value": "${test.suite}#${test.case}", "when": ["suiteSelected", "caseSelected"] }, + ], + "results": { "decoder": "junitXml", "reports": ["out/tests/TEST-*.xml"] }, + }, + "dependencies": { + "source": "command", "scopes": ["workspace", "project"], + "arguments": [ + "dependencies", "${pluginDir}/fixture.bridge", "${outputFile}", + { "value": "--project=${project.path}", "when": "projectSelected" }, + ], + "output": "outputFile", "decoder": "litheDependencies", + "executesProjectCode": true, "mayUseNetwork": false, + }, + "diagnostics": { + "decoder": "lineMatcher", + "patterns": [{ + "regex": "^(ERR|WARN) (.+)\\|([0-9]+)\\|([0-9]+)\\|(.+)$", + "file": 2, "line": 3, "column": 4, "message": 5, "severity": 1, + "severities": { "ERR": "error", "WARN": "warning" }, + }, { + "regex": "^note://(.+)\\|([0-9]+)\\|(.+)$", + "file": 1, "line": 2, "message": 3, "defaultSeverity": "warning", + }], + }, + }], + }) +} + +/// Owns only the temporary files this test creates, including on assertion failure. +struct Workspace(PathBuf); + +impl Workspace { + fn new() -> Self { + let root = temporary_root("synthetic-build-plugin"); + fs::create_dir_all(&root).unwrap(); + Self(root) + } + + fn root(&self) -> String { + self.0.to_string_lossy().into_owned() + } + + fn path(&self, relative: &str) -> String { + self.0.join(relative).to_string_lossy().into_owned() + } + + fn write(&self, relative: &str, contents: &str) -> String { + let path = self.0.join(relative); + fs::create_dir_all(path.parent().unwrap()).unwrap(); + fs::write(&path, contents).unwrap(); + path.to_string_lossy().into_owned() + } + + fn document(&self, relative: &str, document: Value) -> String { + // Serialize native paths as JSON data rather than replacing text inside strings. + self.write(relative, &serde_json::to_string(&document).unwrap()) + } +} + +impl Drop for Workspace { + fn drop(&mut self) { + // log-exempt: test-cleanup: best effort while an assertion may be unwinding. + let _ = fs::remove_dir_all(&self.0); + } +} + +type Command = fn(Value) -> Result; + +fn ok(command: Command, request: Value) -> Value { + let outcome = command(json!({ + "manifest": manifest(), "buildSystemID": "fixture-build", + "request": super::support::trusted(request), + })) + .expect("payload is well formed"); + assert_eq!(outcome["status"], "ok", "{outcome}"); + outcome +} + +fn arguments(outcome: &Value) -> Vec<&str> { + outcome["plan"]["arguments"] + .as_array() + .unwrap() + .iter() + .map(|argument| argument.as_str().unwrap()) + .collect() +} + +fn strings(value: &Value, key: &str) -> Vec { + value + .as_array() + .unwrap() + .iter() + .map(|item| item[key].as_str().unwrap().to_owned()) + .collect() +} + +fn model(workspace: &Workspace) -> Value { + json!({ + "format": "litheBuildModel", "version": 0, + "projects": [ + { "path": workspace.path("library"), "name": "library", "parent": workspace.root() }, + { "path": workspace.root(), "name": "workspace", "displayName": "Fixture Workspace" }, + { "path": workspace.path("app"), "name": "app", "parent": workspace.root() }, + ], + "tasks": [ + { "project": workspace.path("library"), "name": "verify", "template": "model-task", + "category": ["Checks", "contract"], "properties": { "selector": "library/verify" } }, + { "project": workspace.path("app"), "name": "launch", "template": "model-task", + "execution": "application", "properties": { "selector": "app/launch" } }, + ], + "contentRoots": [ + { "project": workspace.path("library"), "path": workspace.path("library/tests"), "kind": "testSource" }, + { "project": workspace.path("app"), "path": workspace.path("app/out/generated"), "kind": "generatedSource" }, + ], + "optionValues": { "modes": ["ci", "release"] }, + }) +} + +fn decode_model(workspace: &Workspace, document: Value) -> Value { + let output = workspace.document("state/model.json", document); + ok( + build_decode_model_command::, + json!({ + "workspaceRoot": workspace.root(), "root": ".", "outputFile": output, + }), + )["model"] + .clone() +} + +#[test] +fn synthetic_build_plugin_validates_and_is_in_install_review() { + let outcome = validate_command(json!({ "manifest": manifest() })).unwrap(); + assert_eq!(outcome["status"], "ok", "{outcome}"); + let review = install_review_command(json!({ "manifest": manifest() })).unwrap(); + assert_eq!(review["status"], "ok", "{review}"); + let programs = review["review"]["programs"].as_array().unwrap(); + let program = programs + .iter() + .find(|program| program["kind"] == "buildSystem") + .unwrap(); + assert_eq!(program["buildSystemID"], "fixture-build"); +} + +#[test] +fn synthetic_build_detection_keeps_only_the_outermost_instance() { + let workspace = Workspace::new(); + workspace.write("Fixture.build", "root"); + workspace.write("app/Fixture.build", "nested"); + let outcome = build_detect_command::(json!({ + "workspaceRoot": workspace.root(), "plugins": [{ "manifest": manifest() }], "options": {}, + })) + .unwrap(); + assert_eq!(outcome["status"], "ok", "{outcome}"); + assert_eq!( + strings(&outcome["detection"]["instances"], "id"), + ["fixture-build:."], + "{outcome}" + ); +} + +#[test] +fn synthetic_model_plan_expands_package_output_and_options() { + let workspace = Workspace::new(); + let plugin = workspace.path("plugins/bridge"); + let output = workspace.path("state/model.json"); + let cache = workspace.path("cache"); + let outcome = ok( + build_model_plan_command::, + json!({ + "root": ".", "pluginDirectory": plugin, "outputFile": output, + "options": { "offline": true, "modes": ["release", "ci"], "cache": cache }, + }), + ); + assert_eq!( + arguments(&outcome), + [ + "--batch", + "--offline", + "--modes", + "ci,release", + "--cache", + &cache, + "model", + &format!("{plugin}/fixture.bridge"), + &output, + ] + ); + assert_eq!(outcome["plan"]["decoder"], "litheBuildModel"); + assert_eq!(outcome["plan"]["executesProjectCode"], true); + assert_eq!(outcome["plan"]["mayUseNetwork"], false); +} + +#[test] +fn synthetic_model_decodes_sorted_projects_tasks_roots_and_choices() { + let workspace = Workspace::new(); + let model = decode_model(&workspace, model(&workspace)); + assert_eq!(strings(&model["projects"], "path"), [".", "app", "library"]); + assert_eq!(model["projects"][0]["displayName"], "Fixture Workspace"); + assert_eq!(model["projects"][2]["parentID"], model["projects"][0]["id"]); + assert_eq!(model["optionValues"]["modes"], json!(["ci", "release"])); + let tasks = model["tasks"].as_array().unwrap(); + let task = tasks.iter().find(|task| task["name"] == "verify").unwrap(); + assert_eq!(task["template"], "model-task"); + assert_eq!(task["category"], json!(["Checks", "contract"])); + assert_eq!(task["properties"]["selector"], "library/verify"); + let roots = model["contentRoots"].as_array().unwrap(); + for (path, kind) in [ + ("library/tests", "testSource"), + ("app/out/generated", "generatedSource"), + ] { + assert!( + roots + .iter() + .any(|root| root["path"] == path && root["kind"] == kind), + "{model}" + ); + } +} + +#[test] +fn synthetic_model_only_exposes_tasks_with_the_declared_execution_kind_as_runs() { + let workspace = Workspace::new(); + let mut document = model(&workspace); + let decoded = decode_model(&workspace, document.clone()); + let run = decoded["run"].as_array().unwrap(); + assert_eq!(run.len(), 1, "{decoded}"); + assert_eq!(run[0]["name"], "launch"); + assert_eq!(run[0]["execution"], "application"); + assert_eq!(run[0]["args"], json!(["--batch", "app/launch"])); + assert_eq!(run[0]["cwd"], "."); + document["tasks"][1] + .as_object_mut() + .unwrap() + .remove("execution"); + let decoded = decode_model(&workspace, document); + assert!( + decoded["run"].as_array().is_none_or(Vec::is_empty), + "{decoded}" + ); +} + +#[test] +fn synthetic_task_plans_select_modules_and_use_opaque_model_properties() { + let outcome = ok( + build_task_plan_command::, + json!({ + "root": ".", "task": "compile", "project": { "path": "app", "name": "app" }, + "options": { "offline": true }, + }), + ); + assert_eq!( + arguments(&outcome), + ["--batch", "--offline", "--project", "app", "compile"] + ); + for selector in ["verify", "library/verify", "opaque:group:task"] { + let outcome = ok( + build_task_plan_command::, + json!({ + "root": ".", "task": "model-task", "project": { "path": ".", "name": "workspace" }, + "modelTask": { "name": "verify", "properties": { "selector": selector } }, + }), + ); + assert_eq!(arguments(&outcome), ["--batch", selector]); + } +} + +#[test] +fn synthetic_custom_tasks_preserve_arguments_and_nested_project_selection() { + for (path, expected) in [ + (".", vec!["--batch", "--offline", "inspect", "one argument"]), + ( + "library", + vec![ + "--batch", + "--offline", + "--directory", + "library", + "inspect", + "one argument", + ], + ), + ] { + let outcome = ok( + build_task_plan_command::, + json!({ + "root": ".", "task": "custom", "project": { "path": path, "name": path }, + "options": { "offline": true }, "userArguments": ["inspect", "one argument"], + }), + ); + assert_eq!(arguments(&outcome), expected); + } +} + +#[test] +fn synthetic_test_plans_keep_filters_and_project_relative_report_globs() { + for (case, selector) in [ + (None, "FixtureSuite"), + (Some("works"), "FixtureSuite#works"), + ] { + let mut request = json!({ + "root": ".", "project": { "path": "library", "name": "library" }, "suite": "FixtureSuite", + }); + if let Some(case) = case { + request["case"] = json!(case); + } + let outcome = ok(build_test_plan_command::, request); + assert_eq!( + arguments(&outcome), + [ + "--batch", + "test", + "--project", + "library", + "--select", + selector + ] + ); + assert_eq!( + outcome["plan"]["results"], + json!({ + "decoder": "junitXml", "reports": ["library/out/tests/TEST-*.xml"], + }) + ); + } + let outcome = ok( + build_test_plan_command::, + json!({ + "root": ".", "projects": [".", "app", "library"], + }), + ); + assert_eq!(arguments(&outcome), ["--batch", "test"]); + assert_eq!( + outcome["plan"]["results"]["reports"], + json!([ + "out/tests/TEST-*.xml", + "app/out/tests/TEST-*.xml", + "library/out/tests/TEST-*.xml", + ]) + ); +} + +#[test] +fn synthetic_dependency_plans_distinguish_workspace_and_project_queries() { + let workspace = Workspace::new(); + let plugin = workspace.path("plugins/bridge"); + let output = workspace.path("state/dependencies.json"); + for project in [None, Some("app")] { + let mut request = json!({ "root": ".", "pluginDirectory": plugin, "outputFile": output }); + if let Some(project) = project { + request["project"] = json!({ "path": project, "name": project }); + } + let outcome = ok(build_dependency_plan_command::, request); + let bridge = format!("{plugin}/fixture.bridge"); + let mut expected = vec!["--batch", "dependencies", &bridge, &output]; + if project.is_some() { + expected.push("--project=app"); + } + assert_eq!(arguments(&outcome), expected); + assert_eq!(outcome["plan"]["decoder"], "litheDependencies"); + } +} + +#[test] +fn synthetic_dependencies_preserve_scopes_properties_and_transitive_topology() { + let workspace = Workspace::new(); + let dependency = json!({ + "name": "library", "group": "example", "version": "2.0", "scope": "compile", + "properties": { "kind": "project", "selector": "opaque/library" }, + "children": [{ "name": "support", "version": "1.0", "scope": "test", "children": [] }], + }); + for project in [None, Some("app")] { + let dependencies = if project.is_some() { + json!([dependency.clone()]) + } else { + json!([ + { "name": "workspace", "children": [] }, + { "name": "app", "children": [dependency.clone()] }, + ]) + }; + let output = workspace.document( + "state/dependencies.json", + json!({ + "format": "litheDependencies", "version": 0, "dependencies": dependencies, + }), + ); + let mut request = + json!({ "workspaceRoot": workspace.root(), "root": ".", "outputFile": output }); + if let Some(project) = project { + request["project"] = json!(project); + } + let outcome = ok(build_decode_dependencies_command::, request); + let tree = &outcome["dependencies"]["dependencies"]; + if project.is_none() { + assert_eq!(strings(tree, "name"), ["workspace", "app"]); + } + assert_eq!(*tree, dependencies); + assert_eq!(outcome["dependencies"]["truncated"], false); + } +} + +#[test] +fn synthetic_diagnostics_use_declared_patterns_and_workspace_relative_paths() { + let workspace = Workspace::new(); + let outcome = ok( + build_decode_diagnostics_command::, + json!({ + "workspaceRoot": workspace.root(), "root": ".", + "output": format!( + "progress without a location\nERR {}|7|9|missing declaration\nWARN {}|3|1|old declaration\nnote://{}|4|unused value\n", + workspace.path("library/source.fixture"), workspace.path("app/source.fixture"), workspace.path("app/config.fixture"), + ), + }), + ); + assert_eq!( + outcome["diagnostics"], + json!([ + { "path": "library/source.fixture", "line": 7, "column": 9, "severity": "error", "message": "missing declaration" }, + { "path": "app/source.fixture", "line": 3, "column": 1, "severity": "warning", "message": "old declaration" }, + { "path": "app/config.fixture", "line": 4, "severity": "warning", "message": "unused value" }, + ]) + ); +}