Author: assaf
Date: Tue Feb  5 17:04:04 2008
New Revision: 618846

URL: http://svn.apache.org/viewvc?rev=618846&view=rev
Log:
BUILDR-36

Added:
    incubator/buildr/trunk/lib/ide/idea7x.ipr.template
    incubator/buildr/trunk/lib/ide/idea7x.rb
Modified:
    incubator/buildr/trunk/lib/ide.rb

Modified: incubator/buildr/trunk/lib/ide.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/ide.rb?rev=618846&r1=618845&r2=618846&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/ide.rb (original)
+++ incubator/buildr/trunk/lib/ide.rb Tue Feb  5 17:04:04 2008
@@ -1,2 +1,3 @@
 require 'ide/eclipse'
 require 'ide/idea'
+require 'ide/idea7x'

Added: incubator/buildr/trunk/lib/ide/idea7x.ipr.template
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/ide/idea7x.ipr.template?rev=618846&view=auto
==============================================================================
--- incubator/buildr/trunk/lib/ide/idea7x.ipr.template (added)
+++ incubator/buildr/trunk/lib/ide/idea7x.ipr.template Tue Feb  5 17:04:04 2008
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project relativePaths="false" version="4">
+  <component name="BuildJarProjectSettings">
+    <option name="BUILD_JARS_ON_MAKE" value="false"/>
+  </component>
+  <component name="CodeStyleProjectProfileManger">
+    <option name="PROJECT_PROFILE"/>
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false"/>
+  </component>
+  <component name="CodeStyleSettingsManager">
+    <option name="PER_PROJECT_SETTINGS"/>
+    <option name="USE_PER_PROJECT_SETTINGS" value="false"/>
+  </component>
+  <component name="CompilerConfiguration">
+    <option name="DEFAULT_COMPILER" value="Javac"/>
+    <option name="DEPLOY_AFTER_MAKE" value="0"/>
+    <resourceExtensions>
+      <entry name=".+\.(properties|xml|html|dtd|tld)"/>
+      <entry name=".+\.(gif|png|jpeg|jpg)"/>
+    </resourceExtensions>
+    <wildcardResourcePatterns>
+      <entry name="?*.properties"/>
+      <entry name="?*.xml"/>
+      <entry name="?*.gif"/>
+      <entry name="?*.png"/>
+      <entry name="?*.jpeg"/>
+      <entry name="?*.jpg"/>
+      <entry name="?*.html"/>
+      <entry name="?*.dtd"/>
+      <entry name="?*.tld"/>
+    </wildcardResourcePatterns>
+  </component>
+  <component name="DependenciesAnalyzeManager">
+    <option name="myForwardDirection" value="false"/>
+  </component>
+  <component name="DependencyValidationManager">
+    <option name="SKIP_IMPORT_STATEMENTS" value="false"/>
+  </component>
+  <component name="EclipseCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true"/>
+    <option name="GENERATE_NO_WARNINGS" value="true"/>
+    <option name="DEPRECATION" value="false"/>
+    <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+    <option name="MAXIMUM_HEAP_SIZE" value="128"/>
+  </component>
+  <component name="EclipseEmbeddedCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true"/>
+    <option name="GENERATE_NO_WARNINGS" value="true"/>
+    <option name="DEPRECATION" value="false"/>
+    <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+    <option name="MAXIMUM_HEAP_SIZE" value="128"/>
+  </component>
+  <component name="EntryPointsManager">
+    <entry_points version="2.0"/>
+  </component>
+  <component name="IdProvider" IDEtalkID="8CD0EDF2C11753573BC22F6C470A1027"/>
+  <component name="InspectionProjectProfileManager">
+    <option name="PROJECT_PROFILE" value="Project Default"/>
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false"/>
+    <scopes/>
+    <profiles>
+      <profile version="1.0" is_locked="false">
+        <option name="myName" value="Project Default"/>
+        <option name="myLocal" value="false"/>
+      </profile>
+    </profiles>
+    <list size="0"/>
+  </component>
+  <component name="JavacSettings">
+    <option name="DEBUGGING_INFO" value="true"/>
+    <option name="GENERATE_NO_WARNINGS" value="false"/>
+    <option name="DEPRECATION" value="true"/>
+    <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+    <option name="MAXIMUM_HEAP_SIZE" value="128"/>
+  </component>
+  <component name="JavadocGenerationManager">
+    <option name="OUTPUT_DIRECTORY"/>
+    <option name="OPTION_SCOPE" value="protected"/>
+    <option name="OPTION_HIERARCHY" value="true"/>
+    <option name="OPTION_NAVIGATOR" value="true"/>
+    <option name="OPTION_INDEX" value="true"/>
+    <option name="OPTION_SEPARATE_INDEX" value="true"/>
+    <option name="OPTION_DOCUMENT_TAG_USE" value="false"/>
+    <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/>
+    <option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/>
+    <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true"/>
+    <option name="OPTION_DEPRECATED_LIST" value="true"/>
+    <option name="OTHER_OPTIONS" value=""/>
+    <option name="HEAP_SIZE"/>
+    <option name="LOCALE"/>
+    <option name="OPEN_IN_BROWSER" value="true"/>
+  </component>
+  <component name="JikesSettings">
+    <option name="JIKES_PATH" value=""/>
+    <option name="DEBUGGING_INFO" value="true"/>
+    <option name="DEPRECATION" value="true"/>
+    <option name="GENERATE_NO_WARNINGS" value="false"/>
+    <option name="IS_EMACS_ERRORS_MODE" value="true"/>
+    <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+  </component>
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal 
Spacer"
+            icon="/com/intellij/uiDesigner/icons/hspacer.png" 
removable="false" auto-create-binding="false"
+            can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" 
fill="1"/>
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical 
Spacer"
+            icon="/com/intellij/uiDesigner/icons/vspacer.png" 
removable="false" auto-create-binding="false"
+            can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" 
fill="2"/>
+      </item>
+      <item class="javax.swing.JPanel" 
icon="/com/intellij/uiDesigner/icons/panel.png" removable="false"
+            auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" 
fill="3"/>
+      </item>
+      <item class="javax.swing.JScrollPane" 
icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false"
+            auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" 
fill="3"/>
+      </item>
+      <item class="javax.swing.JButton" 
icon="/com/intellij/uiDesigner/icons/button.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" 
fill="1"/>
+        <initial-values>
+          <property name="text" value="Button"/>
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" 
icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" 
fill="0"/>
+        <initial-values>
+          <property name="text" value="RadioButton"/>
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" 
icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" 
fill="0"/>
+        <initial-values>
+          <property name="text" value="CheckBox"/>
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" 
icon="/com/intellij/uiDesigner/icons/label.png" removable="false"
+            auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" 
fill="0"/>
+        <initial-values>
+          <property name="text" value="Label"/>
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" 
icon="/com/intellij/uiDesigner/icons/textField.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" 
fill="1">
+          <preferred-size width="150" height="-1"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" 
icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" 
fill="1">
+          <preferred-size width="150" height="-1"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" 
icon="/com/intellij/uiDesigner/icons/formattedTextField.png"
+            removable="false" auto-create-binding="true" 
can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" 
fill="1">
+          <preferred-size width="150" height="-1"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" 
icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" 
icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" 
icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" 
icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" 
fill="1"/>
+      </item>
+      <item class="javax.swing.JTable" 
icon="/com/intellij/uiDesigner/icons/table.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" 
icon="/com/intellij/uiDesigner/icons/list.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" 
icon="/com/intellij/uiDesigner/icons/tree.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3">
+          <preferred-size width="150" height="50"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" 
icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" 
fill="3">
+          <preferred-size width="200" height="200"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" 
icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false"
+            auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" 
fill="3">
+          <preferred-size width="200" height="200"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" 
icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false"
+            auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" 
fill="1"/>
+      </item>
+      <item class="javax.swing.JSlider" 
icon="/com/intellij/uiDesigner/icons/slider.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" 
fill="1"/>
+      </item>
+      <item class="javax.swing.JSeparator" 
icon="/com/intellij/uiDesigner/icons/separator.png" removable="false"
+            auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" 
fill="3"/>
+      </item>
+      <item class="javax.swing.JProgressBar" 
icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" 
fill="1"/>
+      </item>
+      <item class="javax.swing.JToolBar" 
icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false"
+            auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" 
fill="1">
+          <preferred-size width="-1" height="20"/>
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" 
icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png"
+            removable="false" auto-create-binding="false" 
can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" 
fill="1"/>
+      </item>
+      <item class="javax.swing.JScrollBar" 
icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false"
+            auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" 
fill="2"/>
+      </item>
+    </group>
+  </component>
+  <component name="ProjectFileVersion" converted="true"/>
+  <component name="ProjectRootManager" version="2" assert-keyword="true" 
jdk-15="true" project-jdk-name="1.5"
+             project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out"/>
+  </component>
+  <component name="ResourceManagerContainer">
+    <option name="myResourceBundles">
+      <value>
+        <list size="0"/>
+      </value>
+    </option>
+  </component>
+  <component name="RmicSettings">
+    <option name="IS_EANABLED" value="false"/>
+    <option name="DEBUGGING_INFO" value="true"/>
+    <option name="GENERATE_NO_WARNINGS" value="false"/>
+    <option name="GENERATE_IIOP_STUBS" value="false"/>
+    <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+  </component>
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs=""/>
+  </component>
+  <component name="WebServicesPlugin" addRequiredLibraries="true"/>
+</project>
\ No newline at end of file

Added: incubator/buildr/trunk/lib/ide/idea7x.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/ide/idea7x.rb?rev=618846&view=auto
==============================================================================
--- incubator/buildr/trunk/lib/ide/idea7x.rb (added)
+++ incubator/buildr/trunk/lib/ide/idea7x.rb Tue Feb  5 17:04:04 2008
@@ -0,0 +1,205 @@
+require "pathname"
+require "core/project"
+require "java/artifact"
+require 'stringio'
+require 'rexml/document'
+
+module Buildr
+  module Idea7x #:nodoc:
+
+    include Extension
+
+    CLASSIFIER = "-7x"
+    IML_SUFFIX = CLASSIFIER + ".iml"
+    IPR_TEMPLATE = "idea7x.ipr.template"
+    MODULE_DIR = "$MODULE_DIR$"
+    FILE_PATH_PREFIX = "file://"
+    MODULE_DIR_URL = FILE_PATH_PREFIX + MODULE_DIR
+    PROJECT_DIR = "$PROJECT_DIR$"
+    PROJECT_DIR_URL = FILE_PATH_PREFIX + PROJECT_DIR
+
+    first_time do
+      # Global task "idea" generates artifacts for all projects.
+      desc "Generate Idea 7.x artifacts for all projects"
+      Project.local_task "idea7x"=>"artifacts"
+    end
+
+    before_define do |project|
+      project.recursive_task("idea7x")
+    end
+
+    after_define do |project|
+      idea7x = project.task("idea7x")
+
+      # We need paths relative to the top project's base directory.
+      root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : 
p.base_dir }; f[p] }[project]
+
+      sources = Buildr.build_files.map { |file| File.expand_path(file) 
}.select { |file| File.exist?(file) }
+      sources << File.expand_path(Rake.application.rakefile, root_path) if 
Rake.application.rakefile
+
+      # Find a path relative to the project's root directory.
+      relative = lambda do |path|
+        
Pathname.new(path.to_s).relative_path_from(Pathname.new(project.path_to)).to_s
+      end
+
+      m2repo = Buildr::Repositories.instance.local
+      excludes = [ '**/.svn/', '**/CVS/' ].join('|')
+
+      # Only for projects that are packageable.
+      task_name = project.path_to("#{project.name.gsub(':', 
'-')}#{IML_SUFFIX}")
+      idea7x.enhance [ file(task_name) ]
+
+      # The only thing we need to look for is a change in the Buildfile.
+      file(task_name=>sources) do |task|
+        puts "Writing #{task.name}" if verbose
+
+        # Note: Use the test classpath since Eclipse compiles both "main" and 
"test" classes using the same classpath
+        deps = project.test.compile.dependencies.map(&:to_s) - [ 
project.compile.target.to_s ]
+
+        # Convert classpath elements into applicable Project objects
+        deps.collect! { |path| Buildr.projects.detect { |prj| 
prj.packages.detect { |pkg| pkg.to_s == path } } || path }
+
+        # project_libs: artifacts created by other projects
+        project_libs, others = deps.partition { |path| path.is_a?(Project) }
+
+        # Separate artifacts from Maven2 repository
+        m2_libs, others = others.partition { |path| path.to_s.index(m2repo) == 
0 }
+
+        # Generated: classpath elements in the project are assumed to be 
generated
+        generated, libs = others.partition { |path| 
path.to_s.index(project.path_to.to_s) == 0 }
+
+        # Project type is going to be the first package type
+        if package = project.packages.first
+          File.open(task.name, "w") do |file|
+            xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
+            xml.module(:version=>"4", :relativePaths=>"true", 
:type=>"JAVA_MODULE") do
+              xml.component(:name=>"NewModuleRootManager", 
"inherit-compiler-output"=>"false") do
+
+                Buildr::Idea7x.generate_compile_output(project, xml, relative)
+
+                Buildr::Idea7x.generate_content(project, xml, generated, 
relative)
+
+                Buildr::Idea7x.generate_order_entries(project_libs, xml)
+
+                ext_libs = libs.map {|path| "#{MODULE_DIR}/#{path.to_s}" } + 
m2_libs.map { |path| path.to_s.sub(m2repo, "$M2_REPO$") }
+                Buildr::Idea7x.generate_module_libs(xml, ext_libs)
+
+                xml.orderEntryProperties
+              end
+            end
+          end
+        end
+      end
+
+      # Root project aggregates all the subprojects.
+      if project.parent == nil
+        Buildr::Idea7x.generate_ipr(project, idea7x, sources)
+      end
+
+    end # after_define
+
+    private
+
+    def self.generate_order_entries(project_libs, xml)
+      xml.orderEntry :type=>"sourceFolder", :forTests=>"false"
+      xml.orderEntry :type=>"inheritedJdk"
+
+      # Classpath elements from other projects
+      project_libs.map(&:id).sort.uniq.each do |project_id|
+        xml.orderEntry :type=>'module', 
"module-name"=>"#{project_id}#{CLASSIFIER}"
+      end
+    end
+
+    def self.generate_compile_output(project, xml, relative)
+      
xml.output(:url=>"#{MODULE_DIR_URL}/#{relative[project.compile.target.to_s]}") 
if project.has_compile_sources
+      
xml.output-test(:url=>"#{MODULE_DIR_URL}/#{relative[project.test.compile.target.to_s]}")
 if project.has_test_sources
+    end
+
+    def self.generate_content(project, xml, generated, relative)
+      xml.content(:url=>"#{MODULE_DIR_URL}") do
+        if project.has_compile_sources
+          srcs = project.compile.sources.map { |src| relative[src.to_s] } + 
generated.map { |src| relative[src.to_s] }
+          srcs.sort.uniq.each do |path|
+            xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", 
:isTestSource=>"false"
+          end
+
+          test_sources = project.test.compile.sources.map { |src| 
relative[src.to_s] }
+          test_sources.each do |paths|
+            paths.sort.uniq.each do |path|
+              xml.sourceFolder :url=>"#{MODULE_DIR_URL}/#{path}", 
:isTestSource=>"true"
+            end
+          end
+        end
+        [project.resources=>false, project.test.resources=>true].each do 
|resources, test|
+          resources.each do |path|
+            path[0].sources.each do |srcpath|
+              xml.sourceFolder :url=>"#{FILE_PATH_PREFIX}#{srcpath}", 
:isTestSource=>path[1].to_s
+            end
+          end
+        end
+        xml.excludeFolder 
:url=>"#{MODULE_DIR_URL}/#{relative[project.compile.target.to_s]}" if 
project.has_compile_sources
+      end
+    end
+
+    def self.generate_module_libs(xml, ext_libs)
+      ext_libs.each do |path|
+        xml.orderEntry :type=>"module-library" do
+          xml.library do
+            xml.CLASSES do
+              xml.root :url=>"jar://#{path}!/"
+            end
+            xml.JAVADOC
+            xml.SOURCES
+          end
+        end
+      end
+    end
+
+    def self.generate_ipr(project, idea7x, sources)
+      task_name = project.path_to("#{project.name.gsub(':', '-')}-7x.ipr")
+      idea7x.enhance [ file(task_name) ]
+      file(task_name=>sources) do |task|
+        puts "Writing #{task.name}" if verbose
+
+        # Generating just the little stanza that chanages from one project to 
another
+        partial = StringIO.new
+        xml = Builder::XmlMarkup.new(:target=>partial, :indent=>2)
+        xml.component(:name=>"ProjectModuleManager") do
+          xml.modules do
+            project.projects.each do |subp|
+              module_name = subp.name.gsub(":", "-")
+              module_path = subp.name.split(":"); module_path.shift
+              module_path = module_path.join(File::SEPARATOR)
+              path = "#{module_path}/#{module_name}#{IML_SUFFIX}"
+              xml.module :fileurl=>"#{PROJECT_DIR_URL}/#{path}", 
:filepath=>"#{PROJECT_DIR}/#{path}"
+            end
+            if package = project.packages.first
+              xml.module 
:fileurl=>"#{PROJECT_DIR_URL}/#{project.name}#{IML_SUFFIX}", 
:filepath=>"#{PROJECT_DIR}/#{project.name}#{IML_SUFFIX}"
+            end
+          end
+        end
+
+        # Loading the whole fairly constant crap
+        template_xml = 
REXML::Document.new(File.open(File.join(File.dirname(__FILE__), IPR_TEMPLATE)))
+        include_xml = REXML::Document.new(partial.string)
+        template_xml.root.add_element(include_xml.root)
+        template_xml.write(File.new(task.name, "w"))
+      end
+    end
+
+
+  end  # module Idea7x
+end # module Buildr
+
+class Buildr::Project
+
+  include Buildr::Idea7x
+
+  def has_compile_sources
+    self.compile.target.to_s.size > 0
+  end
+
+  def has_test_sources
+    self.test.compile.target.to_s.size > 0
+  end
+end


Reply via email to