This is an automated email from the ASF dual-hosted git repository.

snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 8859e80  Apprunner: add smoketest to validate Gradle plugin 
publication (#67)
8859e80 is described below

commit 8859e80292f0d29383455a7c8eaab0b1cc5fe62f
Author: Robert Stupp <[email protected]>
AuthorDate: Mon Dec 8 23:23:55 2025 +0100

    Apprunner: add smoketest to validate Gradle plugin publication (#67)
---
 apprunner/build.gradle.kts                         |  4 +-
 apprunner/gradle-plugin/build.gradle.kts           | 51 ++++++++++++++++++++++
 apprunner/gradle-plugin/src/smoketest/.gitignore   | 20 +++++++++
 apprunner/gradle-plugin/src/smoketest/build.gradle | 28 ++++++++++++
 apprunner/gradle-plugin/src/smoketest/gradle       |  1 +
 apprunner/gradle-plugin/src/smoketest/gradlew      |  1 +
 .../gradle-plugin/src/smoketest/settings.gradle    | 24 ++++++++++
 7 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/apprunner/build.gradle.kts b/apprunner/build.gradle.kts
index 6ccc3e5..18cbd05 100644
--- a/apprunner/build.gradle.kts
+++ b/apprunner/build.gradle.kts
@@ -78,7 +78,9 @@ tasks.named<RatTask>("rat").configure {
   excludes.add(".java-version")
   excludes.add("**/.keep")
 
-  excludes.add("gradle/wrapper/gradle-wrapper*.jar*")
+  excludes.add("**/gradle/wrapper/gradle-wrapper*.jar*")
+  // This gradle.properties is git-ignored and generated during the build
+  excludes.add("gradle-plugin/src/smoketest/gradle.properties")
 
   excludes.add("**/*.iml")
   excludes.add("**/*.iws")
diff --git a/apprunner/gradle-plugin/build.gradle.kts 
b/apprunner/gradle-plugin/build.gradle.kts
index 19cf103..cff041e 100644
--- a/apprunner/gradle-plugin/build.gradle.kts
+++ b/apprunner/gradle-plugin/build.gradle.kts
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+import java.io.OutputStream
+
 plugins {
   // Order of java-gradle-plugin + polaris-apprunner-java matters!
   `java-gradle-plugin`
@@ -49,3 +51,52 @@ tasks.named<Test>("test") {
   systemProperty("polaris-version", version)
   systemProperty("junit-version", libs.junit.bom.get().version.toString())
 }
+
+// Test to ensure that the plugin works from a local Maven repository 
publication.
+val smokeTest by
+  tasks.registering(Exec::class) {
+    // GenerateMavenPom + publishing tasks are not cacheable, so we cannot 
this task at all.
+
+    // polaris-apprunner parent pom
+    dependsOn(":publishToMavenLocal")
+    // polaris-apprunner-common pom + jar
+    dependsOn(":polaris-apprunner-common:publishToMavenLocal")
+    // polaris-apprunner-gradle-plugin pom + jar
+    dependsOn("publishToMavenLocal")
+
+    workingDir = projectDir.resolve("src/smoketest")
+    // Listing the tasks is enough to "configure everything",
+    // including the apprunner plugin configuration code.
+    commandLine("./gradlew", "tasks", "--all", "--stacktrace")
+
+    val logFile = layout.buildDirectory.file("reports/smoketest/smoketest.log")
+
+    isIgnoreExitValue = true
+
+    var outStream: OutputStream? = null
+    doFirst {
+      
workingDir.resolve("gradle.properties").writeText("apprunnerVersion=$version\n")
+
+      logFile.get().asFile.parentFile.mkdirs()
+      outStream = logFile.get().asFile.outputStream()
+      standardOutput = outStream
+      errorOutput = outStream
+    }
+
+    doLast {
+      outStream?.close()
+
+      if (executionResult.get().exitValue != 0) {
+        throw GradleException(
+          """
+                |Gradle plugin smoke test failed
+                |
+                |${logFile.get().asFile.readText()}
+                """
+            .trimMargin()
+        )
+      }
+    }
+  }
+
+tasks.named("check") { dependsOn(smokeTest) }
diff --git a/apprunner/gradle-plugin/src/smoketest/.gitignore 
b/apprunner/gradle-plugin/src/smoketest/.gitignore
new file mode 100644
index 0000000..21eba94
--- /dev/null
+++ b/apprunner/gradle-plugin/src/smoketest/.gitignore
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+/gradle.properties
\ No newline at end of file
diff --git a/apprunner/gradle-plugin/src/smoketest/build.gradle 
b/apprunner/gradle-plugin/src/smoketest/build.gradle
new file mode 100644
index 0000000..aa4d5f3
--- /dev/null
+++ b/apprunner/gradle-plugin/src/smoketest/build.gradle
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+  id 'java-library'
+  id 'org.apache.polaris.apprunner' version "${apprunnerVersion}"
+}
+
+polarisQuarkusApp {
+  javaVersion = 21
+  includeTask(tasks.named("test"))
+}
diff --git a/apprunner/gradle-plugin/src/smoketest/gradle 
b/apprunner/gradle-plugin/src/smoketest/gradle
new file mode 120000
index 0000000..84b694e
--- /dev/null
+++ b/apprunner/gradle-plugin/src/smoketest/gradle
@@ -0,0 +1 @@
+../../../gradle
\ No newline at end of file
diff --git a/apprunner/gradle-plugin/src/smoketest/gradlew 
b/apprunner/gradle-plugin/src/smoketest/gradlew
new file mode 120000
index 0000000..ab9334b
--- /dev/null
+++ b/apprunner/gradle-plugin/src/smoketest/gradlew
@@ -0,0 +1 @@
+../../../gradlew
\ No newline at end of file
diff --git a/apprunner/gradle-plugin/src/smoketest/settings.gradle 
b/apprunner/gradle-plugin/src/smoketest/settings.gradle
new file mode 100644
index 0000000..e04e2c1
--- /dev/null
+++ b/apprunner/gradle-plugin/src/smoketest/settings.gradle
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+pluginManagement {
+  repositories {
+    mavenLocal()
+    gradlePluginPortal()
+  }
+}

Reply via email to