#!/bin/bash # # Copyright 2016-present Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Writes a CHANGELOG.md-ready list of changes in this release, organized by component, to stdout. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; pushd $DIR >> /dev/null MDC_ROOT="$(git rev-parse --show-toplevel | tail -n1)"; popd >> /dev/null cd $MDC_ROOT if [ ! $(git rev-parse --verify release-candidate 2> /dev/null) ]; then echo "Please cut a release first by running scripts/release/cut." exit 1 fi echo "## Component changes" find components -type d -name 'src' | while read path; do folder=$(dirname $path) component=$(echo $folder | cut -d'/' -f2-) if [[ $component == private* ]]; then continue; fi if [ $(git log --pretty=oneline --no-merges origin/master..release-candidate $folder \ | wc -l) == "0" ]; then continue fi componentdiff() { git log \ --pretty="* [%s](https://github.com/google/material-components-ios/commit/%H) (%an)" \ --no-merges \ origin/master..release-candidate \ $folder } if [[ $(componentdiff) ]]; then echo echo "### $component" if [[ $(componentdiff | grep "\[$component\]\!") ]]; then echo echo "#### Breaking changes" echo componentdiff \ | grep "\[$component\]\!" \ | sed "s|\[$component\]!|**Breaking**: |" \ | sort fi if [[ $(componentdiff | grep -v "\[$component\]\!") ]]; then echo echo "#### Changes" echo componentdiff \ | grep -v "\[$component\]!" \ | sed "s|\[$component\] ||" \ | sort fi fi done