Repository: GradleUp/shadow
Pull request #1305 (2025-03-05 03:55:03)

Update doc code blocks and tests
Refs #1302.


Patch:
diff --git a/src/docs/getting-started/README.md b/src/docs/getting-started/README.md
index c651a363..7067b632 100644
--- a/src/docs/getting-started/README.md
+++ b/src/docs/getting-started/README.md
@@ -1,21 +1,21 @@
 # Getting Started
 
-```groovy no-run
+```groovy
 plugins {
   id 'java'
-  id 'com.gradleup.shadow' version '@version@'
+  id 'com.gradleup.shadow' version '<version>'
 }
 ```
 
 Alternatively, the plugin can be added to the buildscript classpath and applied:
 
-```groovy no-run
+```groovy
 buildscript {
   repositories {
     gradlePluginPortal()
   }
   dependencies {
-    classpath 'com.gradleup.shadow:shadow-gradle-plugin:@version@'
+    classpath 'com.gradleup.shadow:shadow-gradle-plugin:<version>'
   }
 }
 
@@ -31,14 +31,14 @@ Sonatype's snapshots repository</a>.
 </summary>
 <p>
 
-```groovy no-run
+```groovy
 buildscript {
   repositories {
     mavenCentral()
-    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
+    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
   }
   dependencies {
-    classpath 'com.gradleup.shadow:shadow-gradle-plugin:<snapshot-version>'
+    classpath 'com.gradleup.shadow:shadow-gradle-plugin:<version>'
   }
 }
 
diff --git a/src/docs/introduction/README.md b/src/docs/introduction/README.md
index e02a3504..21060564 100644
--- a/src/docs/introduction/README.md
+++ b/src/docs/introduction/README.md
@@ -26,8 +26,8 @@ It must be available on the target system.
 Executable JARs contain a JAR MANIFEST that specifies the application Main Class.
 This allows the application to be started with a single command:
 
-```bash
-$ java -jar application-shadow.jar
+```shell
+java -jar application-shadow.jar
 ```
 
 ### Library Bundling


Test patch:
diff --git a/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/executor/GroovyBuildExecutor.kt b/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/executor/GroovyBuildExecutor.kt
index aac341f2..d5958cd5 100644
--- a/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/executor/GroovyBuildExecutor.kt
+++ b/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/executor/GroovyBuildExecutor.kt
@@ -36,11 +36,16 @@ class GroovyBuildExecutor(
     val mainScript = buildString {
       append(imports)
       append(System.lineSeparator())
-      if (!snippetWithoutImports.contains("plugins {")) {
-        append(fixture.pluginsBlock)
-        append(System.lineSeparator())
+      // All buildscript {} blocks must appear before any plugins {} blocks in the script.
+      if (snippetWithoutImports.contains("buildscript {")) {
+        append(snippetWithoutImports)
+      } else {
+        if (!snippetWithoutImports.contains("plugins {")) {
+          append(fixture.pluginsBlock)
+          append(System.lineSeparator())
+        }
+        append(snippetWithoutImports)
       }
-      append(snippetWithoutImports)
       append(System.lineSeparator())
     }.trimIndent()
     tempDir.addSubProject("main", mainScript)
diff --git a/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/fixture/GroovyDslFixture.kt b/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/fixture/GroovyDslFixture.kt
index aef8bc17..5cc82e00 100644
--- a/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/fixture/GroovyDslFixture.kt
+++ b/src/integrationTest/kotlin/com/github/jengelman/gradle/plugins/shadow/fixture/GroovyDslFixture.kt
@@ -20,7 +20,8 @@ object GroovyDslFixture : SnippetFixture {
 
     listOf(
       imports.toString(),
-      scriptMinusImports.toString(),
+      // Replace the version placeholders.
+      scriptMinusImports.toString().replace("<version>", "+"),
     )
   }
 }