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

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


        // Should generally not happen
        logger.log(TreeLogger.ERROR, "Unable to store deRPC data", e);
        throw new UnableToCompleteException();
      }

      SyntheticArtifact a = emitBytes(logger, out.toByteArray(),
          result.getStrongName() + SUFFIX);
      artifacts.add(a);
    }

    return artifacts;
View Full Code Here


          // Should generally not happen
          logger.log(TreeLogger.ERROR, "Unable to store deRPC data", e);
          throw new UnableToCompleteException();
        }

        SyntheticArtifact a = emitBytes(logger, out.toByteArray(),
            result.getStrongName() + SUFFIX);
        artifacts.add(a);
      }
    }
    return artifacts;
View Full Code Here

            artifacts.remove(editArtifact);
            break;
          }
        }

        SyntheticArtifact emArt = null;
        // no need to adjust source map
        if (editArtifact == null) {
          emArt = emitSourceMapString(logger, sourceMapString, partialPath);
        } else {
          SourceMapGeneratorV3 sourceMapGenerator = new SourceMapGeneratorV3();
View Full Code Here

    }
  }

  protected SyntheticArtifact emitSourceMapString(TreeLogger logger, String contents,
      String partialPath) throws UnableToCompleteException {
    SyntheticArtifact emArt = emitString(logger, contents, partialPath);
    emArt.setVisibility(Visibility.LegacyDeploy);
    return emArt;
  }
View Full Code Here

    PrintWriter writer = new PrintWriter(baos);
    writer.write(value.toString());
    Utility.close(writer);

    // TODO(ocallau) Must be updated with the correct/final linker
    SyntheticArtifact artifact = new SyntheticArtifact(
        SoycReportLinker.class, named, baos.toByteArray());
    artifact.setVisibility(Visibility.LegacyDeploy);

    toReturn.add(artifact);
    return named;
  }
View Full Code Here

    @Override
    protected Pair<SyntheticArtifact, MultipleDependencyGraphRecorder> splitJsIntoFragments(
        PropertyOracle[] propertyOracles, int permutationId, JavaToJavaScriptMap jjsmap) {
      Pair<SyntheticArtifact, MultipleDependencyGraphRecorder> dependenciesAndRecorder = null;
      MultipleDependencyGraphRecorder dependencyRecorder = null;
      SyntheticArtifact dependencies = null;
      if (options.isRunAsyncEnabled()) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        int expectedFragmentCount = options.getFragmentCount();
        // -1 is the default value, we trap 0 just in case (0 is not a legal value in any case)
        if (expectedFragmentCount <= 0) {
          // Fragment count not set check fragments merge.
          int numberOfMerges = options.getFragmentsMerge();
          if (numberOfMerges > 0) {
            // + 1 for left over, + 1 for initial gave us the total number
            // of fragments without splitting.
            expectedFragmentCount =
                Math.max(0, jprogram.getRunAsyncs().size() + 2 - numberOfMerges);
          }
        }

        int minFragmentSize = PropertyOracles.findIntegerConfigurationProperty(
            propertyOracles, CodeSplitters.MIN_FRAGMENT_SIZE, 0);

        dependencyRecorder = chooseDependencyRecorder(baos);
        CodeSplitter.exec(logger, jprogram, jsProgram, jjsmap, expectedFragmentCount,
            minFragmentSize, dependencyRecorder);

        if (baos.size() == 0) {
          dependencyRecorder = recordNonSplitDependencies(baos);
        }
        if (baos.size() > 0) {
          dependencies = new SyntheticArtifact(
              SoycReportLinker.class, "dependencies" + permutationId + ".xml.gz",
              baos.toByteArray());
        }
      } else if (options.isSoycEnabled() || options.isJsonSoycEnabled()) {
        dependencyRecorder = recordNonSplitDependencies(new ByteArrayOutputStream());
View Full Code Here

      Event soycEvent = SpeedTracerLogger.start(CompilerEventType.MAKE_SOYC_ARTIFACTS);

      Event recordSplitPoints = SpeedTracerLogger.start(
          CompilerEventType.MAKE_SOYC_ARTIFACTS, "phase", "recordSplitPoints");
      SplitPointRecorder.recordSplitPoints(jprogram, baos, logger);
      SyntheticArtifact splitPoints = new SyntheticArtifact(
          SoycReportLinker.class, "splitPoints" + permutationId + ".xml.gz", baos.toByteArray());
      soycArtifacts.add(splitPoints);
      recordSplitPoints.end();

      SyntheticArtifact sizeMaps = null;
      if (sizeBreakdowns != null) {
        Event recordSizeMap = SpeedTracerLogger.start(
            CompilerEventType.MAKE_SOYC_ARTIFACTS, "phase", "recordSizeMap");
        baos.reset();
        SizeMapRecorder.recordMap(logger, baos, sizeBreakdowns, jjsmap,
            internedLiteralByVariableName);
        sizeMaps = new SyntheticArtifact(
            SoycReportLinker.class, "stories" + permutationId + ".xml.gz", baos.toByteArray());
        soycArtifacts.add(sizeMaps);
        recordSizeMap.end();
      }

      if (sourceInfoMaps != null) {
        Event recordStories = SpeedTracerLogger.start(
            CompilerEventType.MAKE_SOYC_ARTIFACTS, "phase", "recordStories");
        baos.reset();
        StoryRecorder.recordStories(logger, baos, sourceInfoMaps, js);
        soycArtifacts.add(new SyntheticArtifact(
            SoycReportLinker.class, "detailedStories" + permutationId + ".xml.gz",
            baos.toByteArray()));
        recordStories.end();
      }
View Full Code Here

    map.put("prop2", "v2");
    SelectionInformation selectionInformation = new SelectionInformation("strong", 0, map);
    artifactSet.add(selectionInformation);

    // put in some files
    SyntheticArtifact a1 =
        new SyntheticArtifact(PermutationMapLinker.class, "1.test", "bla".getBytes("UTF-8"));
    artifactSet.add(a1);
    SyntheticArtifact a2 =
        new SyntheticArtifact(PermutationMapLinker.class, "2.test", "bla1".getBytes("UTF-8"));
    artifactSet.add(a2);

    ArtifactSet linkedSet = permutationMapLinker.link(null, linkerContext, artifactSet, true);

    SortedSet<PermutationArtifact> pas = linkedSet.find(PermutationArtifact.class);
View Full Code Here

    map1.put("prop3", "v3");
    map1.put("prop4", "v4");
    selectionInformation = new SelectionInformation("perm2", 0, map1);
    artifactSet.add(selectionInformation);
    // put in some files
    SyntheticArtifact a1 =
        new SyntheticArtifact(PermutationMapLinker.class, "1.test", "bla".getBytes("UTF-8"));
    artifactSet.add(a1);
    SyntheticArtifact a2 =
        new SyntheticArtifact(PermutationMapLinker.class, "2.test", "bla1".getBytes("UTF-8"));
    artifactSet.add(a2);

    ConfigurationProperty standardConfigurationProperty =
        mock(MyConfigurationProperty.class);

    when(standardConfigurationProperty.getValues()).thenReturn(Arrays.asList("index.html"));
    when(standardConfigurationProperty.getName()).thenReturn(
        PermutationMapLinker.EXTERNAL_FILES_CONFIGURATION_PROPERTY_NAME);

    TreeSet<ConfigurationProperty> set = new TreeSet<ConfigurationProperty>();
    set.add(standardConfigurationProperty);

    when(linkerContext.getConfigurationProperties()).thenReturn(set);

    // lets put in two permutationartifacts
    HashSet<String> files = new HashSet<String>();
    files.add("perm1_file1");
    files.add("perm1_file2");
    HashSet<BindingProperty> bpSet = new HashSet<BindingProperty>();
    bpSet.add(new BindingProperty("sel1", "1"));

    artifactSet.add(new PermutationArtifact(PermutationMapLinker.class, "perm1", files, bpSet));

    files = new HashSet<String>();
    files.add("perm2_file1");
    files.add("perm2_file2");
    bpSet = new HashSet<BindingProperty>();
    bpSet.add(new BindingProperty("sel1", "2"));

    artifactSet.add(new PermutationArtifact(PermutationMapLinker.class, "perm2", files, bpSet));

    ArtifactSet linkedSet = permutationMapLinker.link(null, linkerContext, artifactSet, false);

    SortedSet<SyntheticArtifact> pas = linkedSet.find(SyntheticArtifact.class);

    Assert.assertEquals(7, pas.size());

    // manifest for first permutation
    SyntheticArtifact artifact =
        getArtifact("perm1" + PermutationMapLinker.PERMUTATION_MANIFEST_FILE_ENDING, pas);
    Assert.assertNotNull(artifact);
    InputStream contents = artifact.getContents(null);
    // test some things on artifact...
    StringWriter writer = new StringWriter();
    IOUtils.copy(contents, writer, "UTF-8");
    String theString = writer.toString();
    Assert.assertTrue(theString.startsWith("CACHE MANIFEST"));

    Assert.assertTrue(theString.contains("perm1_file2"));
    Assert.assertTrue(theString.contains("strong/1.test"));
    Assert.assertTrue(theString.contains("perm1_file1"));
    Assert.assertTrue(theString.contains("strong/2.test"));
    Assert.assertTrue(theString.contains("index.html"));
    Assert.assertTrue(!theString.contains("perm2_file2"));
    Assert.assertTrue(!theString.contains("perm2_file1"));

    // manifest for second permutation
    artifact = getArtifact("perm2" + PermutationMapLinker.PERMUTATION_MANIFEST_FILE_ENDING, pas);
    Assert.assertNotNull(artifact);
    contents = artifact.getContents(null);
    // test some things on artifact...
    writer = new StringWriter();
    IOUtils.copy(contents, writer, "UTF-8");
    theString = writer.toString();
    Assert.assertTrue(theString.startsWith("CACHE MANIFEST"));
    Assert.assertTrue(theString.contains("perm2_file2"));
    Assert.assertTrue(theString.contains("strong/1.test"));
    Assert.assertTrue(theString.contains("perm2_file1"));
    Assert.assertTrue(theString.contains("strong/2.test"));
    Assert.assertTrue(theString.contains("index.html"));
    Assert.assertTrue(!theString.contains("perm1_file2"));
    Assert.assertTrue(!theString.contains("perm1_file1"));

    // manifest map file
    artifact = getArtifact(PermutationMapLinker.MANIFEST_MAP_FILE_NAME, pas);
    Assert.assertNotNull(artifact);
    contents = artifact.getContents(null);
    // test some things on artifact...
    writer = new StringWriter();
    IOUtils.copy(contents, writer, "UTF-8");
    theString = writer.toString();
    Assert.assertTrue(theString.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
View Full Code Here

      filesForCurrentPermutation.addAll(entry.getValue().getPermutationFiles());

      String permXml = buildPermXml(logger, permutationArtifact, filesForCurrentPermutation, externalFiles);

      // emit permutation information file
      SyntheticArtifact emitString = emitString(logger, permXml, permutationArtifact.getPermutationName() + PERMUTATION_FILE_ENDING);
      toReturn.add(emitString);

      // build manifest
      String maniFest = buildManiFest(entry.getKey(), filesForCurrentPermutation, externalFiles);
      toReturn.add(emitString(logger, maniFest, entry.getKey() + PERMUTATION_MANIFEST_FILE_ENDING));
View Full Code Here

TOP

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

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.