Package com.google.gwt.core.ext.linker

Examples of com.google.gwt.core.ext.linker.ArtifactSet


  }

  @Override
  public ArtifactSet link(TreeLogger logger, LinkerContext context,
      ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    SortedSet<EmittedArtifact> emitted = toReturn.find(EmittedArtifact.class);

    for (EmittedArtifact artifact : emitted) {
      if (artifact.getPartialPath().equals(GEARS_MANIFEST)) {
        userManifest = artifact;
        toReturn.remove(artifact);
        emitted.remove(artifact);
        break;
      }
    }

    toReturn.add(emitManifest(logger, context, userManifest, emitted));

    return toReturn;
  }
View Full Code Here


  }

  @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;
      }
    }

    return super.link(logger, context, toLink);
View Full Code Here

            ArtifactSet artifacts, boolean onePermutation)
            throws UnableToCompleteException {

        if (!onePermutation) {
            // The artifact to return
            ArtifactSet toReturn = new ArtifactSet(artifacts);

            // The temporary scss files provided from the artefacts
            List<FileInfo> scssFiles = new ArrayList<FileInfo>();

            // The public files are provided as inputstream, but the compiler
            // needs real files, as they can contain references to other
            // files. They will be stored here, with their relative paths intact
            String tempFolderName = new Date().getTime() + File.separator;
            File tempFolder = createTempDir(tempFolderName);

            // Can't search here specifically for public resources, as the type
            // is different during compilation. This means we have to loop
            // through all the artifacts
            for (EmittedArtifact resource : artifacts
                    .find(EmittedArtifact.class)) {

                // Create the temporary files.
                String partialPath = resource.getPartialPath();
                if (partialPath.endsWith(".scss")) {
                    // In my opinion, the SCSS file does not need to be
                    // output to the web content folder, as they can't
                    // be used there
                    toReturn.remove(resource);

                    String fileName = partialPath;
                    File path = tempFolder;

                    int separatorIndex = fileName.lastIndexOf(File.separator);
                    if (-1 != separatorIndex) {
                        fileName = fileName.substring(separatorIndex + 1);

                        String filePath = partialPath.substring(0,
                                separatorIndex);
                        path = createTempDir(tempFolderName + filePath);
                    }

                    File tempfile = new File(path, fileName);
                    try {
                        boolean fileCreated = tempfile.createNewFile();
                        if (fileCreated) {

                            // write the received inputstream to the temp file
                            writeFromInputStream(resource.getContents(logger),
                                    tempfile);

                            // Store the file info for the compilation
                            scssFiles.add(new FileInfo(tempfile, partialPath));
                        } else {
                            logger.log(TreeLogger.WARN, "Duplicate file "
                                    + tempfile.getPath());
                        }
                    } catch (IOException e) {
                        logger.log(TreeLogger.ERROR,
                                "Could not write temporary file " + fileName, e);
                    }
                }
            }

            // Compile the files and store them in the artifact
            logger.log(TreeLogger.INFO, "Processing " + scssFiles.size()
                    + " Sass file(s)");
            for (FileInfo fileInfo : scssFiles) {
                logger.log(TreeLogger.INFO, "   " + fileInfo.originalScssPath
                        + " -> " + fileInfo.getOriginalCssPath());

                try {
                    ScssStylesheet scss = ScssStylesheet.get(fileInfo
                            .getAbsolutePath());
                    if (!fileInfo.isMixin()) {
                        scss.compile();
                        InputStream is = new ByteArrayInputStream(scss
                                .printState().getBytes());

                        toReturn.add(this.emitInputStream(logger, is,
                                fileInfo.getOriginalCssPath()));
                    }

                    fileInfo.getFile().delete();
                } catch (CSSException e) {
View Full Code Here

        + module.getName() + "'");

    // Create a new active linker stack for the fresh link.
    StandardLinkerContext linkerStack = new StandardLinkerContext(linkLogger,
        module, options);
    ArtifactSet artifacts = linkerStack.invokeLink(linkLogger);
    produceOutput(linkLogger, linkerStack, artifacts, module, false);
    return linkerStack;
  }
View Full Code Here

      ModuleDef module, ArtifactSet newlyGeneratedArtifacts)
      throws UnableToCompleteException {
    TreeLogger linkLogger = logger.branch(TreeLogger.DEBUG,
        "Relinking module '" + module.getName() + "'");

    ArtifactSet artifacts = linkerContext.invokeRelink(linkLogger,
        newlyGeneratedArtifacts);
    produceOutput(linkLogger, linkerContext, artifacts, module, true);
  }
View Full Code Here

          List<FileBackedObject<PermutationResult>> resultFiles = CompilePerms.makeResultFiles(
              options.getCompilerWorkDir(moduleName), allPerms);
          CompilePerms.compile(logger, precompilation, allPerms,
              options.getLocalWorkers(), resultFiles);

          ArtifactSet generatedArtifacts = precompilation.getGeneratedArtifacts();
          JJSOptions precompileOptions = precompilation.getUnifiedAst().getOptions();

          precompilation = null; // No longer needed, so save the memory

          Link.legacyLink(logger.branch(TreeLogger.TRACE, "Linking into "
View Full Code Here

    // Set up the rebind oracle for the module.
    // It has to wait until now because we need to inject javascript.
    //
    Rules rules = module.getRules();
    StandardGeneratorContext genCtx = new StandardGeneratorContext(
        compilationState, module, genDir, shellDir, new ArtifactSet());
    rebindOracle = new StandardRebindOracle(propOracle, rules, genCtx);

    // Create a completely isolated class loader which owns all classes
    // associated with a particular module. This effectively builds a
    // separate 'domain' for each running module, so that they all behave as
View Full Code Here

        for (CompilationUnit unit : compilationUnits) {
          additionalRootTypes[i++] = unit.getTypeName();
        }
      }

      ArtifactSet generatorArtifacts = new ArtifactSet();
      DistillerRebindPermutationOracle rpo = new DistillerRebindPermutationOracle(
          module, compilationState, generatorArtifacts,
          new PropertyPermutations(module.getProperties()), genDir,
          generatorResourcesDir);
      // Allow GC later.
View Full Code Here

      if (declEntryPts.length == 0) {
        logger.log(TreeLogger.ERROR, "Module has no entry points defined", null);
        throw new UnableToCompleteException();
      }

      ArtifactSet generatedArtifacts = new ArtifactSet();
      DistillerRebindPermutationOracle rpo = new DistillerRebindPermutationOracle(
          module, compilationState, generatedArtifacts, allPermutations,
          genDir, generatorResourcesDir);
      // Allow GC later.
      compilationState = null;
View Full Code Here

  private final Map<CompilationResult, String> compilationStrongNames = new IdentityHashMap<CompilationResult, String>();

  @Override
  public ArtifactSet link(TreeLogger logger, LinkerContext context,
      ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    for (CompilationResult compilation : toReturn.find(CompilationResult.class)) {
      toReturn.addAll(doEmitCompilation(logger, context, compilation));
    }

    toReturn.add(emitSelectionScript(logger, context, artifacts));
    return toReturn;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.linker.ArtifactSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.