Skip to content

Commit

Permalink
move file expansion for checkl10n task to Perl script
Browse files Browse the repository at this point in the history
I don't grok Gradle, but I can Perl ;-)
  • Loading branch information
mmitch committed Apr 1, 2020
1 parent 464d8f4 commit 88d15fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
21 changes: 2 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,9 @@ task publishDropboxFull(type: Copy, dependsOn: fullJar) {
into '/home/mitch/Dropbox/schnucki/knittr'
}

task checkl10n() {
task checkl10n(type: Exec) {
description 'Check all localizations for missing property file keys.'

/* FIXME: all paths handcrafted, there should be a better way */
finalizedBy(
checkl10nSingle('src/main/resources/de/cgarbs/knittr/resource', 'MainWindow'),
checkl10nSingle('src/main/resources/de/cgarbs/knittr/resource', 'Project'),
checkl10nSingle('src/main/resources/de/cgarbs/knittr/resource', 'RenderException'),
)
}

def checkl10nSingle(path, prefix) {
description 'Check one localization for missing property file keys.'

return tasks.create("checkl10n /${path}/${prefix}", Exec) {
List args = [ 'tools/check-l10n.pl' ]
fileTree(dir: path).include("${prefix}*.properties").each {
File file -> args.add(file as String)
}

commandLine args
}
commandLine 'tools/check-l10n.pl', 'src/main/resources/de/cgarbs/knittr/resource/*.properties'
}
11 changes: 8 additions & 3 deletions tools/check-l10n.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@

# check for missing localizations
#
# give all relevant files as parameters
# give all relevant files as parameter-globs

my @files;
foreach my $glob (@ARGV) {
push @files, glob $glob;
}

my $allkeys = {};
my $filekeys = {};

foreach my $file (@ARGV)
foreach my $file (@files)
{
open FILE, '<', $file or die "can't open `$file': $!";
while (my $line = <FILE>)
Expand All @@ -30,7 +35,7 @@
foreach my $key (@keys)
{
my @files;
foreach my $file (@ARGV)
foreach my $file (@files)
{
if (not exists $filekeys->{$file}->{$key})
{
Expand Down

0 comments on commit 88d15fc

Please sign in to comment.