Skip to content

Commit

Permalink
Remove old disabled JAR packing code 🚿 [ci all]
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Oct 26, 2016
1 parent 9de415d commit 99159e0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 94 deletions.
39 changes: 0 additions & 39 deletions OSX/Metabase/Backend/MetabaseTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@

#import "MetabaseTask.h"

#define ENABLE_JAR_UNPACKING 0

@interface MetabaseTask ()

#if ENABLE_JAR_UNPACKING
@property (strong, readonly) NSString *unpack200Path;
#endif

@property (nonatomic) NSUInteger port;
@end

Expand Down Expand Up @@ -43,24 +37,6 @@ - (void)readHandleDidRead:(NSString *)message {
NSLog(@"%@", message);
}

#if ENABLE_JAR_UNPACKING
/// unpack the jars in the BG if needed the first time around
- (void)unpackJars {
[self.packedJarPaths enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(NSString *packedFilename, NSUInteger idx, BOOL *stop) {
NSString *jarName = [packedFilename stringByReplacingOccurrencesOfString:@".pack.gz" withString:@".jar"];

if (![[NSFileManager defaultManager] fileExistsAtPath:jarName]) {
NSLog(@"Unpacking %@ ->\n\t%@...", packedFilename, jarName);
NSTask *task = [[NSTask alloc] init];
task.launchPath = self.unpack200Path;
task.arguments = @[packedFilename, jarName];
[task launch];
[task waitUntilExit];
}
}];
}
#endif

- (void)deleteOldDBLockFilesIfNeeded {
NSString *lockFile = [DBPath() stringByAppendingString:@".lock.db"];
NSString *traceFile = [DBPath() stringByAppendingString:@".trace.db"];
Expand All @@ -81,11 +57,6 @@ - (void)deleteOldDBLockFilesIfNeeded {

- (void)launch {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{

#if ENABLE_JAR_UNPACKING
[self unpackJars];
#endif

[self deleteOldDBLockFilesIfNeeded];

NSLog(@"Starting MetabaseTask @ 0x%zx...", (size_t)self);
Expand Down Expand Up @@ -134,14 +105,4 @@ - (NSUInteger)port {
return _port;
}

#if ENABLE_JAR_UNPACKING
- (NSArray *)packedJarPaths {
return [[NSBundle mainBundle] pathsForResourcesOfType:@"pack.gz" inDirectory:@"jre/lib"];
}

- (NSString *)unpack200Path {
return [[NSBundle mainBundle] pathForResource:@"unpack200" ofType:nil inDirectory:@"jre/bin"];
}
#endif

@end
55 changes: 0 additions & 55 deletions bin/osx-setup
Original file line number Diff line number Diff line change
Expand Up @@ -21,64 +21,9 @@ use constant UBERJAR_DEST => getcwd() . '/OSX/Resources/metabase.jar';
use constant RESET_PW_SRC => getcwd() . '/reset-password-artifacts/reset-password/reset-password.jar';
use constant RESET_PW_DEST => getcwd() . '/OSX/Resources/reset-password.jar';

use constant ENABLE_JAR_PACKING => 0;
use constant ENABLE_JAR_OPTIONAL_FILE_STRIPPING => 0;

sub remove_jre_optional_files {
my @optional_files = ('bin/keytool',
'bin/orbd',
'bin/policytool',
'bin/rmid',
'bin/rmiregistry',
'bin/servertool',
'bin/tnameserv',
'lib/cmm/PYCC.pf',
'lib/deploy.jar',
'lib/ext',
'lib/fonts',
'lib/javaws.jar',
'lib/jfr',
'lib/jfr.jar',
'lib/libglass.dylib',
'lib/libglib-lite.dylib',
'lib/libgstreamer-lite.dylib',
'lib/libjavafx_font_t2k.dylib',
'lib/libjfxmedia.dylib',
'lib/libjfxwebkit.dylib',
'lib/libprism_common.dylib',
'lib/libprism_sw.dylib',
'lib/plugin.jar',
'lib/javafx.properties',
'lib/jfxswt.jar'
);
for my $file (@optional_files) {
$file = JRE_DEST . '/' . $file;
remove_tree($file) if -e $file;
}
}

# Finds all the .jar files in JRE_DEST and replaces them with packed .pack.gz files.
sub pack_jre_jars {
sub pack_jar {
if (/\.jar$/) {
s/(^.*)\.jar$/$1/; # stip off extension
print "Packing $_.jar...\n";
system('pack200', '--gzip', '--strip-debug', '--effort=9', $_ . '.pack.gz', $_ . '.jar') == 0 or die $!;
remove_tree($_ . '.jar');
}
}
find(\&pack_jar, JRE_DEST . '/lib');
}

# Copy the JRE if needed
(rcopy(JRE_HOME, JRE_DEST) or die $!) unless -d JRE_DEST;

# Remove optional files from JRE dest
remove_jre_optional_files() if ENABLE_JAR_OPTIONAL_FILE_STRIPPING;

# Pack JARs in JRE if applicable
pack_jar() if ENABLE_JAR_PACKING;

# Build jars if needed
(system('./bin/build') or die $!) unless -f UBERJAR_SRC;
(system('lein', 'with-profile', 'reset-password', 'jar') or die $!) unless -f RESET_PW_SRC;
Expand Down

0 comments on commit 99159e0

Please sign in to comment.