mirror of https://github.com/perkeep/perkeep.git
Merge "dev-server: use updatelibrary.go to update closure lib"
This commit is contained in:
commit
454547b4ff
3
Makefile
3
Makefile
|
@ -22,9 +22,6 @@ presubmit:
|
||||||
embeds:
|
embeds:
|
||||||
go install ./pkg/fileembed/genfileembed/ && genfileembed ./server/camlistored/ui && genfileembed ./pkg/server
|
go install ./pkg/fileembed/genfileembed/ && genfileembed ./server/camlistored/ui && genfileembed ./pkg/server
|
||||||
|
|
||||||
getclosure:
|
|
||||||
perl -e 'require "misc/get_closure.pl"; get_closure_lib(); get_closure_compiler();'
|
|
||||||
|
|
||||||
UIDIR = server/camlistored/ui
|
UIDIR = server/camlistored/ui
|
||||||
|
|
||||||
NEWUIDIR = server/camlistored/newui
|
NEWUIDIR = server/camlistored/newui
|
||||||
|
|
|
@ -185,10 +185,10 @@ if ($opt_fullclosure) {
|
||||||
if (-e "$Bin/tmp/closure-lib/.svn") {
|
if (-e "$Bin/tmp/closure-lib/.svn") {
|
||||||
system("rm", "-rf", "$Bin/tmp/closure-lib") and die "Failed to remove the svn checkout of the closure-lib.\n";
|
system("rm", "-rf", "$Bin/tmp/closure-lib") and die "Failed to remove the svn checkout of the closure-lib.\n";
|
||||||
}
|
}
|
||||||
get_closure_lib();
|
print STDERR "Updating closure library ...\n";
|
||||||
get_closure_compiler();
|
system("go", "run", "third_party/closure/updatelibrary.go", "-verbose")
|
||||||
chdir $Bin or die;
|
and die "go run third_party/closure/updatelibrary.go failed";
|
||||||
$ENV{CAMLI_DEV_CLOSURE_DIR} = "$Bin/tmp/closure-lib/closure";
|
$ENV{CAMLI_DEV_CLOSURE_DIR} = "third_party/closure/lib/closure";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Starting dev server on $base/ui/ with password \"pass$port\"\n";
|
print "Starting dev server on $base/ui/ with password \"pass$port\"\n";
|
||||||
|
|
|
@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// The updatelibrary command allows to selectively download
|
// update_closure_compiler downloads a new version
|
||||||
// from the closure library git repository (at a chosen revision)
|
// of the closure compiler if the one in tmp/closure-compiler
|
||||||
// the resources needed by the Camlistore ui.
|
// doesn't exist or is older than the requested version.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
use strict;
|
|
||||||
use FindBin qw($Bin);
|
|
||||||
use File::Fetch;
|
|
||||||
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
|
|
||||||
|
|
||||||
my $closure_sha = "1389e13";
|
|
||||||
my $closure_git = "https://code.google.com/p/closure-library/";
|
|
||||||
my $compiler_version = "20121212";
|
|
||||||
my $compiler_baseurl = "http://closure-compiler.googlecode.com/files/";
|
|
||||||
|
|
||||||
sub get_closure_lib {
|
|
||||||
my $closure_dir = "$Bin/tmp/closure-lib";
|
|
||||||
if (-d $closure_dir) {
|
|
||||||
chdir $closure_dir or die;
|
|
||||||
my $local_sha = `git rev-parse --short HEAD`;
|
|
||||||
chomp($local_sha);
|
|
||||||
if ($local_sha ne $closure_sha) {
|
|
||||||
system("git", "fetch")
|
|
||||||
and die "Failed to git fetch the closure library: $!\n";
|
|
||||||
system("git", "reset", "--hard", $closure_sha)
|
|
||||||
and die "Failed to git reset the closure library repo: $!\n";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
system("git", "clone", $closure_git, $closure_dir)
|
|
||||||
and die "Failed to git clone the closure library: $!\n";
|
|
||||||
chdir $closure_dir or die;
|
|
||||||
system("git", "reset", "--hard", $closure_sha)
|
|
||||||
and die "Failed to git reset the closure library repo: $!\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_closure_compiler {
|
|
||||||
# first java check is needed, because the actual call
|
|
||||||
# always has a non zero exit status (because running the
|
|
||||||
# compiler.jar with --version writes to stderr).
|
|
||||||
my $version = `java -version 2>/dev/null`;
|
|
||||||
die "The Java Runtime Environment is needed to run the closure compiler.\n" if $?;
|
|
||||||
my $closure_compiler_dir = "$Bin/tmp/closure-compiler";
|
|
||||||
my $jar = "$closure_compiler_dir/compiler.jar";
|
|
||||||
if (-f $jar) {
|
|
||||||
my $cmd = join "", "java -jar ", $jar, " --version --help 2>&1";
|
|
||||||
my $version = `$cmd`;
|
|
||||||
$version =~ s/.*Version: (.*) \(revision.*/$1/s;
|
|
||||||
if ($version eq $compiler_version) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
unlink $jar or die "Could not unlink $jar: $!";
|
|
||||||
}
|
|
||||||
printf("Getting closure compiler version %s.\n", $compiler_version);
|
|
||||||
unless (-d $closure_compiler_dir) {
|
|
||||||
system("mkdir", "-p", $closure_compiler_dir)
|
|
||||||
and die "Failed to create $closure_compiler_dir.\n";
|
|
||||||
}
|
|
||||||
chdir $closure_compiler_dir or die;
|
|
||||||
my $compiler_filename = join "", "compiler-", $compiler_version, ".zip";
|
|
||||||
my $compiler_url = $compiler_baseurl . $compiler_filename;
|
|
||||||
my $ff = File::Fetch->new(uri => $compiler_url);
|
|
||||||
my $where = $ff->fetch() or die $ff->error;
|
|
||||||
unzip $compiler_filename => "compiler.jar"
|
|
||||||
or die "unzip failed: $UnzipError\n";
|
|
||||||
unlink $compiler_filename or die "Could not unlink $compiler_filename: $!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
Loading…
Reference in New Issue