Пример #1
0
  public void testWritesTargetLibraryProperties() throws UnableToCompleteException {
    compilerContext = compilerContextBuilder.compileMonolithic(false).build();
    ModuleDef libraryOneModule =
        ModuleDefLoader.loadFromClassPath(
            TreeLogger.NULL,
            compilerContext,
            "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
            false);

    // Library one sees all defined values for the "libraryTwoProperty" binding property and knows
    // which one was defined in this target library.
    for (BindingProperty bindingProperty :
        libraryOneModule.getProperties().getBindingProperties()) {
      if (!bindingProperty.getName().equals("libraryTwoProperty")) {
        continue;
      }
      assertEquals(
          Sets.newHashSet(bindingProperty.getDefinedValues()),
          Sets.newHashSet("yes", "no", "maybe"));
      assertEquals(
          Sets.newHashSet(bindingProperty.getTargetLibraryDefinedValues()),
          Sets.newHashSet("maybe"));
    }

    // Library one added a new defined value of "maybe" for the "libraryTwoProperty" binding
    // property.
    assertEquals(
        Sets.newHashSet(
            mockLibraryWriter.getNewBindingPropertyValuesByName().get("libraryTwoProperty")),
        Sets.newHashSet("maybe"));

    // Library one sees all defined values for the "libraryTwoConfigProperty" property and knows
    // which one was defined in this target library.
    for (ConfigurationProperty configurationProperty :
        libraryOneModule.getProperties().getConfigurationProperties()) {
      if (!configurationProperty.getName().equals("libraryTwoConfigProperty")) {
        continue;
      }
      assertEquals(Sets.newHashSet(configurationProperty.getValues()), Sets.newHashSet("false"));
      assertEquals(
          Sets.newHashSet(configurationProperty.getTargetLibraryValues()),
          Sets.newHashSet("false"));
    }

    // Library one added a new defined value of "maybe" for the "libraryTwoConfigProperty"
    // property.
    assertEquals(
        Sets.newHashSet(
            mockLibraryWriter
                .getNewConfigurationPropertyValuesByName()
                .get("libraryTwoConfigProperty")),
        Sets.newHashSet("false"));
  }
Пример #2
0
  public void testSeparateLibraryName() throws UnableToCompleteException {
    compilerContext = compilerContextBuilder.compileMonolithic(false).build();
    ModuleDefLoader.loadFromClassPath(
        TreeLogger.NULL,
        compilerContext,
        "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
        false);

    assertEquals(
        "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
        mockLibraryWriter.getLibraryName());
  }
Пример #3
0
 public void testSeparateRootFilesetFail() {
   compilerContext = compilerContextBuilder.compileMonolithic(false).build();
   TreeLogger logger = TreeLogger.NULL;
   try {
     ModuleDefLoader.loadFromClassPath(
         logger,
         compilerContext,
         "com.google.gwt.dev.cfg.testdata.separate.filesetone.FileSetOne",
         false);
     fail("Expected a fileset loaded as the root of a module tree to fail, but it didn't.");
   } catch (UnableToCompleteException e) {
     // Expected behavior.
   }
 }
Пример #4
0
  public void testSeparateModuleReferences() throws UnableToCompleteException {
    compilerContext = compilerContextBuilder.compileMonolithic(false).build();
    ModuleDef libraryOneModule =
        ModuleDefLoader.loadFromClassPath(
            TreeLogger.NULL,
            compilerContext,
            "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
            false);

    // The module sees itself and it's direct fileset module as "target" modules.
    assertEquals(
        Sets.newHashSet(
            "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
            "com.google.gwt.dev.cfg.testdata.separate.filesetone.FileSetOne"),
        libraryOneModule.getTargetLibraryModuleNames());
    // The module sees the referenced library module as a "library" module.
    assertEquals(
        Sets.newHashSet("com.google.gwt.dev.cfg.testdata.separate.librarytwo.LibraryTwo"),
        libraryOneModule.getExternalLibraryModuleNames());
  }
Пример #5
0
  public void testSeparateLibraryModuleReferences() throws UnableToCompleteException {
    compilerContext = compilerContextBuilder.compileMonolithic(false).build();
    ModuleDefLoader.loadFromClassPath(
        TreeLogger.NULL,
        compilerContext,
        "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
        false);

    // The library writer was given the module and it's direct fileset module xml files as build
    // resources.
    assertEquals(
        Sets.newHashSet(
            "com/google/gwt/dev/cfg/testdata/separate/filesetone/FileSetOne.gwt.xml",
            "com/google/gwt/dev/cfg/testdata/separate/libraryone/LibraryOne.gwt.xml"),
        mockLibraryWriter.getBuildResourcePaths());
    // The library writer was given LibraryTwo as a dependency library.
    assertEquals(
        Sets.newHashSet("com.google.gwt.dev.cfg.testdata.separate.librarytwo.LibraryTwo"),
        mockLibraryWriter.getDependencyLibraryNames());
  }
Пример #6
0
  public void testSeparateModuleResourcesLibraryOne() throws UnableToCompleteException {
    compilerContext = compilerContextBuilder.compileMonolithic(false).build();
    ModuleDef libraryOneModule =
        ModuleDefLoader.loadFromClassPath(
            TreeLogger.NULL,
            compilerContext,
            "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne",
            false);

    // Includes own source.
    assertNotNull(
        libraryOneModule.findSourceFile(
            "com/google/gwt/dev/cfg/testdata/separate/libraryone/client/LibraryOne.java"));
    // Cascades to include the subtree of fileset sources.
    assertNotNull(
        libraryOneModule.findSourceFile(
            "com/google/gwt/dev/cfg/testdata/separate/filesetone/client/FileSetOne.java"));
    // Does not include source from referenced libraries.
    assertNull(
        libraryOneModule.findSourceFile(
            "com/google/gwt/dev/cfg/testdata/separate/librarytwo/client/LibraryTwo.java"));
  }