If a plugin is symlinked in the plugins folder, and that plugin does not have any tags, the `git describe` command fails with: fatal: No names found, cannot describe anything which causes the build to fail. This was broken by change If5e7be8d. Add the `--always` option on `git describe` so that it will return a value even when there are no tags. Change-Id: I3d0c472c9ac469d079626a9df17149422dc5e4e6
		
			
				
	
	
		
			27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# Copyright (C) 2013 The Android Open Source Project
 | 
						|
#
 | 
						|
# 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.
 | 
						|
 | 
						|
def git_describe(plugin = None):
 | 
						|
  import subprocess
 | 
						|
  cmd = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty']
 | 
						|
  if not plugin or plugin == '${pluginName}':
 | 
						|
    p = subprocess.Popen(cmd, stdout = subprocess.PIPE)
 | 
						|
  else:
 | 
						|
    p = subprocess.Popen(cmd, stdout = subprocess.PIPE, cwd = 'plugins/%s' % plugin)
 | 
						|
  v = p.communicate()[0].strip()
 | 
						|
  r = p.returncode
 | 
						|
  if r != 0:
 | 
						|
    raise subprocess.CalledProcessError(r, ' '.join(cmd))
 | 
						|
  return v
 |