Exemplo n.º 1
0
  private Module(final URI moduleDescriptor, final Handler defaultHandler)
      throws IllegalArgumentException {
    super("module", defaultHandler);

    final String fileName = UriUtils.getFilename(moduleDescriptor);
    if (!fileName.toLowerCase().endsWith(".iml"))
      throw new IllegalArgumentException(
          "The specified module descriptor \""
              + moduleDescriptor
              + "\" does not point to a valid IDEA module file (.iml)");

    this.name =
        fileName.lastIndexOf('.') != -1
            ? fileName.substring(0, fileName.lastIndexOf('.'))
            : fileName;
    this.moduleDescriptor = moduleDescriptor;
    this.sourceUrls = new HashSet<String>();
    this.testSourceUrls = new HashSet<String>();
    this.dependencies = new HashSet<Dependency>();
    this.facets = new ArrayList<Facet>();

    // Register handlers
    registerComponentHandler("NewModuleRootManager", new NewModuleRootManagerHandler());
    registerComponentHandler("FacetManager", new FacetManagerHandler());
    registerComponentHandler("BuildJarSettings", new BuildJarSettingsHandler());
  }
  @Override
  protected void executeTask() throws BuildException {
    if (this.property == null)
      throw new BuildException("Target property (attribute 'property') not specified.");

    log("Attempting to resolve output URL '" + project().getOutputUrl() + "'", Project.MSG_VERBOSE);
    final String outputDirectory;
    try {
      outputDirectory =
          UriUtils.getPath(projectResolver().resolveUriString(project().getOutputUrl()));
    } catch (ResolutionException e) {
      throw new BuildException("Failed to resolve project output directory.", e);
    }

    log("Output URL resolved to '" + outputDirectory + "'", Project.MSG_VERBOSE);
    getProject().setProperty(this.property, outputDirectory);
  }
Exemplo n.º 3
0
 public URI getModuleRoot() {
   return UriUtils.getParent(this.moduleDescriptor);
 }