Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align default output folder with Gradle best practices #755

Merged
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class ProtobufExtension {
this.tasks = new GenerateProtoTaskCollection(project)
this.tools = new ToolsLocator(project)
this.taskConfigActions = []
this.defaultGeneratedFilesBaseDir = project.layout.buildDirectory.dir("generated/source/proto").map {
this.defaultGeneratedFilesBaseDir = project.layout.buildDirectory.dir("generated/sources/proto").map {
it.asFile.path
}
this.generatedFilesBaseDirProperty.convention(defaultGeneratedFilesBaseDir)
Expand Down Expand Up @@ -107,7 +107,7 @@ abstract class ProtobufExtension {

/**
* The base directory of generated files. The default is
* "${project.buildDir}/generated/source/proto".
* "${project.buildDir}/generated/sources/proto".
*/
@PackageScope
abstract Property<String> getGeneratedFilesBaseDirProperty()
Expand Down
26 changes: 13 additions & 13 deletions src/test/groovy/com/google/protobuf/gradle/IDESupportTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,28 @@ class IDESupportTest extends Specification {
'file://$MODULE_DIR$/build/extracted-protos/main',
'file://$MODULE_DIR$/build/extracted-include-protos/main',
'file://$MODULE_DIR$/build/extracted-protos/grpc',
'file://$MODULE_DIR$/build/generated/source/proto/grpc/java',
'file://$MODULE_DIR$/build/generated/source/proto/grpc/grpc_output',
'file://$MODULE_DIR$/build/generated/source/proto/main/java',
'file://$MODULE_DIR$/build/generated/sources/proto/grpc/java',
'file://$MODULE_DIR$/build/generated/sources/proto/grpc/grpc_output',
'file://$MODULE_DIR$/build/generated/sources/proto/main/java',
]
Set<String> expectedTestSourceDir = [
'file://$MODULE_DIR$/src/test/java',
'file://$MODULE_DIR$/src/test/proto',
'file://$MODULE_DIR$/build/extracted-protos/test',
'file://$MODULE_DIR$/build/extracted-include-protos/test',
'file://$MODULE_DIR$/build/generated/source/proto/test/java',
'file://$MODULE_DIR$/build/generated/sources/proto/test/java',
]
Set<String> expectedGeneratedDirs = [
'file://$MODULE_DIR$/build/extracted-include-protos/grpc',
'file://$MODULE_DIR$/build/extracted-protos/main',
'file://$MODULE_DIR$/build/extracted-include-protos/main',
'file://$MODULE_DIR$/build/extracted-protos/grpc',
'file://$MODULE_DIR$/build/generated/source/proto/grpc/java',
'file://$MODULE_DIR$/build/generated/source/proto/grpc/grpc_output',
'file://$MODULE_DIR$/build/generated/source/proto/main/java',
'file://$MODULE_DIR$/build/generated/sources/proto/grpc/java',
'file://$MODULE_DIR$/build/generated/sources/proto/grpc/grpc_output',
'file://$MODULE_DIR$/build/generated/sources/proto/main/java',
'file://$MODULE_DIR$/build/extracted-protos/test',
'file://$MODULE_DIR$/build/extracted-include-protos/test',
'file://$MODULE_DIR$/build/generated/source/proto/test/java',
'file://$MODULE_DIR$/build/generated/sources/proto/test/java',
]
assert Objects.equals(expectedSourceDir, sourceDir)
assert Objects.equals(expectedTestSourceDir, testSourceDir)
Expand Down Expand Up @@ -143,7 +143,7 @@ class IDESupportTest extends Specification {
srcEntries.each {
String path = it.@path
sourceDir.add(path)
if (path.startsWith("build/generated/source/proto")) {
if (path.startsWith("build/generated/sources/proto")) {
if (path.contains("test")) {
// test source path has one more attribute: ["test"="true"]
assert it.attributes.attribute.size() == 3
Expand All @@ -156,10 +156,10 @@ class IDESupportTest extends Specification {
Set<String> expectedSourceDir = [
'src/main/java',
'src/test/java',
'build/generated/source/proto/grpc/java',
'build/generated/source/proto/grpc/grpc_output',
'build/generated/source/proto/main/java',
'build/generated/source/proto/test/java',
'build/generated/sources/proto/grpc/java',
'build/generated/sources/proto/grpc/grpc_output',
'build/generated/sources/proto/main/java',
'build/generated/sources/proto/test/java',
]
assert Objects.equals(expectedSourceDir, sourceDir)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ProtobufKotlinDslCopySpecTest extends Specification {
}

private static void verifyProjectDir(File projectDir) {
File generatedSrcDir = new File(projectDir.path, "build/generated/source/proto/main/java")
File generatedSrcDir = new File(projectDir.path, "build/generated/sources/proto/main/java")
List<File> fileList = []
generatedSrcDir.eachFileRecurse { file ->
if (file.path.endsWith('.java')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class ProtobufPluginTestHelper {

static void verifyProjectDir(File projectDir) {
['grpc', 'main', 'test'].each {
File generatedSrcDir = new File(projectDir.path, "build/generated/source/proto/$it")
File generatedSrcDir = new File(projectDir.path, "build/generated/sources/proto/$it")
List<File> fileList = []
generatedSrcDir.eachFileRecurse { file ->
if (file.path.endsWith('.java')) {
Expand Down
Loading