diff --git a/packages/pigeon/diff_tool.sh b/packages/pigeon/diff_tool.sh new file mode 100755 index 0000000000..959e5db0df --- /dev/null +++ b/packages/pigeon/diff_tool.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +############################################################################### +# A tool that helps you check the Pigeon output for a given file across +# different versions of Pigeon. +# +# The comparison will be made between the currently checked out sha and the one +# provided as an argument. +# +# usage: ./diff_tool.sh +############################################################################### + +xHash=$1 +pigeonPath=$2 +diffTool="diff -ru" +gitTool="git -c advice.detachedHead=false" + +generate_everything() { + local inputPath=$1 + local outputDir=$2 + pub run pigeon \ + --input "$inputPath" \ + --dart_out "$outputDir/dart.dart" \ + --java_out "$outputDir/java.dart" \ + --objc_header_out "$outputDir/objc.h" \ + --objc_source_out "$outputDir/objc.m" +} + +yHash=$(git rev-parse HEAD) +xDir=$(mktemp -d -t $xHash) +yDir=$(mktemp -d -t $yHash) +inputPath=$yDir/input.dart +cp "$pigeonPath" "$inputPath" +$gitTool checkout $xHash 1> /dev/null +generate_everything $inputPath $xDir +$gitTool checkout $yHash 1> /dev/null +generate_everything $inputPath $yDir +$diffTool "$yDir" "$xDir" +rm -rf "$yDir" +rm -rf "$xDir"