Embed clippy.swf with a GWT DataResource
Using a DataResource allows the GWT compiler to manage inserting the binary into the application context. This works in all run modes, making the clippy movie always available, even in GWT hosted debug. Change-Id: I02869d65d9787265ebe40046e0dbf883fd7ea9e1
This commit is contained in:
parent
cad2310922
commit
a8eec02ca1
@ -4,7 +4,10 @@ gwt_module(
|
|||||||
name = 'Clippy',
|
name = 'Clippy',
|
||||||
srcs = glob([SRC + 'clippy/client/*.java']),
|
srcs = glob([SRC + 'clippy/client/*.java']),
|
||||||
gwtxml = SRC + 'clippy/Clippy.gwt.xml',
|
gwtxml = SRC + 'clippy/Clippy.gwt.xml',
|
||||||
resources = [SRC + 'clippy/client/clippy.css'],
|
resources = [
|
||||||
|
SRC + 'clippy/client/clippy.css',
|
||||||
|
SRC + 'clippy/client/clippy.swf',
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
':SafeHtml',
|
':SafeHtml',
|
||||||
':UserAgent',
|
':UserAgent',
|
||||||
@ -14,17 +17,6 @@ gwt_module(
|
|||||||
visibility = ['PUBLIC'],
|
visibility = ['PUBLIC'],
|
||||||
)
|
)
|
||||||
|
|
||||||
genrule(
|
|
||||||
name = 'clippy_swf',
|
|
||||||
cmd = 'mkdir $TMP/gerrit_ui;' +
|
|
||||||
'cp $SRCS $TMP/gerrit_ui;' +
|
|
||||||
'cd $TMP;' +
|
|
||||||
'zip -qr $OUT gerrit_ui',
|
|
||||||
srcs = [SRC + 'clippy/public/gwtexpui_clippy1.cache.swf'],
|
|
||||||
out = 'clippy_swf.zip',
|
|
||||||
visibility = ['PUBLIC'],
|
|
||||||
)
|
|
||||||
|
|
||||||
gwt_module(
|
gwt_module(
|
||||||
name = 'CSS',
|
name = 'CSS',
|
||||||
srcs = glob([SRC + 'css/rebind/*.java']),
|
srcs = glob([SRC + 'css/rebind/*.java']),
|
||||||
|
@ -16,10 +16,16 @@ package com.google.gwtexpui.clippy.client;
|
|||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.DataResource;
|
||||||
|
import com.google.gwt.resources.client.DataResource.DoNotEmbed;
|
||||||
|
|
||||||
public interface ClippyResources extends ClientBundle {
|
public interface ClippyResources extends ClientBundle {
|
||||||
public static final ClippyResources I = GWT.create(ClippyResources.class);
|
public static final ClippyResources I = GWT.create(ClippyResources.class);
|
||||||
|
|
||||||
@Source("clippy.css")
|
@Source("clippy.css")
|
||||||
ClippyCss css();
|
ClippyCss css();
|
||||||
|
|
||||||
|
@Source("clippy.swf")
|
||||||
|
@DoNotEmbed
|
||||||
|
DataResource swf();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gwtexpui.clippy.client;
|
package com.google.gwtexpui.clippy.client;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.event.dom.client.BlurEvent;
|
import com.google.gwt.event.dom.client.BlurEvent;
|
||||||
import com.google.gwt.event.dom.client.BlurHandler;
|
import com.google.gwt.event.dom.client.BlurHandler;
|
||||||
@ -47,7 +46,6 @@ import com.google.gwtexpui.user.client.UserAgent;
|
|||||||
public class CopyableLabel extends Composite implements HasText {
|
public class CopyableLabel extends Composite implements HasText {
|
||||||
private static final int SWF_WIDTH = 110;
|
private static final int SWF_WIDTH = 110;
|
||||||
private static final int SWF_HEIGHT = 14;
|
private static final int SWF_HEIGHT = 14;
|
||||||
private static String swfUrl;
|
|
||||||
private static boolean flashEnabled = true;
|
private static boolean flashEnabled = true;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -63,10 +61,7 @@ public class CopyableLabel extends Composite implements HasText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String swfUrl() {
|
private static String swfUrl() {
|
||||||
if (swfUrl == null) {
|
return ClippyResources.I.swf().getSafeUri().asString();
|
||||||
swfUrl = GWT.getModuleBaseURL() + "gwtexpui_clippy1.cache.swf";
|
|
||||||
}
|
|
||||||
return swfUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final FlowPanel content;
|
private final FlowPanel content;
|
||||||
|
@ -74,7 +74,6 @@ def gerrit_war(name, ui = 'ui_optdbg', context = []):
|
|||||||
context = [
|
context = [
|
||||||
'//gerrit-main:main_bin.jar',
|
'//gerrit-main:main_bin.jar',
|
||||||
'//gerrit-war:webapp_assets.zip',
|
'//gerrit-war:webapp_assets.zip',
|
||||||
'//gerrit-gwtexpui:clippy_swf.zip',
|
|
||||||
'//gerrit-gwtui:' + ui + '.zip',
|
'//gerrit-gwtui:' + ui + '.zip',
|
||||||
] + context,
|
] + context,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user