-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from streem/protoc-via-maven
Download protoc from maven for all protoc tasks
- Loading branch information
Showing
19 changed files
with
46,097 additions
and
815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,7 @@ | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.FileCollection | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.* | ||
import org.gradle.kotlin.dsl.property | ||
|
||
@Suppress("UnstableApiUsage") | ||
open class DescriptorProtocTask : AbstractExecTask<DescriptorProtocTask>(DescriptorProtocTask::class.java) { | ||
@InputDirectory | ||
val includeDir: DirectoryProperty = project.objects.directoryProperty() | ||
|
||
@OutputDirectory | ||
val outputDir: DirectoryProperty = project.objects.directoryProperty() | ||
|
||
@Input | ||
val protoc: Property<String> = project.objects.property<String>().apply { | ||
convention("protoc") | ||
} | ||
|
||
@Input | ||
val descriptorSetOutput: Property<String> = project.objects.property<String>().apply { | ||
convention("fileDescriptor.protoset") | ||
} | ||
|
||
private val protoFileDir: DirectoryProperty = project.objects.directoryProperty().apply { | ||
convention(includeDir) | ||
} | ||
|
||
@InputFiles | ||
@SkipWhenEmpty | ||
val protoFiles: FileCollection = protoFileDir.asFileTree.matching { | ||
this.include("*.proto") | ||
} | ||
|
||
override fun exec() { | ||
executable = protoc.get() | ||
|
||
args("--proto_path=${includeDir.get()}") | ||
args("--descriptor_set_out=${outputDir.get().file(descriptorSetOutput.get()).asFile.absolutePath}") | ||
|
||
args(protoFiles.map { it.absolutePath }) | ||
|
||
super.exec() | ||
open class DescriptorProtocTask : ProtocTask() { | ||
init { | ||
plugin.set("descriptor_set") | ||
outputFileName.convention("fileDescriptor.protoset") | ||
} | ||
} |
Oops, something went wrong.