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

Urlencode extension classpath entries #102

Merged
merged 1 commit into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
import com.google.protobuf.gradle.remove
import java.io.File
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.gradle.api.plugins.JavaPluginConvention
Expand Down Expand Up @@ -84,7 +86,7 @@ private fun extraClasspath(project: Project, task: GenerateProtoTask): String {
extensions += project.configurations.getByName(TEST_EXTENSIONS)
}

return extensions.asPath.replace(':', ';')
return extensions.joinToString(";") { URLEncoder.encode(it.path, StandardCharsets.UTF_8) }
}

private fun configureSources(project: Project, generatedSourcesPath: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ import com.toasttab.protokt.gradle.KOTLIN_EXTRA_CLASSPATH
import com.toasttab.protokt.gradle.ONLY_GENERATE_GRPC
import com.toasttab.protokt.gradle.RESPECT_JAVA_PACKAGE
import com.toasttab.protokt.util.getProtoktVersion
import java.net.URLDecoder
import java.nio.charset.StandardCharsets

class ProtocolContext(
val fdp: FileDescriptorProto,
val allPackagesByTypeName: Map<String, PPackage>,
params: Map<String, String>
) {
val classpath = params.getOrDefault(KOTLIN_EXTRA_CLASSPATH, "").split(";")
val classpath = params.getOrDefault(KOTLIN_EXTRA_CLASSPATH, "").split(";").map {
URLDecoder.decode(it, StandardCharsets.UTF_8)
}

val respectJavaPackage = respectJavaPackage(params)
val generateGrpc = params.getValue(GENERATE_GRPC).toBoolean()
val onlyGenerateGrpc = params.getValue(ONLY_GENERATE_GRPC).toBoolean()
Expand Down