[go: nahoru, domu]

Skip to content

Commit

Permalink
Exclude already included files
Browse files Browse the repository at this point in the history
  • Loading branch information
valaphee committed Apr 5, 2022
1 parent 89cc9c7 commit 369d62a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
Binary file added app.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins {
application
id("com.github.johnrengelman.shadow") version "7.0.0"
id("com.palantir.git-version") version "0.12.3"
id("edu.sc.seis.launch4j") version "2.5.0"
kotlin("jvm") version "1.6.20"
signing
}
Expand Down Expand Up @@ -55,4 +56,14 @@ tasks {

application { mainClass.set("com.valaphee.protod.MainKt") }

launch4j {
jarTask = tasks.shadowJar.get()
icon = "${projectDir}/app.ico"
copyright = "Copyright (c) 2021-2022, Valaphee"
companyName = "Valaphee"
fileDescription = "Protocol Buffers Decompiler extracts Protocol Buffers descriptors from any file"
productName = "Protod"
copyConfigurable = emptyArray<Any>()
}

signing { useGpgCmd() }
23 changes: 19 additions & 4 deletions src/main/kotlin/com/valaphee/protod/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,29 @@ fun main(arguments: Array<String>) {

val outputPath = File(outputArgument)
files.forEach { file ->
File(outputPath, file.name).apply { parentFile.mkdirs() }.printWriter().use { printWriter ->
if (!included.contains(file.name)) File(outputPath, file.name).apply { parentFile.mkdirs() }.printWriter().use { printWriter ->
printWriter.println(
"""
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
""".trimIndent()
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
""".trimIndent()
)
ProtoWriter(printWriter, enums, messages, messageExtensions).print(file)
}
}
}

private val included = setOf(
"google/protobuf/compiler/plugin.proto",
"google/protobuf/any.proto",
"google/protobuf/api.proto",
"google/protobuf/descriptor.proto",
"google/protobuf/duration.proto",
"google/protobuf/empty.proto",
"google/protobuf/field_mask.proto",
"google/protobuf/source_context.proto",
"google/protobuf/struct.proto",
"google/protobuf/timestamp.proto",
"google/protobuf/type.proto",
"google/protobuf/wrappers.proto",
)

0 comments on commit 369d62a

Please sign in to comment.