-
Notifications
You must be signed in to change notification settings - Fork 7
/
releasePlaykitSamples.pl
executable file
·62 lines (49 loc) · 1.57 KB
/
releasePlaykitSamples.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env perl
use strict;
my $num_args = $#ARGV + 1;
if ($num_args != 3) {
print "\nUsage: $0 \$pathToSamplesFolder \$oldVer \$newVer\n\n";
print "Example: $0 /Users/rony/Dev/android/kaltura/playkit-android-samples 4.4.0 4.5.0\n\n";
exit;
}
my ($pathToSamplesFolder, $oldVer, $newVer) = @ARGV;
print "Release Android Samples\n";
my @files = `find $pathToSamplesFolder/*/* | grep version.gradle`;
#my @files = `find $ENV{'HOME'}/Dev/android/kaltura/playkit-android-samples/*/app | grep build.gradle`;
foreach my $file(@files) {
print "Updating $file\n";
open INFILE, "$file";
my @data = <INFILE>;
close INFILE ;
my @updatedFileLines = ();
foreach my $line(@data) {
if ($line =~ /def playerVersion =/) {
$line =~ s/$oldVer/$newVer/;
}
push(@updatedFileLines, $line);
}
open (EMPTYFILE, ">$file");
close EMTPTYFILE;
open (OUTFILE, ">>$file");
foreach my $newLine(@updatedFileLines) {
# print $newLine;
print OUTFILE $newLine;
}
close OUTFILE;
`git add $file`
#system ("cat $file");
}
opendir( my $DIR, $pathToSamplesFolder );
while ( my $entry = readdir $DIR ) {
next unless -d $pathToSamplesFolder . '/' . $entry;
next if $entry eq '.' or $entry eq '..';
next if $entry =~ /^\./;
print "Found directory <$pathToSamplesFolder/$entry>\n";
chdir ("$pathToSamplesFolder/$entry");
my $returnCode = system("./gradlew build");
if ($returnCode != 0) {
die "Failed executing [./gradlew build --no-daemon]\n";
closedir $DIR;
}
}
closedir $DIR;