Loading services/core/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ genrule { ":services.core.protolog.json", ], cmd: "cp $(location :generate-protolog.json) $(out) && " + "{ diff $(out) $(location :services.core.protolog.json) >/dev/null 2>&1 || " + "{ ! (diff $(out) $(location :services.core.protolog.json) | grep -q '^<') || " + "{ echo -e '\\n\\n################################################################\\n#\\n" + "# ERROR: ProtoLog viewer config is stale. To update it, run:\\n#\\n" + "# cp $(location :generate-protolog.json) " + Loading tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt +23 −12 Original line number Diff line number Diff line Loading @@ -50,14 +50,19 @@ object ProtoLogTool { command.javaSourceArgs.forEach { path -> val file = File(path) val text = file.readText() val newPath = path val outSrc = try { val code = tryParse(text, path) val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration .get().nameAsString else "" val newPath = pack.replace('.', '/') + '/' + file.name val outSrc = when { containsProtoLogText(text, command.protoLogClassNameArg) -> if (containsProtoLogText(text, command.protoLogClassNameArg)) { transformer.processClass(text, newPath, code) else -> text } else { text } } catch (ex: ParsingException) { // If we cannot parse this file, skip it (and log why). Compilation will fail // in a subsequent build step. println("\n${ex.message}\n") text } outJar.putNextEntry(ZipEntry(newPath)) outJar.write(outSrc.toByteArray()) Loading Loading @@ -91,11 +96,17 @@ object ProtoLogTool { val file = File(path) val text = file.readText() if (containsProtoLogText(text, command.protoLogClassNameArg)) { try { val code = tryParse(text, path) val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration .get().nameAsString else "" val newPath = pack.replace('.', '/') + '/' + file.name builder.processClass(code, newPath) } catch (ex: ParsingException) { // If we cannot parse this file, skip it (and log why). Compilation will fail // in a subsequent build step. println("\n${ex.message}\n") } } } val out = FileOutputStream(command.viewerConfigJsonArg) Loading Loading
services/core/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ genrule { ":services.core.protolog.json", ], cmd: "cp $(location :generate-protolog.json) $(out) && " + "{ diff $(out) $(location :services.core.protolog.json) >/dev/null 2>&1 || " + "{ ! (diff $(out) $(location :services.core.protolog.json) | grep -q '^<') || " + "{ echo -e '\\n\\n################################################################\\n#\\n" + "# ERROR: ProtoLog viewer config is stale. To update it, run:\\n#\\n" + "# cp $(location :generate-protolog.json) " + Loading
tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt +23 −12 Original line number Diff line number Diff line Loading @@ -50,14 +50,19 @@ object ProtoLogTool { command.javaSourceArgs.forEach { path -> val file = File(path) val text = file.readText() val newPath = path val outSrc = try { val code = tryParse(text, path) val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration .get().nameAsString else "" val newPath = pack.replace('.', '/') + '/' + file.name val outSrc = when { containsProtoLogText(text, command.protoLogClassNameArg) -> if (containsProtoLogText(text, command.protoLogClassNameArg)) { transformer.processClass(text, newPath, code) else -> text } else { text } } catch (ex: ParsingException) { // If we cannot parse this file, skip it (and log why). Compilation will fail // in a subsequent build step. println("\n${ex.message}\n") text } outJar.putNextEntry(ZipEntry(newPath)) outJar.write(outSrc.toByteArray()) Loading Loading @@ -91,11 +96,17 @@ object ProtoLogTool { val file = File(path) val text = file.readText() if (containsProtoLogText(text, command.protoLogClassNameArg)) { try { val code = tryParse(text, path) val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration .get().nameAsString else "" val newPath = pack.replace('.', '/') + '/' + file.name builder.processClass(code, newPath) } catch (ex: ParsingException) { // If we cannot parse this file, skip it (and log why). Compilation will fail // in a subsequent build step. println("\n${ex.message}\n") } } } val out = FileOutputStream(command.viewerConfigJsonArg) Loading