Skip to content

Commit

Permalink
Merge pull request #182 from usefulness/renovate/gradle.starter
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski authored Nov 13, 2023
2 parents 8820952 + 24069d5 commit efd217a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ build/
.idea/*
*.iml
local.properties
*/src/generated/kotlin/io/github/usefulness/testing/screenshot/generated/ScreenshotTestBuildConfig.kt
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
gradle-starter = "0.65.0"
gradle-starter = "0.66.0"
gradle-pluginpublish = "1.2.1"
gradle-doctor = "0.9.0"
google-agp = "8.1.3"
Expand Down
11 changes: 6 additions & 5 deletions screenshot-testing-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ plugins {
}

final GENERATED_PACKAGE_NAME = "io.github.usefulness.testing.screenshot.generated"
final GENERATED_BUILD_DIR = new File(projectDir.absolutePath, "src/generated/kotlin/${GENERATED_PACKAGE_NAME.replace('.', '/')}")
final GENERATED_BUILD_DIR = layout.buildDirectory.map { it.dir("generated/config/${GENERATED_PACKAGE_NAME.replace('.', '/')}")}

tasks.register("generateBuildConfig") {
final version = project.version
doLast {
GENERATED_BUILD_DIR.deleteDir()
GENERATED_BUILD_DIR.mkdirs()
def generatedDir = GENERATED_BUILD_DIR.get().asFile
generatedDir.deleteDir()
generatedDir.mkdirs()

final className = "ScreenshotTestBuildConfig"
final configClass = new File(GENERATED_BUILD_DIR, "${className}.kt")
final configClass = new File(generatedDir, "${className}.kt")
BufferedWriter writer = configClass.newWriter()
try {
writer.writeLine("package $GENERATED_PACKAGE_NAME")
Expand All @@ -41,7 +42,7 @@ tasks.named("compileKotlin") {
dependsOn("generateBuildConfig")
sourceSets {
main {
kotlin.srcDirs += 'src/generated/kotlin'
kotlin.srcDir(GENERATED_BUILD_DIR)
resources.srcDirs 'src/py'
resources {
exclude '**/*.pyc'
Expand Down

0 comments on commit efd217a

Please sign in to comment.