Fix Tycho file locking to work in Fedora.

- Skip validateConsistentTychoVersion by default. (Bug 987271)
This commit is contained in:
Roland Grunberg 2013-07-26 11:15:55 -04:00
parent 87ef54fe60
commit cbbc0feb61
3 changed files with 66 additions and 20 deletions

View File

@ -1,4 +1,4 @@
From 8c4a712700b4ef835bd40dd4061246679d4fe435 Mon Sep 17 00:00:00 2001
From 1c9fe22c06bfa298f17e9aa35e8fffb031824a21 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Tue, 12 Jun 2012 09:56:38 -0400
Subject: [PATCH] Fix the Tycho build to work on Fedora.
@ -12,10 +12,7 @@ Tycho upstream currently depends upon 0.15.0 when building
Fedora we depend on the previously built version which has that version
checking. We must keep previous build version strings different to avoid
a cyclic dependency, but doing so causes the version checking to fail,
so we must provide a way to disable it. (skipTychoVersionCheck)
As of Eclipse Kepler, the bundle 'org.junit4' is no longer provided.
Packages requiring JUnit 4 must use proper versioning on 'org.junit'.
so we must provide a way to disable it. Disable by default.
Update to using Jetty 9 API.
@ -35,14 +32,13 @@ Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
.../maven/plugin/CompilationFailureException.java | 4 +--
.../core/maven/TychoMavenLifecycleParticipant.java | 4 ++-
.../tycho/test/AbstractTychoIntegrationTest.java | 11 +++---
.../tycho/testing/EmptyLifecycleExecutor.java | 8 +++++
13 files changed, 53 insertions(+), 49 deletions(-)
12 files changed, 45 insertions(+), 49 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3b57368..2651c9b 100644
index 76d5d1d..5e398a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -208,12 +208,12 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
@@ -219,12 +219,12 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
@ -57,7 +53,7 @@ index 3b57368..2651c9b 100644
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
@@ -226,11 +226,6 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
@@ -237,11 +237,6 @@ $CMD -DpomFile=org.eclipse.jdt.compiler.apt.pom \
<version>${jdtVersion}</version>
</dependency>
<dependency>
@ -70,7 +66,7 @@ index 3b57368..2651c9b 100644
<artifactId>surefire-booter</artifactId>
<version>2.10</version>
diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml
index 84613d1..48139c9 100644
index 39a45fd..d558b16 100644
--- a/tycho-artifactcomparator/pom.xml
+++ b/tycho-artifactcomparator/pom.xml
@@ -24,7 +24,7 @@
@ -131,7 +127,7 @@ index 57b4e10..47423e5 100644
jetty.addConnector(connector);
diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
index 02d1dd1..ba9471a 100644
index 9185cd4..27f16f5 100644
--- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
+++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
@@ -42,7 +42,6 @@
@ -155,7 +151,7 @@ index 62b354d..11f65fb 100644
<plugin id="org.eclipse.equinox.frameworkadmin"/>
<plugin id="org.eclipse.equinox.frameworkadmin.equinox"/>
diff --git a/tycho-compiler-jdt/pom.xml b/tycho-compiler-jdt/pom.xml
index f2c321f..75f4cd7 100644
index 20671c8..a71bd8b 100644
--- a/tycho-compiler-jdt/pom.xml
+++ b/tycho-compiler-jdt/pom.xml
@@ -38,10 +38,6 @@
@ -356,7 +352,7 @@ index 78dc4d8..8b73147 100644
sb.append(compilerError).append(LS);
}
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 3efb896..cccb6ff 100644
index 3efb896..3568d3b 100644
--- 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
@@ -84,7 +84,9 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
@ -364,7 +360,7 @@ index 3efb896..cccb6ff 100644
private void validate(List<MavenProject> projects) throws MavenExecutionException {
- validateConsistentTychoVersion(projects);
+ if (System.getProperty("skipTychoVersionCheck") == null) {
+ if (System.getProperty("tycho.enableVersionCheck") != null) {
+ validateConsistentTychoVersion(projects);
+ }
validateUniqueBaseDirs(projects);

View File

@ -1,4 +1,4 @@
From a1af94edb210feb59eecd372ce098c564ecd3656 Mon Sep 17 00:00:00 2001
From fa63e64381fc02e1d5b3086e4585f259fd2120f8 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Tue, 12 Jun 2012 10:38:51 -0400
Subject: [PATCH] Implement a custom resolver for Tycho in local mode.
@ -31,13 +31,14 @@ Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
.../tycho/p2/target/TargetPlatformBuilderImpl.java | 55 ++++++++++++++++++++--
.../tycho/p2/repository/LocalRepositoryReader.java | 22 ++++++++-
tycho-core/pom.xml | 5 ++
.../eclipse/tycho/core/locking/FileLockerImpl.java | 24 +++++++---
.../core/maven/TychoMavenLifecycleParticipant.java | 28 +++++++++++
.../tycho/core/osgitools/AbstractTychoProject.java | 24 ++++++++++
.../tycho/core/osgitools/OsgiBundleProject.java | 29 +++++++++++-
.../DefaultTargetPlatformConfigurationReader.java | 6 ++-
.../osgi/runtime/TychoOsgiRuntimeLocator.java | 17 +++++++
.../p2/resolver/P2TargetPlatformResolver.java | 11 +++++
10 files changed, 196 insertions(+), 12 deletions(-)
11 files changed, 214 insertions(+), 18 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 2dc91ff..8395f82 100644
@ -205,8 +206,53 @@ index d1289b6..53cdc7a 100644
<dependency>
<groupId>org.eclipse.tycho</groupId>
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
index 86253bd..247b2b2 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
@@ -27,22 +27,34 @@ public class FileLockerImpl implements FileLocker {
final File lockMarkerFile;
public FileLockerImpl(File file, Location anyLocation) {
+ File lockFileCandidate = null;
try {
if (file.isDirectory()) {
- this.lockMarkerFile = new File(file, LOCKFILE_SUFFIX).getCanonicalFile();
+ lockFileCandidate = new File(file, LOCKFILE_SUFFIX).getCanonicalFile();
} else {
- this.lockMarkerFile = new File(file.getParentFile(), file.getName() + LOCKFILE_SUFFIX)
- .getCanonicalFile();
+ lockFileCandidate = new File(file.getParentFile(), file.getName() + LOCKFILE_SUFFIX).getCanonicalFile();
}
- if (lockMarkerFile.isDirectory()) {
- throw new RuntimeException("Lock marker file " + lockMarkerFile + " already exists and is a directory");
+
+ if (lockFileCandidate.isDirectory()) {
+ throw new RuntimeException("Lock marker file " + lockFileCandidate + " already exists and is a directory");
}
- File parentDir = lockMarkerFile.getParentFile();
+ File parentDir = lockFileCandidate.getParentFile();
if (!parentDir.isDirectory() && !parentDir.mkdirs()) {
throw new RuntimeException("Could not create parent directory " + parentDir + " of lock marker file");
}
+
+ String reactorCache = System.getProperty("user.dir") + "/.m2/";
+ // In Fedora we can only assume reactor cache is safe for read/write.
+ if (!lockFileCandidate.getAbsolutePath().startsWith(reactorCache)) {
+ String lockFileDir = reactorCache + LOCKFILE_SUFFIX;
+ String lockFileName = file.getAbsolutePath().replace("/", "-").replaceFirst("-", "/") + LOCKFILE_SUFFIX;
+ lockFileCandidate = new File(lockFileDir, lockFileName);
+ }
+
+ this.lockMarkerFile = lockFileCandidate;
this.lockFileLocation = anyLocation.createLocation(null, null, false);
this.lockFileLocation.set(lockMarkerFile.toURL(), false, lockMarkerFile.getAbsolutePath());
+
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} catch (IOException e) {
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 cccb6ff..c3a71f7 100644
index 3568d3b..dc77848 100644
--- 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
@@ -11,6 +11,7 @@

View File

@ -9,7 +9,7 @@
Name: tycho
Version: 0.18.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
Group: Development/Libraries
@ -295,6 +295,10 @@ install -m 644 $osgiJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.jar
%{_javadocdir}/%{name}
%changelog
* Mon Jul 29 2013 Roland Grunberg <rgrunber@redhat.com> - 0.18.1-3
- Fix Tycho file locking to work in Fedora.
- Skip validateConsistentTychoVersion by default. (Bug 987271)
* Wed Jul 24 2013 Roland Grunberg <rgrunber@redhat.com> - 0.18.1-2
- Non-bootstrap build.
@ -326,7 +330,7 @@ install -m 644 $osgiJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.jar
* Tue May 28 2013 Roland Grunberg <rgrunber@redhat.com> 0.18.0-1
- Update to 0.18.0 Release.
* Tue Apr 11 2013 Roland Grunberg <rgrunber@redhat.com> 0.17.0-1
* Thu Apr 11 2013 Roland Grunberg <rgrunber@redhat.com> 0.17.0-1
- Fix bootstrap build for potential future use.
* Tue Apr 2 2013 Roland Grunberg <rgrunber@redhat.com> 0.17.0-1