Skip to content

Commit

Permalink
Try to fix all tests by adopting new output path for generated sources
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerstolzenberg committed Nov 13, 2024
1 parent 97a1ace commit 19418b6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ protobuf {

Generated files are under `task.outputBaseDir` with a subdirectory per
builtin and plugin. This produces a folder structure of
``$buildDir/generated/source/proto/$sourceSet/$builtinPluginName``.
``$buildDir/generated/sources/proto/$sourceSet/$builtinPluginName``.

The subdirectory name, which is by default ``$builtinPluginName``, can be
changed by setting the ``outputSubDir`` property in the ``builtins`` or
Expand Down
4 changes: 2 additions & 2 deletions testProjectAndroidKotlinDsl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ fun assertJavaCompileHasProtoGeneratedDir(
compileJavaTask: JavaCompile,
codegenPlugins: Collection<String>
) {
val baseDir = File("${project.buildDir}/generated/source/proto/$variant")
val baseDir = File("${project.buildDir}/generated/sources/protos/$variant")
// The expected direct subdirectories under baseDir
val expectedDirs = codegenPlugins.map { codegenPlugin ->
File("${project.buildDir}/generated/source/proto/$variant/$codegenPlugin")
File("${project.buildDir}/generated/sources/proto/$variant/$codegenPlugin")
}.toSet()

val actualDirs = mutableSetOf<File>()
Expand Down
8 changes: 4 additions & 4 deletions testProjectBase/build_base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ test.doLast {

// Check generateDescriptorSet option has been honored
['main', 'test'].each { sourceSet ->
assertFileExists(false, "$buildDir/generated/source/proto/$sourceSet/descriptor_set.desc")
assertFileExists(false, "$buildDir/generated/sources/proto/$sourceSet/descriptor_set.desc")
}
assertFileExists(true, "$buildDir/generated/source/proto/grpc/descriptor_set.desc")
assertFileExists(true, "$buildDir/generated/sources/proto/grpc/descriptor_set.desc")
}

rootProject.ext {
Expand All @@ -108,10 +108,10 @@ rootProject.ext {
// not include any other dirs under the generated code base dir.
assertJavaCompileHasProtoGeneratedDir = {
Project project, String sourceSet, JavaCompile compileJavaTask, Collection<String> codegenPlugins ->
def baseDir = "${project.buildDir}/generated/source/proto/$sourceSet" as File
def baseDir = "${project.buildDir}/generated/sources/proto/$sourceSet" as File
// The expected direct subdirectories under baseDir
def expectedDirs = codegenPlugins.collect { codegenPlugin ->
"${project.buildDir}/generated/source/proto/$sourceSet/$codegenPlugin" as File
"${project.buildDir}/generated/sources/proto/$sourceSet/$codegenPlugin" as File
} as Set

def actualDirs = new HashSet()
Expand Down
8 changes: 4 additions & 4 deletions testProjectKotlinDslBase/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ tasks {
assertJavaCompileHasProtoGeneratedDir("grpc", listOf("java", "grpc_output"))

listOf("main", "test").forEach { sourceSet ->
assertFileExists(false, "$buildDir/generated/source/proto/$sourceSet/descriptor_set.desc")
assertFileExists(false, "$buildDir/generated/sources/proto/$sourceSet/descriptor_set.desc")
}
assertFileExists(true, "$buildDir/generated/source/proto/grpc/descriptor_set.desc")
assertFileExists(true, "$buildDir/generated/sources/proto/grpc/descriptor_set.desc")
}
}
}
Expand All @@ -123,10 +123,10 @@ fun assertJavaCompileHasProtoGeneratedDir(
compileJavaTask: JavaCompile,
codegenPlugins: Collection<String>
) {
val baseDir = File("${project.buildDir}/generated/source/proto/$sourceSet")
val baseDir = File("${project.buildDir}/generated/sources/proto/$sourceSet")
// The expected direct subdirectories under baseDir
val expectedDirs = codegenPlugins.map { codegenPlugin ->
File("${project.buildDir}/generated/source/proto/$sourceSet/$codegenPlugin")
File("${project.buildDir}/generated/sources/proto/$sourceSet/$codegenPlugin")
}.toSet()

val actualDirs = mutableSetOf<File>()
Expand Down

0 comments on commit 19418b6

Please sign in to comment.