xapi.dev.gwt.linker.StrongNameLinker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-dev Show documentation
Show all versions of xapi-dev Show documentation
Everything needed to run a comprehensive dev environment.
Just type X_ and pick a service from autocomplete;
new dev modules will be added as they are built.
The only dev service not included in the uber jar is xapi-dev-maven,
as it includes all runtime dependencies of maven, adding ~4 seconds to build time,
and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).
The newest version!
/**
*
*/
package xapi.dev.gwt.linker;
import com.google.gwt.core.ext.Linker;
import com.google.gwt.core.ext.LinkerContext;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.linker.ArtifactSet;
import com.google.gwt.core.ext.linker.CompilationResult;
import com.google.gwt.core.ext.linker.LinkerOrder;
import com.google.gwt.core.ext.linker.LinkerOrder.Order;
import com.google.gwt.core.ext.linker.Shardable;
import java.util.SortedSet;
/**
* This linker is used to accummulate all {@link CompilationResult} strongNames
* so that they can be accessed easily by other linkers.
*
* @author James X. Nelson ([email protected], @james)
*
*/
@LinkerOrder(Order.PRE)
@Shardable
public class StrongNameLinker extends Linker {
@Override
public ArtifactSet link(final TreeLogger logger, final LinkerContext context, ArtifactSet artifacts, final boolean onePermutation)
throws UnableToCompleteException {
if (onePermutation) {
final SortedSet existing = artifacts.find(StrongNameArtifact.class);
StrongNameArtifact artifact;
if (existing.isEmpty()) {
artifact = new StrongNameArtifact(getClass());
artifacts = new ArtifactSet(artifacts);
artifacts.add(artifact);
} else {
artifact = existing.first();
}
for (final CompilationResult compilation : artifacts.find(CompilationResult.class)) {
// pass a writable set so that other stages can use this set for temporary storage
artifact.addStrongName(compilation.getStrongName());
}
}
return artifacts;
}
@Override
public String getDescription() {
return "Accumulate permutation strongNames";
}
}