Rhett, thanks for the tasks, they work well.

I made some changes to allow jdk1.6 to be auto detected.

Use them if you like them.

Anders

    def default_components
      [
              lambda { modules_component },
              vcs_component,
              project_root_manager_component
      ].compact
    end


   def project_root_manager_component
      attributes = {'version' => 2, 'assert-keyword' =>"true",
'jdk-15' => "true", 'project-jdk-type'=>"JavaSDK"}

      if detect_jdk == 6
        attributes.merge!('languageLevel' => "JDK_1_6",
'project-jdk-name' => '1.6')
      else
        attributes.merge!('project-jdk-name' => '1.5')
      end
      IdeaProject.component("ProjectRootManager", attributes) do |xml|
        xml.output :url => "file://$PROJECT_DIR$/out"
      end
    end

    def detect_jdk
      version = ''
      IO.popen 'java -version 2>&1' do |output|
        version = output.gets
      end
      version.include?('1.6') ? 6 : 5
    end

On Fri, Feb 26, 2010 at 6:16 PM, Rhett Sutphin
<[email protected]> wrote:
> Hi Anders,
>
> On Feb 26, 2010, at 7:31 AM, Anders Janmyr wrote:
>
>> Hi Rhett,
>>
>> I'm interested in the your IDEA changes.
>> I have made a few changes myself to the idea task not to the idea7
>> task, mostly relating to JDK version.
>>
>> Could you put it on github, so I can pull from you?
>
> I don't have the changes integrated with buildr right now -- the new task is
> in the form of an extension embedded in a single project.  It's an open
> source project, though, so feel free to take a look:
>
> https://ncisvn.nci.nih.gov/svn/psc/trunk/tasks/new-idea.rake
> https://ncisvn.nci.nih.gov/svn/psc/trunk/tasks/new-idea.ipr.template
>
> Rhett
>
>>
>> Anders
>>
>>
>> On Thu, Feb 25, 2010 at 12:16 AM, Rhett Sutphin
>> <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> IDEA project file creation is indeed a slippery thing.  I use heavily
>>> modified version of idea7x myself (on IDEA 8) and have avoided upgrading
>>> to
>>> IDEA 9 partially because I don't want to deal with updating that task to
>>> work with 9 (if any are needed -- I haven't actually tried).
>>>
>>> That said, I have been meaning to re-package my custom task as a gem.  It
>>> seems to me that this is a better way to deal with IDEA support since
>>> none
>>> of the committers (AFAIK) use it.  I agree that a base abstraction with
>>> output that would work with both 8 and 9 (at least) would be nice.  Here
>>> are
>>> the features I have in my custom task (which is called iidea) over
>>> idea7x:
>>>
>>> 1) Detects VCS automatically (subversion and git only) with manual
>>> override
>>> 2) Automatically excludes all target and report directories from indexing
>>> 3) Supports manual configuration of source and test paths for each module
>>> 4) Supports low-level configuration of particular IML sections (by
>>> building
>>> XML directly in the buildr project definition)
>>> 5) Provides a "clean" task
>>> 6) Includes all buildr subprojects (not just ones that are packaged) but
>>> allows particular subprojects to be skipped using a project attribute
>>>
>>> All of those except for (4) should be possible using a base abstraction.
>>>  I'll see what I can come up with, though it will be a couple of weeks
>>> before I can really look at it.
>>>
>>> FWIW, IDEA 8 still supports the file-based approach.  (It's what I'm
>>> using
>>> with 8.1.4.)  I don't believe in committing IDE project files (or
>>> anything
>>> else which is generatable) to VCS, so it works fine for me and my team.
>>>  All
>>> the patches Alex brought up are minor changes to the existing idea7x
>>> code,
>>> so they use the file-based approach.
>>>
>>> Alex, BUILDR-367 and BUILDR-376 are both genuine issues which I've fixed
>>> in
>>> my task.  BUILDR-377 uses a feature of IDEA I'm not familiar with but
>>> which
>>> sounds useful.  I haven't reviewed any of the patches, though.
>>>
>>> Rhett
>>>
>>> On Feb 24, 2010, at 8:46 AM, Shane Witbeck wrote:
>>>
>>>> A few things to consider:
>>>>
>>>>
>>>>  1. I think we need to define which versions of IDEA these patches
>>>> should
>>>>  work with. The last idea7x patch which I wrote was specifically for
>>>> IDEA
>>>> 7x.
>>>>  It seems each subsequent version of IDEA (8x and 9x) has had changes to
>>>> the
>>>>  way they handle project and module files.
>>>>  2. Version 8x of IDEA introduced a new way of defining project and
>>>> module
>>>>  files. It's called the "directory-based" approach. I believe the new
>>>>  approach was to make it easier to share project files among team
>>>> members
>>>> by
>>>>  checking into a source repository. The older project files apparently
>>>> were
>>>>  hard to keep in sync because of merge conflicts, etc. Do these patches
>>>>  address the traditional project files or the new directory-based
>>>> approach?
>>>>  3. Having gone through the process of trying to keep changes in Buildr
>>>>  and IDEA project files in synch along with changing formats with each
>>>> new
>>>>  IDEA version, I finally gave up. I propose a more clearly defined
>>>> approach
>>>>  which addresses differences between IDEA project file version formats.
>>>>  Perhaps a departure from idea vs idea7x tasks and have one idea task
>>>> with
>>>> a
>>>>  param indicating which version to generate the project files for?
>>>>
>>>> That all being said, I'm willing to help in this effort.
>>>>
>>>> -Shane
>>>>
>>>>
>>>> On Wed, Feb 24, 2010 at 1:13 AM, Alex Boisvert
>>>> <[email protected]>wrote:
>>>>
>>>>> On Tue, Feb 23, 2010 at 9:18 PM, Alex Boisvert <[email protected]
>>>>>>
>>>>>> wrote:
>>>>>
>>>>>> Any committer wants to step in and review these patches?
>>>>>> https://issues.apache.org/jira/browse/BUILDR-376
>>>>>> https://issues.apache.org/jira/browse/BUILDR-377
>>>>>>
>>>>>> I don't use IDEA and I'm not familiar with their project descriptions.
>>>>>>
>>>>>
>>>>> While we're at it there's also this one to be reviewed,
>>>>> https://issues.apache.org/jira/browse/BUILDR-369
>>>>>
>>>>> In lieu of specs (which are sadly missing for IDEA), I could be
>>>>> consoled
>>>>> if
>>>>> fellow IDEA contributors cross-reviewed their patches.  i.e., Alexis
>>>>> reviewing BUILDR-376/377 and Peter reviewing BUILDR-369, or anybody
>>>>> else...
>>>>>
>>>>> Just indicate so on the issue itself to help expedite the process.
>>>>>
>>>>> thanks!
>>>>> alex
>>>>>
>>>
>>>
>>
>>
>>
>> --
>> http://anders.janmyr.com/
>
>



-- 
http://anders.janmyr.com/

Reply via email to