mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
use make to avoid reprocessing res_src strings.xml files
They never change, so use make's understanding of dependencies.
This commit is contained in:
parent
3f78263f54
commit
7e570cff2c
7 changed files with 66 additions and 4775 deletions
|
@ -302,11 +302,17 @@ task mkImages(type: Exec) {
|
|||
commandLine './scripts/mkimages.sh'
|
||||
}
|
||||
|
||||
task copyStrings(type: Exec) {
|
||||
task copyLocStrings(type: Exec) {
|
||||
workingDir '../'
|
||||
commandLine './scripts/copy-strings.py'
|
||||
commandLine 'make', '-f', './scripts/copy-strings.mk'
|
||||
}
|
||||
|
||||
task cleanLocStrings(type: Exec) {
|
||||
workingDir '../'
|
||||
commandLine 'make', '-f', './scripts/copy-strings.mk', 'clean'
|
||||
}
|
||||
clean.dependsOn cleanLocStrings
|
||||
|
||||
task ndkSetupDebug(type: Exec) {
|
||||
workingDir '../'
|
||||
// remove ', "--arm-only"' for Genymotion builds
|
||||
|
@ -323,7 +329,7 @@ task ndkSetupRelease(type: Exec) {
|
|||
commandLine "./scripts/ndksetup.sh", "--with-clang", "--arm-only"
|
||||
}
|
||||
|
||||
task myPreBuild(dependsOn: ['mkImages', 'copyStrings', 'mkXml']) {
|
||||
task myPreBuild(dependsOn: ['mkImages', 'copyLocStrings', 'mkXml']) {
|
||||
}
|
||||
preBuild.dependsOn myPreBuild
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -706,10 +706,6 @@ Introduïu el vostre nom aquí. S\'usarà en crear partides noves. (Podreu
|
|||
<string name="not_again_turnchanged">E jugador amb el torn apareix apareix amb el marcador més gros.\n\nAguanteu el dit en un nom del marcador per a obtenir detalls sobre la jugada més recent del jugador.</string>
|
||||
<string name="not_again_newfrom">Crea una partida llesta per a jugar usant la configuració d\'aquesta. Això és, usa aquesta partida com a plantilla.</string>
|
||||
<string name="sms_bad_proto_fmt">La versió del CrossWords al telèfon amb número «%1$s» no és compatible amb aquest per a jugar via SMS de dades. Heu d\'actualitzar abans de continuar.</string>
|
||||
<plurals name="invite_bt_desc_fmt">
|
||||
<item quantity="one">Seleccioneu l\'aparell que voleu incloure en aquesta partida. Useu el botó «%2$s» si no veieu l\'aparell que espereu.</item>
|
||||
<item quantity="other">Seleccioneu fins a %1$d aparells que voleu incloure en aquesta partida. Useu el botó «%2$s» si no veieu l\'aparell que espereu.</item>
|
||||
</plurals>
|
||||
<plurals name="invite_sms_desc_fmt">
|
||||
<item quantity="one">Comproveu el número de telèfon que voleu convidar a la partida nova, aleshores toqueu «%2$s».</item>
|
||||
<item quantity="other">Comproveu els %1$d números de telèfon que voleu convidar a la partida nova, aleshores toqueu «%2$s».</item>
|
||||
|
|
File diff suppressed because it is too large
Load diff
35
xwords4/android/scripts/copy-strings.mk
Normal file
35
xwords4/android/scripts/copy-strings.mk
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- mode: Makefile -*-
|
||||
|
||||
SRCS = $(wildcard ./res_src/values-*/strings.xml)
|
||||
TARGETS = $(SRCS:./res_src/value%/strings.xml=app/src/main/res/value%/strings.xml)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
RES_SRC = ./res_src
|
||||
RES_DEST = ./app/src/main/res
|
||||
|
||||
all: $(TARGETS)
|
||||
pwd
|
||||
echo $(SRCS)
|
||||
echo $(TARGETS)
|
||||
|
||||
# all: $(TARGETS)
|
||||
|
||||
$(RES_DEST)/value%/strings.xml: $(RES_SRC)/value%/strings.xml
|
||||
./scripts/copy-strings.py -f $<
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS)
|
||||
|
||||
# SRC = $(wildcard *.html)
|
||||
# TAR = $(SRC:.html=.markdown)
|
||||
|
||||
# .PHONY: all clean
|
||||
|
||||
# all: $(TAR)
|
||||
|
||||
# %.markdown: %.html
|
||||
# pandoc -o $< $@
|
||||
|
||||
# clean:
|
||||
# rm -f $(TAR)
|
|
@ -25,7 +25,7 @@ def exitWithError(msg):
|
|||
sys.exit(1)
|
||||
|
||||
def usage():
|
||||
print "usage:", sys.argv[0], '[-k <list-o-dirs>]'
|
||||
print "usage:", sys.argv[0], '[-k <list-o-dirs>] [-f inFile]'
|
||||
sys.exit(1)
|
||||
|
||||
def sameOrSameWithPrefix( str1, str2 ):
|
||||
|
@ -227,11 +227,13 @@ def main():
|
|||
# add these via params later
|
||||
excepts = ['values-ca_PS', 'values-ba_CK']
|
||||
verboses = ['values-ja']
|
||||
srcFiles = []
|
||||
|
||||
try:
|
||||
pairs, rest = getopt.getopt(sys.argv[1:], "k:")
|
||||
pairs, rest = getopt.getopt(sys.argv[1:], "k:f:")
|
||||
for option, value in pairs:
|
||||
if option == '-k': excepts += value.split(' ')
|
||||
if option == '-f': srcFiles.append(value)
|
||||
else: usage()
|
||||
except:
|
||||
print "Unexpected error:", sys.exc_info()[0]
|
||||
|
@ -257,19 +259,23 @@ def main():
|
|||
engNames[name] = item
|
||||
# print engNames
|
||||
|
||||
# iterate over src files
|
||||
for subdir, dirs, files in os.walk('res_src'):
|
||||
for file in [file for file in files if file == "strings.xml"]:
|
||||
path = "%s/%s" % (subdir, file)
|
||||
for excpt in excepts:
|
||||
if excpt in path :
|
||||
path = None
|
||||
break
|
||||
if path:
|
||||
verbose = 0 == len(verboses) or 0 < len([verb for verb in verboses if verb in path])
|
||||
print "*** looking at %s ***" % (path)
|
||||
dest = path.replace( 'res_src', 'app/src/main/res', 1 )
|
||||
checkAndCopy( parser, engNames, engFormats, path, dest, verbose )
|
||||
# if -f option not used, iterate over src files to collect them all
|
||||
if not srcFiles:
|
||||
for subdir, dirs, files in os.walk('res_src'):
|
||||
for file in [file for file in files if file == "strings.xml"]:
|
||||
path = "%s/%s" % (subdir, file)
|
||||
if path:
|
||||
for excpt in excepts:
|
||||
if path and excpt in path:
|
||||
path = None
|
||||
if path:
|
||||
srcFiles.append(path)
|
||||
|
||||
# Finally, do the work
|
||||
for path in srcFiles:
|
||||
verbose = 0 == len(verboses) or 0 < len([verb for verb in verboses if verb in path])
|
||||
dest = path.replace( 'res_src', 'app/src/main/res', 1 )
|
||||
checkAndCopy( parser, engNames, engFormats, path, dest, verbose )
|
||||
|
||||
##############################################################################
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -85,7 +85,7 @@ def main():
|
|||
usage()
|
||||
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
doc = etree.parse("res/values/strings.xml", parser)
|
||||
doc = etree.parse("app/src/main/res/values/strings.xml", parser)
|
||||
for elem in doc.getroot().iter():
|
||||
if 'string' == elem.tag or 'item' == elem.tag:
|
||||
text = elem.text
|
||||
|
|
Loading…
Reference in a new issue