Skip to content

Commit

Permalink
Replace Configuration to Conf in own methods, arguments, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
rougsig committed Nov 6, 2022
1 parent 281b8c0 commit 5cc9d89
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
24 changes: 12 additions & 12 deletions src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ProtobufPlugin implements Plugin<Project> {

// Sets up a task to extract protos from protobuf dependencies.
// They are treated as sources and will be compiled.
Configuration protobufConf = createProtobufConfiguration(protoSourceSet)
Configuration protobufConf = createProtobufConf(protoSourceSet)
TaskProvider<ProtobufExtract> extractProtosTask = registerExtractProtosTask(
protoSourceSet.getExtractProtoTaskName(),
protoSourceSet.name,
Expand Down Expand Up @@ -224,8 +224,8 @@ class ProtobufPlugin implements Plugin<Project> {
* configure dependencies for it. The extract-protos task of each source set will
* extract protobuf files from dependencies in this configuration.
*/
private Configuration createProtobufConfiguration(ProtoSourceSet protoSourceSet) {
String confName = protoSourceSet.getProtobufConfigurationName()
private Configuration createProtobufConf(ProtoSourceSet protoSourceSet) {
String confName = protoSourceSet.getProtobufConfName()
Configuration conf = project.configurations.create(confName)

conf.visible = false
Expand All @@ -244,7 +244,7 @@ class ProtobufPlugin implements Plugin<Project> {
// <p> For Java projects only.
// <p> This works around 'java-library' plugin not exposing resources to consumers for compilation.
private Configuration createCompileProtoPathConf(ProtoSourceSet protoSourceSet) {
String confName = protoSourceSet.getCompileProtoPathConfigurationName()
String confName = protoSourceSet.getCompileProtoPathConfName()
Configuration conf = project.configurations.create(confName)

conf.visible = false
Expand All @@ -256,9 +256,9 @@ class ProtobufPlugin implements Plugin<Project> {
}

private void configureProtoPathConfExtendsFromJvm(Configuration conf, ProtoSourceSet protoSourceSet) {
String compileOnlyConfName = protoSourceSet.getCompileOnlyConfigurationName()
String compileOnlyConfName = protoSourceSet.getCompileOnlyConfName()
Configuration compileOnlyConf = project.configurations.getByName(compileOnlyConfName)
String implementationConfName = protoSourceSet.getImplementationConfigurationName()
String implementationConfName = protoSourceSet.getImplementationConfName()
Configuration implementationConf = project.configurations.getByName(implementationConfName)
conf.extendsFrom(compileOnlyConf, implementationConf)
}
Expand Down Expand Up @@ -376,7 +376,7 @@ class ProtobufPlugin implements Plugin<Project> {

// Sets up a task to extract protos from protobuf dependencies.
// They are treated as sources and will be compiled.
Configuration protobufConf = createProtobufConfiguration(protoSourceSet)
Configuration protobufConf = createProtobufConf(protoSourceSet)
TaskProvider<ProtobufExtract> extractProtosTask = registerExtractProtosTask(
protoSourceSet.getExtractProtoTaskName(),
protoSourceSet.name,
Expand Down Expand Up @@ -443,11 +443,11 @@ class ProtobufPlugin implements Plugin<Project> {
sourceSets.each { SourceProvider sourceProvider ->
ProtoSourceSet protoSourceSet = protobufExtension.sourceSets.getByName(sourceProvider.name)

String compileOnlyConfigurationName = protoSourceSet.getCompileOnlyConfigurationName()
Configuration compileOnlyConfiguration = project.configurations.getByName(compileOnlyConfigurationName)
String implementationConfigurationName = protoSourceSet.getImplementationConfigurationName()
Configuration implementationConfiguration = project.configurations.getByName(implementationConfigurationName)
conf.extendsFrom(compileOnlyConfiguration, implementationConfiguration)
String compileOnlyConfName = protoSourceSet.getCompileOnlyConfName()
Configuration compileOnlyConf = project.configurations.getByName(compileOnlyConfName)
String implementationConfName = protoSourceSet.getImplementationConfName()
Configuration implementationConf = project.configurations.getByName(implementationConfName)
conf.extendsFrom(compileOnlyConf, implementationConf)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,30 @@ class DefaultProtoSourceSet implements ProtoSourceSet {

@Override
@SuppressWarnings(["SpaceAroundOperator"])
String getConfigurationName(String configurationName) {
String getConfName(String configurationName) {
return this.name == SourceSet.MAIN_SOURCE_SET_NAME
? configurationName
: "${this.name}${configurationName.capitalize()}"
}

@Override
String getProtobufConfigurationName() {
return this.getConfigurationName("protobuf")
String getProtobufConfName() {
return this.getConfName("protobuf")
}

@Override
String getCompileProtoPathConfigurationName() {
return "_${this.getConfigurationName("compileProtoPath")}"
String getCompileProtoPathConfName() {
return "_${this.getConfName("compileProtoPath")}"
}

@Override
String getCompileOnlyConfigurationName() {
return this.getConfigurationName("compileOnly")
String getCompileOnlyConfName() {
return this.getConfName("compileOnly")
}

@Override
String getImplementationConfigurationName() {
return this.getConfigurationName("implementation")
String getImplementationConfName() {
return this.getConfName("implementation")
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ interface ProtoSourceSet {

SourceDirectorySet getOutput()

String getConfigurationName(String configurationName)
String getConfName(String configurationName)

String getProtobufConfigurationName()
String getProtobufConfName()

String getCompileProtoPathConfigurationName()
String getCompileProtoPathConfName()

String getCompileOnlyConfigurationName()
String getCompileOnlyConfName()

String getImplementationConfigurationName()
String getImplementationConfName()

/**
* @returns task name according to the scheme: ${action}${sourceSetName}${target}
Expand Down

0 comments on commit 5cc9d89

Please sign in to comment.