Skip to content

Commit

Permalink
Add reproducer
Browse files Browse the repository at this point in the history
  • Loading branch information
JBodkin-Amphora committed Feb 22, 2024
1 parent 4cdd48c commit 26675eb
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 27 deletions.
84 changes: 57 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
| :memo: | There is a matching reproducer for the Groovy DSL [here](https://github.com/gradle/gradle-issue-reproducer/tree/groovy-dsl) |
|---|---|

# Gradle issue reproducer

This is template repository to create reproducer projects for Gradle issues.
The template contains a GitHub Action definition that runs a Gradle build upon each code change.
To quickly learn how it works check the following screencast:

https://user-images.githubusercontent.com/419883/147940456-d0c96c90-f2b5-4574-8133-09647db9545a.mov

## How to use the template

- Fork this repository
- On the main page click the `Use this Template` button
- Specify the user/org name and a repository name
- Select `Public` for repository type
- Select `Include all branches`
- Click `Create Repositorty from template`
- Modify the project in the repository to reproduce the issue
- You can clone your new forked repository locally and push changes, as usual
- You can also edit your reprocer in an online editor by replacing `github.com` with `github.dev` in the URL (or by pressing the '.' key on the keyboard).
- Adjust the [GitHub Action file](.github/workflows/run-reproducer.yml)
- You can configure the executed Gradle tasks as well as the environment (task options, log level, JVM version, operating system, etc)
- The documentation for the Gradle GitHub Action is available [here](https://github.com/gradle/gradle-build-action)
- Verify that the reproducer exhibits the problem on the [GitHub Action page](https://github.com/gradle/gradle-issue-reproducer/actions)
- Link your reproducer to the issue
# Bug Reproducer

## Task 1

Run

```shell
gradlew :project-1:bootRun
```

### Expected

```
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':project-1:bootRun'.
> Process 'command 'C:\Program Files\Eclipse Adoptium\jdk-21.0.0.35-hotspot\bin\java.exe'' finished with non-zero exit value 1
```

### Actual

```
FAILURE: Build failed with an exception.
* What went wrong:
org/springframework/boot/gradle/tasks/run/BootRun
> org.springframework.boot.gradle.tasks.run.BootRun
```

## Task 2

Run

```shell
gradlew :project-2:bootRun
```

### Expected

```
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':project-1:bootRun'.
> Process 'command 'C:\Program Files\Eclipse Adoptium\jdk-21.0.0.35-hotspot\bin\java.exe'' finished with non-zero exit value 1
```

### Actual

```
FAILURE: Build failed with an exception.
* What went wrong:
org/springframework/boot/gradle/tasks/run/BootRun
> org.springframework.boot.gradle.tasks.run.BootRun
```
11 changes: 11 additions & 0 deletions plugin-1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

dependencies {
compileOnly("org.springframework.boot:spring-boot-gradle-plugin:3.2.2")
}
5 changes: 5 additions & 0 deletions plugin-1/src/main/kotlin/plugin-1.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import org.springframework.boot.gradle.tasks.run.BootRun

tasks.withType<BootRun>().configureEach {
jvmArguments.add("-broken")
}
1 change: 1 addition & 0 deletions plugin-1/src/main/kotlin/versions.settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// To provide Version Catalog
20 changes: 20 additions & 0 deletions plugin-2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
`kotlin-dsl`
}

gradlePlugin {
plugins {
create("plugin-2") {
id = "plugin-2"
implementationClass = "Plugin2"
}
}
}

repositories {
mavenCentral()
}

dependencies {
compileOnly("org.springframework.boot:spring-boot-gradle-plugin:3.2.2")
}
14 changes: 14 additions & 0 deletions plugin-2/src/main/kotlin/Plugin2.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType
import org.springframework.boot.gradle.tasks.run.BootRun

open class Plugin2 : Plugin<Project> {

override fun apply(project: Project) {
project.tasks.withType<BootRun>().configureEach {
jvmArgs("-broken")
}
}

}
14 changes: 14 additions & 0 deletions project-1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
java

id("org.springframework.boot") version "3.2.2"
id("plugin-1")
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:3.2.2")
}
7 changes: 7 additions & 0 deletions project-1/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pluginManagement {
includeBuild("../plugin-1")
}

plugins {
id("versions")
}
13 changes: 13 additions & 0 deletions project-1/src/main/java/project/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package project;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

}
14 changes: 14 additions & 0 deletions project-2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
java

id("org.springframework.boot") version "3.2.2"
id("plugin-2")
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:3.2.2")
}
3 changes: 3 additions & 0 deletions project-2/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pluginManagement {
includeBuild("../plugin-2")
}
13 changes: 13 additions & 0 deletions project-2/src/main/java/project/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package project;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

}
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
rootProject.name = "reproducer-project"

includeBuild("plugin-1")
includeBuild("plugin-2")

includeBuild("project-1")
includeBuild("project-2")

0 comments on commit 26675eb

Please sign in to comment.