<commit_before>@file:Suppress("UsePropertyAccessSyntax")

package com.squareup.wire.gradle

import okio.Path
import org.assertj.core.api.Assertions.assertThat
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import org.junit.After
import org.junit.Assert.fail
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
import java.io.IOException
import java.util.zip.ZipFile
import kotlin.text.RegexOption.DOT_MATCHES_ALL
import kotlin.text.RegexOption.MULTILINE

class WirePluginTest {

  @JvmField
  @Rule
  val tmpFolder = TemporaryFolder()

  private lateinit var gradleRunner: GradleRunner

  @Before
  fun setUp() {
    gradleRunner = GradleRunner.create()
        .withPluginClasspath()
        // Ensure individual tests are isolated and not reusing each other's previous outputs
        // by setting project dir and gradle home directly.
        .withProjectDir(tmpFolder.newFolder("project-dir"))
        .withArguments(
          "-g",
          tmpFolder.newFolder("gradle-home").absolutePath,
          "generateProtos",
          "--stacktrace",
          "--info",
          "--configuration-cache",
        )
        .withDebug(true)
  }

  @After
  fun clearOutputs() {
    // We clear outputs otherwise tests' tasks will be skip after their first execution.<commit_msg>Test confirming version exposure in the gradle plugin (#2164)<commit_after>@file:Suppress("UsePropertyAccessSyntax")

package com.squareup.wire.gradle

import com.squareup.wire.VERSION
import okio.Path
import org.assertj.core.api.Assertions.assertThat
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import org.junit.After
import org.junit.Assert.fail
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
import java.io.IOException
import java.util.zip.ZipFile
import kotlin.text.RegexOption.DOT_MATCHES_ALL
import kotlin.text.RegexOption.MULTILINE

class WirePluginTest {

  @JvmField
  @Rule
  val tmpFolder = TemporaryFolder()

  private lateinit var gradleRunner: GradleRunner

  @Before
  fun setUp() {
    gradleRunner = GradleRunner.create()
        .withPluginClasspath()
        // Ensure individual tests are isolated and not reusing each other's previous outputs
        // by setting project dir and gradle home directly.
        .withProjectDir(tmpFolder.newFolder("project-dir"))
        .withArguments(
          "-g",
          tmpFolder.newFolder("gradle-home").absolutePath,
          "generateProtos",
          "--stacktrace",
          "--info",
          "--configuration-cache",
        )
        .withDebug(true)
  }

  @Test fun versionIsExposed() {
    assertThat(VERSION).isNotNull()
  }

  @After
  fun clearOutputs() {
    // We clear outputs otherwise tests' tasks will be skip after their first execution.
{'fraction_non_alphanumeric': 0.09470568891811904, 'fraction_numerical': 0.0013153567905294311, 'mean_word_length': 3.408695652173913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3441311', 'n_tokens_mistral': 894, 'n_tokens_neox': 866, 'n_words': 209}