Examples of GwtModule


Examples of com.googlecode.gwt.test.GwtModule

   public List<UiObjectTagFactory<?>> getUiObjectTagFactories() {
      return uiObjectTagFactories;
   }

   public void setupGwtModule(Class<?> testClass) {
      GwtModule gwtModule = testClass.getAnnotation(GwtModule.class);

      if (gwtModule == null) {
         throw new GwtTestConfigurationException("The test class " + testClass.getName()
                  + " must be annotated with @" + GwtModule.class.getSimpleName()
                  + " to specify the fully qualified name of the GWT module to test");
      }

      String moduleName = gwtModule.value();

      if (moduleName == null || "".equals(moduleName.trim())) {
         throw new GwtTestConfigurationException("Incorrect value for @"
                  + GwtModule.class.getSimpleName() + " on " + testClass.getName() + ": "
                  + moduleName);
View Full Code Here

Examples of org.codehaus.mojo.gwt.GwtModule

        switch (modules.size()) {
            case 0:
                throw new MojoExecutionException("No GWT modules detected");
            case 1:
                try {
                    GwtModule module = gmr.readModule(modules.get(0));
                    String[] sources = module.getSources();
                    p.setProperty("spiffyui.gwt.module.name", module.getName());
                   
                    String path = new File(p.getProperty(ATTR_WWW), module.getPath()).getAbsolutePath();
                    if (path.endsWith(SPIFFY_TMP_SUFFIX)) {
                        path = path.substring(0, path.length() - SPIFFY_TMP_SUFFIX.length());
                    }
                    p.setProperty("spiffyui.gwt.module.path",  path);

                    if (sources != null && sources.length > 0) {
                        /*
                         Users can specify a different sources path in their module.
                         In that case we want to use that package.  If they haven't
                         specified that directory they get the client directory by
                         default.
                         */
                        p.setProperty("spiffyui.gwt.module.package",
                            module.getPackage() + "." + sources[0]);
                    } else {
                        p.setProperty("spiffyui.gwt.module.package",
                                module.getPackage() + ".client");
                    }
                } catch (Exception e) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
                break;
View Full Code Here

Examples of org.codehaus.mojo.gwt.GwtModule

            if (name.endsWith(InitializeMojo.SPIFFY_TMP_SUFFIX)) {
                /*
                 Then we've already created the temporary GWT module and we don't need
                 to create another one. 
                 */
                return new GwtModule(name, dom, this);
            }

            StringBuffer tmp = new StringBuffer();
            tmp.append(
                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" +
                "<!DOCTYPE module SYSTEM \"gwt-module.dtd\">" +
                    "<module rename-to=\"" + name + "\">" +
                    "<inherits name=\"" + name + "\"/>");

            if (m_userAgents != null) {
                tmp.append("<set-property name=\"user.agent\" value=\"" + m_userAgents + "\"/>");
            }

            if (m_locales != null) {
                tmp.append("<extend-property name=\"locale\" values=\"" + m_locales + "\" />");
            }

            tmp.append("</module>");

            Xpp3Dom tmpDom = Xpp3DomBuilder.build(new StringReader(tmp.toString()));
           
            File out = new File(m_mavenProject.getProperties().getProperty("spiffyui.generated-source"),
                                modulePath.substring(0, modulePath.lastIndexOf('/')));
            out.mkdirs();
            out = new File(out, name.substring(name.lastIndexOf(".") + 1) + InitializeMojo.SPIFFY_TMP_SUFFIX + ".gwt.xml");

            FileUtils.fileWrite(out.getAbsolutePath(), tmpDom.toString());
           
            return new GwtModule(name, tmpDom, this);
        } catch (Exception e) {
            String error = "Failed to read module XML file " + xml;
            m_log.error(error);
            throw new GwtModuleReaderException(error, e);
        }
View Full Code Here

Examples of org.codehaus.mojo.gwt.GwtModule

        throws GwtModuleReaderException
    {
        try
        {
            Xpp3Dom dom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( xml ) );
            return new GwtModule( name, dom, this );
        }
        catch ( Exception e )
        {
            String error = "Failed to read module XML file " + xml;
            log.error( error );
View Full Code Here

Examples of org.codehaus.mojo.gwt.GwtModule

            Set<ServletDescriptor> servlets = new LinkedHashSet<ServletDescriptor>();
           

            for ( String module : getModules() )
            {
                GwtModule gwtModule = readModule( module );

                Map<String, String> moduleServlets = isWebXmlServletPathAsIs() ? gwtModule.getServlets( "" )
                                                                              : gwtModule.getServlets();
                getLog().debug( "merge " + moduleServlets.size() + " servlets from module " + module );
                for ( Map.Entry<String, String> servlet : moduleServlets.entrySet() )
                {
                    servlets.add( new ServletDescriptor( servlet.getKey(), servlet.getValue() ) );
                }

                if ( scanRemoteServiceRelativePathAnnotation && packageNamePerModule != null )
                {
                    String packageName = packageNamePerModule.get( gwtModule.getName() );
                    if ( StringUtils.isBlank( packageName ) )
                    {
                        // here with try with the rename-to value
                        packageName = packageNamePerModule.get( gwtModule.getPath() );
                    }
                    if ( StringUtils.isNotBlank( packageName ) )
                    {
                        getLog().debug( "search annotated servlet with package name " + packageName + " in module "
                                            + gwtModule.getName() );
                        Set<ServletDescriptor> annotatedServlets = servletAnnotationFinder
                            .findServlets( packageName, isWebXmlServletPathAsIs() ? null : gwtModule.getPath(), getAnnotationSearchClassLoader() );
                        servlets.addAll( annotatedServlets );
                    } else
                    {
                        getLog().debug( "cannot find package name for module " + gwtModule.getName() + " or path "
                                            + gwtModule.getPath() );
                    }
                }

            }
View Full Code Here

Examples of org.codehaus.mojo.gwt.GwtModule

    {
        getLog().debug( "**Checking if compilation is required for " + module );
        try
        {

          GwtModule gwtModule = readModule( module );
            if ( gwtModule.getEntryPoints().size() == 0 )
            {
                getLog().info( gwtModule.getName() + " has no EntryPoint - compilation skipped" );
                // No entry-point, this is an utility module : compiling this one will fail
                // with '[ERROR] Module has no entry points defined'
                return false;
            }
            getLog().debug( "Module has an entrypoint" );

            if ( force )
            {
                return true;
            }
            getLog().debug( "Compilation not forced");
           
            String modulePath = gwtModule.getPath();

            String outputTarget = modulePath + "/" + modulePath + ".nocache.js";
            File outputTargetFile = new File( output, outputTarget );
            // Require compilation if no js file present in target.
            if ( !outputTargetFile.exists() )
            {
                return true;
            }
            getLog().debug( "Output file exists");
           
            File moduleFile = gwtModule.getSourceFile();
            if(moduleFile == null) {
              return true; //the module was read from something like an InputStream; always recompile this because we can't make any other choice
            }
            getLog().debug( "There is a module source file (not an input stream");
           
            //If input is newer than target, recompile
            if(moduleFile.lastModified() > outputTargetFile.lastModified())
            {
                getLog().debug( "Module file has been modified since the output file was created; recompiling" );
              return true;
            }
            getLog().debug( "The module XML hasn't been updated");

            // js file already exists, but may not be up-to-date with project source files
            SingleTargetSourceMapping singleTargetMapping = new SingleTargetSourceMapping( ".java", outputTarget );
            StaleSourceScanner scanner = new StaleSourceScanner();
            scanner.addSourceMapping( singleTargetMapping );

            SingleTargetSourceMapping uiBinderMapping = new SingleTargetSourceMapping( ".ui.xml", outputTarget );
            scanner.addSourceMapping( uiBinderMapping );

            Collection<File> compileSourceRoots = new HashSet<File>();
            for (String sourceRoot : getProject().getCompileSourceRoots()) {
                for (String sourcePackage : gwtModule.getSources()) {
                    String packagePath = gwtModule.getPackage().replace( '.', File.separatorChar );
                    File sourceDirectory = new File (sourceRoot + File.separatorChar + packagePath + File.separator + sourcePackage);
                    if(sourceDirectory.exists()) {
                        getLog().debug(" Looking in a source directory "+sourceDirectory.getAbsolutePath() + " for possible changes");
                        compileSourceRoots.add(sourceDirectory);         
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.