本文整理汇总了Java中com.google.gwt.core.ext.linker.ArtifactSet类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactSet类的具体用法?Java ArtifactSet怎么用?Java ArtifactSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactSet类属于com.google.gwt.core.ext.linker包,在下文中一共展示了ArtifactSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
ArtifactSet toReturn = new ArtifactSet(artifacts);
Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
for (EmittedArtifact emittedArtifact : emittedArtifacts) {
String partialPath = emittedArtifact.getPartialPath();
// Add to Cesium.js file, path, where Cesium/Cesium.js stored.
// It need for inject css files for example - Viewer
if (partialPath.endsWith("/Cesium.js")) {
String contents = CesiumLinkerUtils.getContents(emittedArtifact, logger);
StringBuffer sb = new StringBuffer(contents);
sb.insert(0, "window.CesiumPath = '" + context.getModuleName() + "/js/';\n");
toReturn.remove(emittedArtifact);
toReturn.add(emitString(logger, sb.toString(), partialPath));
}
}
return toReturn;
}
示例2: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
ArtifactSet toReturn = new ArtifactSet(artifacts);
Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
for (EmittedArtifact emittedArtifact : emittedArtifacts) {
String partialPath = emittedArtifact.getPartialPath();
// Add to Cesium.js file, path, where Cesium/Cesium.js stored.
// It need for inject css files for example - Viewer
if (partialPath.endsWith("/olcesium.js")) {
String contents = OLCesiumLinkerUtils.getContents(emittedArtifact, logger);
StringBuffer sb = new StringBuffer(contents);
sb.insert(0, "window.OpenLayersPath = '" + context.getModuleName() + "/js/';\n");
toReturn.remove(emittedArtifact);
toReturn.add(emitString(logger, sb.toString(), partialPath));
}
}
return toReturn;
}
示例3: doEmitCompilation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger,
LinkerContext context, CompilationResult result, ArtifactSet artifacts)
throws UnableToCompleteException {
String[] js = result.getJavaScript();
if (js.length != 1) {
logger.branch(TreeLogger.ERROR, getMultiFragmentWarningMessage(), null);
throw new UnableToCompleteException();
}
Collection<Artifact<?>> toReturn = new ArrayList<Artifact<?>>();
toReturn.add(new Script(result.getStrongName(), js[0]));
toReturn.addAll(emitSelectionInformation(result.getStrongName(), result));
return toReturn;
}
示例4: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(
TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation)
throws UnableToCompleteException {
ArtifactSet toReturn = new ArtifactSet(artifacts);
ArtifactSet writableArtifacts = new ArtifactSet(artifacts);
boolean export = getExportProperty(context);
for (CompilationResult result : toReturn.find(CompilationResult.class)) {
String[] js = result.getJavaScript();
checkArgument(js.length == 1, "MinimalLinker doesn't support GWT.runAsync");
String output = formatOutput(js[0], export);
toReturn.add(emitString(logger, output, context.getModuleName() + ".js"));
}
for (SymbolMapsLinker.ScriptFragmentEditsArtifact ea :
writableArtifacts.find(SymbolMapsLinker.ScriptFragmentEditsArtifact.class)) {
toReturn.add(ea);
}
return toReturn;
}
示例5: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link( TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation ) throws UnableToCompleteException
{
MANIFEST = context.getModuleName() + ".appcache";
ArtifactSet toReturn = new ArtifactSet( artifacts );
if( onePermutation )
{
return toReturn;
}
if( toReturn.find( SelectionInformation.class ).isEmpty() )
{
logger.log( TreeLogger.INFO, "DevMode warning: Clobbering " + MANIFEST + " to allow debugging. Recompile before deploying your app!" + artifacts );
// artifacts = null;
return toReturn;
}
// Create the general cache-manifest resource for the landing page:
toReturn.add( emitLandingPageCacheManifest( context, logger, artifacts ) );
return toReturn;
}
示例6: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts,
boolean onePermutation)
throws UnableToCompleteException {
ArtifactSet toReturn = new ArtifactSet(artifacts);
if (onePermutation) {
return toReturn;
}
if (toReturn.find(SelectionInformation.class).isEmpty()) {
logger.log(TreeLogger.INFO, "DevMode warning: Clobbering " + MANIFEST + " to allow debugging. "
+ "Recompile before deploying your app!");
artifacts = null;
}
// Create the general cache-manifest resource for the landing page:
toReturn.add(emitLandingPageCacheManifest(context, logger, artifacts));
return toReturn;
}
示例7: testNoNonCachableArtifacts
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
public void testNoNonCachableArtifacts() throws UnableToCompleteException {
SimpleAppCacheLinker linker = new SimpleAppCacheLinker();
// Some non-cacheable artifacts
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "soycReport.baz", new byte[0]));
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "foo.symbolMap", new byte[0]));
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "foo.xml.gz", new byte[0]));
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "foo.rpc.log", new byte[0]));
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "foo.gwt.rpc", new byte[0]));
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "rpcPolicyManifest.bar", new byte[0]));
ArtifactSet result = linker.link(TreeLogger.NULL, new MockLinkerContext(), artifacts, false);
assertEquals(8, result.size());
assertHasOneManifest(result);
assertFalse(getManifestContents(result).contains("soycReport"));
assertFalse(getManifestContents(result).contains("symbolMap"));
assertFalse(getManifestContents(result).contains("xml.gz"));
assertFalse(getManifestContents(result).contains("rpc.log"));
assertFalse(getManifestContents(result).contains("gwt.rpc"));
assertFalse(getManifestContents(result).contains("rpcPolicyManifest"));
}
示例8: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link( final TreeLogger logger,
final LinkerContext context,
final ArtifactSet artifacts,
final boolean onePermutation )
throws UnableToCompleteException
{
if ( onePermutation )
{
return perPermutationLink( logger, context, artifacts );
}
else
{
return perCompileLink( logger, context, artifacts );
}
}
示例9: perPermutationLink
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
final ArtifactSet perPermutationLink( final TreeLogger logger,
final LinkerContext context,
final ArtifactSet artifacts )
throws UnableToCompleteException
{
final Permutation permutation = calculatePermutation( logger, context, artifacts );
if ( null == permutation )
{
logger.log( Type.ERROR, "Unable to calculate permutation " );
throw new UnableToCompleteException();
}
final ArtifactSet results = new ArtifactSet( artifacts );
results.add( new PermutationArtifact( AppcacheLinker.class, permutation ) );
return results;
}
示例10: getPermutationArtifacts
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Test
public void getPermutationArtifacts()
{
final AppcacheLinker linker = new AppcacheLinker();
final ArtifactSet artifacts1 = new ArtifactSet();
final PermutationArtifact artifact1 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "1" ) );
final PermutationArtifact artifact2 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "2" ) );
artifacts1.add( artifact1 );
artifacts1.add( new StandardGeneratedResource( "path1", new byte[ 0 ] ) );
artifacts1.add( new StandardGeneratedResource( "path2", new byte[ 0 ] ) );
artifacts1.add( artifact2 );
final ArrayList<PermutationArtifact> permutationArtifacts = linker.getPermutationArtifacts( artifacts1 );
assertEquals( permutationArtifacts.size(), 2 );
assertTrue( permutationArtifacts.contains( artifact1 ) );
assertTrue( permutationArtifacts.contains( artifact2 ) );
}
示例11: getArtifactsForCompilation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Test
public void getArtifactsForCompilation()
{
final AppcacheLinker linker = new AppcacheLinker();
final ArtifactSet artifacts1 = new ArtifactSet();
final PermutationArtifact artifact1 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "1" ) );
final PermutationArtifact artifact2 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "2" ) );
artifacts1.add( artifact1 );
artifacts1.add( new StandardGeneratedResource( "path1", new byte[ 0 ] ) );
artifacts1.add( new StandardGeneratedResource( "path2", new byte[ 0 ] ) );
final StandardGeneratedResource resource =
new StandardGeneratedResource( "path3", new byte[ 0 ] );
resource.setVisibility( Visibility.Private );
artifacts1.add( resource );
artifacts1.add( new StandardGeneratedResource( "compilation-mappings.txt", new byte[ 0 ] ) );
artifacts1.add( new StandardGeneratedResource( "myapp.devmode.js", new byte[ 0 ] ) );
artifacts1.add( artifact2 );
final LinkerContext linkerContext = mock( LinkerContext.class );
when( linkerContext.getModuleName() ).thenReturn( "myapp" );
final Set<String> files =
linker.getArtifactsForCompilation( linkerContext, artifacts1 );
assertEquals( files.size(), 2 );
assertTrue( files.contains( "myapp/path1" ) );
assertTrue( files.contains( "myapp/path2" ) );
}
示例12: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts)
throws UnableToCompleteException {
ArtifactSet toReturn = super.link(logger, context, artifacts);
// Create the general cache-manifest resource for the landing page:
toReturn.add(emitLandingPageCacheManifest(context, logger, toReturn, staticCachedFiles()));
return toReturn;
}
示例13: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context,
ArtifactSet artifacts) throws UnableToCompleteException {
ArtifactSet toLink = new ArtifactSet(artifacts);
// Mask the stub manifest created by the generator
for (EmittedArtifact res : toLink.find(EmittedArtifact.class)) {
if (res.getPartialPath().endsWith(".gadget.xml")) {
manifestArtifact = res;
toLink.remove(res);
break;
}
}
if (manifestArtifact == null) {
if (artifacts.find(CompilationResult.class).isEmpty()) {
// Maybe hosted mode or junit, defer to XSLinker.
return new XSLinker().link(logger, context, toLink);
} else {
// When compiling for web mode, enforce that the manifest is present.
logger.log(TreeLogger.ERROR,
"No gadget manifest found in ArtifactSet.");
throw new UnableToCompleteException();
}
}
return super.link(logger, context, toLink);
}
示例14: emitSelectionScript
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
protected EmittedArtifact emitSelectionScript(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
throws UnableToCompleteException {
logger = logger.branch(TreeLogger.DEBUG, "Building gadget manifest",
null);
String bootstrap = "<script>" +
context.optimizeJavaScript(logger,
generateSelectionScript(logger, context, artifacts)) +
"</script>\n" + "<div id=\"__gwt_gadget_content_div\"></div>";
// Read the content
StringBuffer manifest = new StringBuffer();
try {
BufferedReader in = new BufferedReader(new InputStreamReader(
manifestArtifact.getContents(logger)));
for (String line = in.readLine(); line != null;
line = in.readLine()) {
manifest.append(line).append("\n");
}
in.close();
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Unable to read manifest stub", e);
throw new UnableToCompleteException();
}
replaceAll(manifest, "__BOOTSTRAP__", bootstrap);
return emitString(logger, manifest.toString(),
manifestArtifact.getPartialPath());
}
示例15: generateSelectionScript
import com.google.gwt.core.ext.linker.ArtifactSet; //导入依赖的package包/类
@Override
protected String generateSelectionScript(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
throws UnableToCompleteException {
StringBuffer scriptContents = new StringBuffer(super.generateSelectionScript(
logger, context, artifacts));
// Add a substitution for the GWT major release number. e.g. "1.6"
int[] gwtVersions = getVersionArray();
replaceAll(scriptContents, "__GWT_MAJOR_VERSION__",
gwtVersions[0] + "." + gwtVersions[1]);
return scriptContents.toString();
}