tools: allow check-string-format to be called from anywhere

This commit is contained in:
Hans-Christoph Steiner 2017-05-02 20:50:01 +02:00
parent 676b2b9093
commit 1222a9b4c7
2 changed files with 4 additions and 4 deletions

View File

@ -12,9 +12,7 @@ before_script:
test: test:
script: script:
- cd app - ./app/tools/check-string-format.py
- ./tools/check-string-format.py
- cd ..
- ./gradlew assemble -PdisablePreDex - ./gradlew assemble -PdisablePreDex
# always report on lint errors to the build log # always report on lint errors to the build log
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle - sed -i -e 's,textReport .*,textReport true,' app/build.gradle

View File

@ -12,9 +12,11 @@ formatRe = re.compile(r'(%%|%[^%](\$.)?)')
validFormatRe = re.compile(r'^(%%|%[sd]|%[0-9]\$[sd])$') validFormatRe = re.compile(r'^(%%|%[sd]|%[0-9]\$[sd])$')
projectdir = os.path.join(os.path.dirname(__file__), '..')
count = 0 count = 0
for d in glob.glob(os.path.join('src', 'main', 'res', 'values-*')): for d in sorted(glob.glob(os.path.join(projectdir, 'src', 'main', 'res', 'values-*'))):
str_path = os.path.join(d, 'strings.xml') str_path = os.path.join(d, 'strings.xml')
if not os.path.exists(str_path): if not os.path.exists(str_path):