[tycho] Reference objectweb-asm4 gid:aid and fix local mode resolution bug.

Roland Grunberg rgrunber at fedoraproject.org
Wed Aug 15 20:39:02 UTC 2012


commit a687c60712d0499acbf9a10ab71d99b2d5e242a9
Author: Roland Grunberg <rgrunber at redhat.com>
Date:   Fri Aug 10 13:22:13 2012 -0400

    Reference objectweb-asm4 gid:aid and fix local mode resolution bug.
    
    When in local mode, but not offline, Tycho should favour local system
    dependencies over remote ones in all cases.

 tycho-fix-build.patch           |   30 +++-----------
 tycho-use-custom-resolver.patch |   88 +++++++++++++++++++++++++++++++++-----
 tycho.spec                      |    7 ++-
 3 files changed, 87 insertions(+), 38 deletions(-)
---
diff --git a/tycho-fix-build.patch b/tycho-fix-build.patch
index ff6347c..51e0318 100644
--- a/tycho-fix-build.patch
+++ b/tycho-fix-build.patch
@@ -1,4 +1,4 @@
-From 2d1e009c256c26c8b1bf66dace56bb7a8436c236 Mon Sep 17 00:00:00 2001
+From 2ddba330f84d010cb462848c3686d084667091ec Mon Sep 17 00:00:00 2001
 From: Roland Grunberg <rgrunber at redhat.com>
 Date: Tue, 12 Jun 2012 09:56:38 -0400
 Subject: [PATCH 1/4] Fix the Tycho build to work on Fedora.
@@ -12,13 +12,10 @@ when using those libraries.
 
 Remove org.eclipse.equinox.concurrent until present in Fedora Eclipse.
 
-Fix API issues with org.objectweb.asm (Need 4.0 but only have 3.0).
-
 Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
 ---
  pom.xml                                                      |  5 -----
- tycho-artifactcomparator/pom.xml                             |  6 +++---
- .../tycho/zipcomparator/internal/ClassfileComparator.java    |  2 +-
+ tycho-artifactcomparator/pom.xml                             |  4 ++--
  .../tycho-bundles-external/tycho-bundles-external.product    |  1 -
  tycho-bundles/tycho-bundles-target/tycho.target              |  4 ----
  .../tycho-standalone-p2-director/p2 Director.product         |  1 -
@@ -27,7 +24,7 @@ Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
  .../tycho/core/osgitools/StandalonePluginConverterTest.java  |  8 ++++----
  .../org/eclipse/tycho/test/AbstractTychoIntegrationTest.java | 11 +++++------
  .../org/eclipse/tycho/testing/EmptyLifecycleExecutor.java    |  8 ++++++++
- 11 files changed, 27 insertions(+), 35 deletions(-)
+ 10 files changed, 25 insertions(+), 33 deletions(-)
 
 diff --git a/pom.xml b/pom.xml
 index dc7c1f5..1868f9a 100644
@@ -46,16 +43,14 @@ index dc7c1f5..1868f9a 100644
  				<artifactId>surefire-booter</artifactId>
  				<version>2.10</version>
 diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml
-index 775107a..a6ff6f7 100644
+index 775107a..11bcb70 100644
 --- a/tycho-artifactcomparator/pom.xml
 +++ b/tycho-artifactcomparator/pom.xml
-@@ -23,8 +23,8 @@
-   <dependencies>
+@@ -24,7 +24,7 @@
      <dependency>
        <!-- CQ https://dev.eclipse.org/ipzilla/show_bug.cgi?id=6591 -->
--      <groupId>org.ow2.asm</groupId>
+       <groupId>org.ow2.asm</groupId>
 -      <artifactId>asm-debug-all</artifactId>
-+      <groupId>asm</groupId>
 +      <artifactId>asm-all</artifactId>
        <version>4.0</version>
      </dependency>
@@ -67,19 +62,6 @@ index 775107a..a6ff6f7 100644
 -</project>
 \ No newline at end of file
 +</project>
-diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
-index 6944b03..a3a9825 100644
---- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
-+++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
-@@ -61,7 +61,7 @@ public class ClassfileComparator implements ContentsComparator {
-     private String disassemble(byte[] bytes) {
-         ClassReader reader = new ClassReader(bytes);
-         ClassNode clazz = new ClassNode();
--        reader.accept(clazz, Opcodes.ASM4 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
-+        reader.accept(clazz, (4 << 16 | 0 << 8 | 0) | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
- 
-         // inner class list gets reordered during pack200 normalization
-         if (clazz.innerClasses != null) {
 diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
 index 3e584f5..8b54310 100644
 --- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
diff --git a/tycho-use-custom-resolver.patch b/tycho-use-custom-resolver.patch
index afbaa57..587056d 100644
--- a/tycho-use-custom-resolver.patch
+++ b/tycho-use-custom-resolver.patch
@@ -1,4 +1,4 @@
-From 204897532cb0a533634dc66faef31afb1822df03 Mon Sep 17 00:00:00 2001
+From 595646a547fca48d8211b29f9951190ba737f42a Mon Sep 17 00:00:00 2001
 From: Roland Grunberg <rgrunber at redhat.com>
 Date: Tue, 12 Jun 2012 10:38:51 -0400
 Subject: [PATCH] Implement a custom resolver for Tycho in local mode.
@@ -21,15 +21,15 @@ tycho.local.keepTarget is set.
 
 Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
 ---
- .../tycho/p2/target/TargetDefinitionResolver.java  | 10 ++++--
- .../tycho/p2/target/TargetPlatformBuilderImpl.java |  6 ++++
- .../core/maven/TychoMavenLifecycleParticipant.java | 16 +++++++++
- .../core/osgitools/EclipseFeatureProject.java      | 22 ++++++++++++
- .../tycho/core/osgitools/OsgiBundleProject.java    | 42 ++++++++++++++++++++--
- .../DefaultTargetPlatformConfigurationReader.java  |  5 ++-
- .../tycho/osgi/runtime/TychoP2RuntimeLocator.java  | 15 ++++++++
- .../p2/resolver/P2TargetPlatformResolver.java      | 10 ++++++
- 8 files changed, 120 insertions(+), 6 deletions(-)
+ .../tycho/p2/target/TargetDefinitionResolver.java  | 10 ++--
+ .../tycho/p2/target/TargetPlatformBuilderImpl.java | 55 ++++++++++++++++++++--
+ .../core/maven/TychoMavenLifecycleParticipant.java | 16 +++++++
+ .../core/osgitools/EclipseFeatureProject.java      | 22 +++++++++
+ .../tycho/core/osgitools/OsgiBundleProject.java    | 42 ++++++++++++++++-
+ .../DefaultTargetPlatformConfigurationReader.java  |  5 +-
+ .../tycho/osgi/runtime/TychoP2RuntimeLocator.java  | 15 ++++++
+ .../p2/resolver/P2TargetPlatformResolver.java      | 10 ++++
+ 8 files changed, 164 insertions(+), 11 deletions(-)
 
 diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
 index 5fdc6a1..838e267 100644
@@ -60,10 +60,20 @@ index 5fdc6a1..838e267 100644
  
                  IQueryable<IInstallableUnit> locationUnits = new CompoundQueryable<IInstallableUnit>(
 diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
-index fa1cfab..23cdb5d 100644
+index fa1cfab..489903e 100644
 --- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
 +++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
-@@ -223,6 +223,12 @@ public class TargetPlatformBuilderImpl implements TargetPlatformBuilder {
+@@ -38,6 +38,9 @@ import org.eclipse.equinox.p2.core.IProvisioningAgent;
+ import org.eclipse.equinox.p2.core.ProvisionException;
+ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+ import org.eclipse.equinox.p2.metadata.VersionedId;
++import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
++import org.eclipse.equinox.p2.metadata.expression.IExpression;
++import org.eclipse.equinox.p2.query.IQuery;
+ import org.eclipse.equinox.p2.query.IQueryResult;
+ import org.eclipse.equinox.p2.query.QueryUtil;
+ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+@@ -223,6 +226,12 @@ public class TargetPlatformBuilderImpl implements TargetPlatformBuilder {
          IMetadataRepository metadataRepository = null;
          IArtifactRepository artifactRepository = null;
  
@@ -76,6 +86,60 @@ index fa1cfab..23cdb5d 100644
          try {
              remoteRepositoryIdManager.addMapping(location.getId(), location.getURL());
  
+@@ -359,12 +368,48 @@ public class TargetPlatformBuilderImpl implements TargetPlatformBuilder {
+             result.addAll(contentPart.getUnits());
+         }
+ 
+-        SubMonitor sub = SubMonitor.convert(monitor, metadataRepositories.size() * 200);
+-        for (IMetadataRepository repository : metadataRepositories) {
+-            IQueryResult<IInstallableUnit> matches = repository.query(QueryUtil.ALL_UNITS, sub.newChild(100));
+-            result.addAll(matches.toUnmodifiableSet());
++        if (System.getProperty("maven.local.mode") != null && !offline) {
++            final String uri = "file:" + System.getProperty("user.dir") + "/.m2/p2/repo";
++            final IExpression notmatchIU_ID = ExpressionUtil.parse("id != $0");
++            IMetadataRepository systemLocalP2Repo = null;
++
++            // Sanity check even though the repo we want should be at index 1
++            for (IMetadataRepository repository : metadataRepositories) {
++                if (repository.getLocation().toString().equals(uri)) {
++                    systemLocalP2Repo = repository;
++                    break;
++                }
++            }
++
++            IQuery<IInstallableUnit> noLocalIUs = QueryUtil.createIUAnyQuery();
++
++            // Create a conjunction query that negates all IUs on the local system
++            for (IInstallableUnit unit : systemLocalP2Repo.query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet()) {
++                noLocalIUs = QueryUtil.createCompoundQuery(noLocalIUs, QueryUtil.createMatchQuery(notmatchIU_ID, unit.getId()), true);
++            }
++
++            SubMonitor sub = SubMonitor.convert(monitor, metadataRepositories.size() * 200);
++            for (IMetadataRepository repository : metadataRepositories) {
++                IQueryResult<IInstallableUnit> matches;
++                if (repository.getLocation().toString().equals(uri)) {
++                    matches = repository.query(QueryUtil.ALL_UNITS, sub.newChild(100));
++                } else {
++                    // Don't collect any remote IUs that can be found on the system
++                    // This will favour IUs in the system local p2 repository
++                    matches = repository.query(noLocalIUs, sub.newChild(100));
++                }
++                result.addAll(matches.toUnmodifiableSet());
++            }
++            sub.done();
++        } else {
++            SubMonitor sub = SubMonitor.convert(monitor, metadataRepositories.size() * 200);
++            for (IMetadataRepository repository : metadataRepositories) {
++                IQueryResult<IInstallableUnit> matches = repository.query(QueryUtil.ALL_UNITS, sub.newChild(100));
++                matches = repository.query(QueryUtil.ALL_UNITS, sub.newChild(100));
++                result.addAll(matches.toUnmodifiableSet());
++            }
++            sub.done();
+         }
+-        sub.done();
+ 
+         if (logger.isDebugEnabled()) {
+             IQueryResult<IInstallableUnit> locallyInstalledIUs = localMetadataRepository.query(QueryUtil.ALL_UNITS,
 diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
 index 0dd2fd4..15669a6 100644
 --- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
diff --git a/tycho.spec b/tycho.spec
index 8b6d7da..9c3e1d5 100644
--- a/tycho.spec
+++ b/tycho.spec
@@ -1,4 +1,4 @@
-%global bootstrap 0
+%global bootstrap 1
 %global sha df2c3591ae0e641a8d12c13ca9c1058eaf8439b2
 
 %if %{bootstrap}
@@ -9,7 +9,7 @@
 
 Name:           tycho
 Version:        0.16.0
-Release:        4.df2c35%{?dist}
+Release:        4.1.df2c35%{?dist}
 Summary:        Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
 
 Group:          Development/Libraries
@@ -205,6 +205,9 @@ install -pm 755 %{SOURCE3} %{buildroot}%{_javadir}/%{name}/copy-platform-all
 %{_javadocdir}/%{name}
 
 %changelog
+* Mon Aug 13 2012 Roland Grunberg <rgrunber at redhat.com> 0.16.0-4.1.df2c35
+- Correctly reference objectweb-asm4 and fix local mode resolution bug.
+
 * Thu Aug 9 2012 Roland Grunberg <rgrunber at redhat.com> 0.16.0-4.df2c35
 - Non-bootstrap build.
 


More information about the scm-commits mailing list