You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/10/11 02:54:30 UTC

svn commit: r823994 - in /buildr/trunk: CHANGELOG lib/buildr/ide/eclipse/plugin.rb spec/ide/eclipse_spec.rb

Author: boisvert
Date: Sun Oct 11 00:54:29 2009
New Revision: 823994

URL: http://svn.apache.org/viewvc?rev=823994&view=rev
Log:
BUILDR-328 Detect Eclipse plugin project with META-INF/MANIFEST.MF and Bundle-SymblicName: entry

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/ide/eclipse/plugin.rb
    buildr/trunk/spec/ide/eclipse_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=823994&r1=823993&r2=823994&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Oct 11 00:54:29 2009
@@ -1,4 +1,6 @@
 1.4.0 (Pending)
+* Added:  BUILDR-328 Detect Eclipse plugin project with META-INF/MANIFEST.MF and Bundle-SymblicName:
+          entry
 * Fixed:  BUILDR-327 Specifying :plugin eclipse nature explicitly fails
 
 1.3.5 (2009-10-05)

Modified: buildr/trunk/lib/buildr/ide/eclipse/plugin.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/eclipse/plugin.rb?rev=823994&r1=823993&r2=823994&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/eclipse/plugin.rb (original)
+++ buildr/trunk/lib/buildr/ide/eclipse/plugin.rb Sun Oct 11 00:54:29 2009
@@ -30,7 +30,10 @@
         eclipse = project.eclipse
 
         # smart defaults
-        if eclipse.natures.empty? && ((File.exists? project.path_to("plugin.xml")) || (File.exists? project.path_to("OSGI-INF")))
+        if eclipse.natures.empty? && (
+            (File.exists? project.path_to("plugin.xml")) ||
+            (File.exists? project.path_to("OSGI-INF")) ||
+            (File.exists?(project.path_to("META-INF/MANIFEST.MF")) && File.read(project.path_to("META-INF/MANIFEST.MF")).match(/^Bundle-SymblicName:/)))
           eclipse.natures = [NATURE, Buildr::Eclipse::Java::NATURE]
           eclipse.classpath_containers = [CONTAINER, Buildr::Eclipse::Java::CONTAINER] if eclipse.classpath_containers.empty?
           eclipse.builders = BUILDERS + [Buildr::Eclipse::Java::BUILDER] if eclipse.builders.empty?

Modified: buildr/trunk/spec/ide/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/eclipse_spec.rb?rev=823994&r1=823993&r2=823994&view=diff
==============================================================================
--- buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ buildr/trunk/spec/ide/eclipse_spec.rb Sun Oct 11 00:54:29 2009
@@ -202,7 +202,7 @@
       end
     end
     
-    describe 'Non standard Plugin project' do
+    describe 'Plugin project' do
 
       before do
         write 'buildfile'
@@ -211,23 +211,58 @@
       end
 
       it 'should have plugin nature before Java nature' do
-        define('foo') do
-          eclipse.natures = [:java, :plugin]
-        end
+        define('foo')
         project_natures.should include(PLUGIN_NATURE)
         project_natures.should include(JAVA_NATURE)
         project_natures.index(PLUGIN_NATURE).should < project_natures.index(JAVA_NATURE)
       end
 
       it 'should have plugin build commands and the Java build command' do
-        define('foo') do
-          eclipse.natures = [:java, :plugin]
-        end
+        define('foo')
         build_commands.should include(PLUGIN_BUILDERS[0])
         build_commands.should include(PLUGIN_BUILDERS[1])
         build_commands.should include(JAVA_BUILDER)
       end
     end
+    
+    describe 'Plugin project with META-INF/MANIFEST.MF' do
+
+      before do
+        write 'buildfile'
+        write 'src/main/java/Activator.java'
+      end
+
+      it 'should have plugin nature by default if MANIFEST.MF contains "Bundle-SymblicName:"' do
+        write 'META-INF/MANIFEST.MF', <<-MANIFEST
+Manifest-Version: 1.0
+Name: example/
+Specification-Title: "Examples" 
+Specification-Version: "1.0"
+Specification-Vendor: "Acme Corp.".
+Implementation-Title: "example" 
+Implementation-Version: "build57"
+Implementation-Vendor: "Acme Corp."
+Bundle-SymblicName: acme.plugin.example
+MANIFEST
+        define('foo')
+        project_natures.should include(PLUGIN_NATURE)
+      end
+
+      it 'should not have plugin nature if MANIFEST.MF exists but doesn\'t contain "Bundle-SymblicName:"' do
+        write 'META-INF/MANIFEST.MF', <<-MANIFEST
+Manifest-Version: 1.0
+Name: example/
+Specification-Title: "Examples" 
+Specification-Version: "1.0"
+Specification-Vendor: "Acme Corp.".
+Implementation-Title: "example" 
+Implementation-Version: "build57"
+Implementation-Vendor: "Acme Corp."
+MANIFEST
+        define('foo')
+        project_natures.should_not include(PLUGIN_NATURE)
+      end
+    end
   end
 
   describe "eclipse's .classpath file" do