Reduce length of file lock name when file is in build directory.

This commit is contained in:
Roland Grunberg 2013-11-18 14:27:38 -05:00
parent 8b7debaa61
commit a9422dc67c
2 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
From 8242049f30a7271ff801748976922edff03e05fe Mon Sep 17 00:00:00 2001
From 8cd8f81a6716b84acc5daf5ff9362db1b317f5cf 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.
@ -33,14 +33,14 @@ Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
.../tycho/p2/repository/LocalRepositoryReader.java | 31 +++++++++++++-
.../facade/TargetPlatformConfigurationStub.java | 5 ++-
tycho-core/pom.xml | 5 +++
.../eclipse/tycho/core/locking/FileLockerImpl.java | 24 ++++++++---
.../eclipse/tycho/core/locking/FileLockerImpl.java | 26 ++++++++---
.../core/maven/TychoMavenLifecycleParticipant.java | 29 +++++++++++++
.../tycho/core/osgitools/AbstractTychoProject.java | 24 +++++++++++
.../tycho/core/osgitools/OsgiBundleProject.java | 29 ++++++++++++-
.../DefaultTargetPlatformConfigurationReader.java | 6 ++-
.../osgi/runtime/TychoOsgiRuntimeLocator.java | 17 ++++++++
.../p2/resolver/P2TargetPlatformResolver.java | 10 +++++
13 files changed, 226 insertions(+), 30 deletions(-)
13 files changed, 228 insertions(+), 30 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 b008768..77c1443 100644
@ -261,10 +261,10 @@ index 853bcf4..b29017f 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
index 86253bd..cef15d2 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 {
@@ -27,22 +27,36 @@ public class FileLockerImpl implements FileLocker {
final File lockMarkerFile;
public FileLockerImpl(File file, Location anyLocation) {
@ -290,11 +290,13 @@ index 86253bd..247b2b2 100644
throw new RuntimeException("Could not create parent directory " + parentDir + " of lock marker file");
}
+
+ String reactorCache = System.getProperty("user.dir") + "/.m2/";
+ String baseDir = System.getProperty("user.dir");
+ String reactorCache = baseDir + "/.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;
+ // If the file is located within baseDir, no need to repeat
+ String lockFileName = file.getAbsolutePath().replace(baseDir, "").replace("/", "-").replaceFirst("-", "/") + LOCKFILE_SUFFIX;
+ lockFileCandidate = new File(lockFileDir, lockFileName);
+ }
+

View File

@ -9,7 +9,7 @@
Name: tycho
Version: 0.19.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
Group: Development/Libraries
@ -308,6 +308,9 @@ sed -i 's|<maven>|&<extension>zip</extension>|' \
%{_javadocdir}/%{name}
%changelog
* Mon Nov 18 2013 Roland Grunberg <rgrunber@redhat.com> - 0.19.0-2
- Reduce length of file lock name when file is in build directory.
* Thu Oct 24 2013 Roland Grunberg <rgrunber@redhat.com> - 0.19.0-1
- Update to 0.19.0 Release.