Skip to content

Commit

Permalink
Fix codenarc warnings (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkun83 authored Jul 27, 2017
1 parent 54ee5db commit 7efda65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ class ProtobufPlugin implements Plugin<Project> {
Task extractIncludeProtosTask =
maybeAddExtractIncludeProtosTask(
variant.name,
variant.compileConfiguration.incoming.artifactView{ attributes{ it.attribute(artifactType, "jar") }}.files,
variant.compileConfiguration.incoming.artifactView {
attributes { it.attribute(artifactType, "jar") }
}.files,
variant.hasProperty("testedVariant") ?
variant.testedVariant.compileConfiguration.incoming.artifactView{ attributes{ it.attribute(artifactType, "jar") }}.files :
variant.testedVariant.compileConfiguration.incoming.artifactView {
attributes { it.attribute(artifactType, "jar") }
}.files :
null)
generateProtoTask.dependsOn(extractIncludeProtosTask)
} else {
Expand Down Expand Up @@ -361,8 +365,8 @@ class ProtobufPlugin implements Plugin<Project> {
return project.tasks.create(extractIncludeProtosTaskName, ProtobufExtract) {
description = "Extracts proto files from compile dependencies for includes"
destDir = getExtractedIncludeProtosDir(sourceSetOrVariantName) as File
inputs.files compileClasspathConfiguration ?:
project.configurations[Utils.getConfigName(sourceSetOrVariantName, 'compile')]
inputs.files (compileClasspathConfiguration
?: project.configurations[Utils.getConfigName(sourceSetOrVariantName, 'compile')])

// TL; DR: Make protos in 'test' sourceSet able to import protos from the 'main' sourceSet.
// Sub-configurations, e.g., 'testCompile' that extends 'compile', don't depend on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ buildscript {
BuildResult result = GradleRunner.create()
.withProjectDir(mainProjectDir)
.withArguments(
"-DANDROID_PLUGIN_VERSION=${androidPluginVersion}",
"-Pandroid.buildCacheDir=" + localBuildCache, // set android build cache to avoid using home directory on travis CI.
"-DANDROID_PLUGIN_VERSION=${androidPluginVersion}",
// set android build cache to avoid using home directory on travis CI.
"-Pandroid.buildCacheDir=" + localBuildCache,
"testProjectAndroid:build",
"--stacktrace")
.withGradleVersion(gradleVersion)
Expand Down

0 comments on commit 7efda65

Please sign in to comment.