diff options
author | Marc-Andre Laperle | 2012-04-23 06:00:18 +0000 |
---|---|---|
committer | Andrew Gvozdev | 2012-04-23 15:55:45 +0000 |
commit | eb6522badf02ad57388cf52910694769abd7f8b3 (patch) | |
tree | ab99a8604475a646abd80933574ada25f8bca784 | |
parent | dd48abd247bb4113ef1f78dd6da31845985b2a72 (diff) | |
download | org.eclipse.cdt-eb6522badf02ad57388cf52910694769abd7f8b3.tar.gz org.eclipse.cdt-eb6522badf02ad57388cf52910694769abd7f8b3.tar.xz org.eclipse.cdt-eb6522badf02ad57388cf52910694769abd7f8b3.zip |
Bug 377295 - Build fails if project name contains characters [, ]
Change-Id: I9f116f524bb30e064e1cdbb3588c494a450d765e
Reviewed-on: https://git.eclipse.org/r/5636
Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com>
IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com>
Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com>
3 files changed, 34 insertions, 30 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java index 722fb5d7629..0b2a1c1d408 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Broadcom Corporation and others. + * Copyright (c) 2011, 2012 Broadcom Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -71,11 +71,13 @@ public abstract class AbstractBuilderTest extends TestCase { Job.getJobManager().cancel(CCorePlugin.getPDOMManager()); Job.getJobManager().join(CCorePlugin.getPDOMManager(), null); - // Clean-up any projects we were using - for (IProject project : projects) { - project.delete(true, null); + if (projects != null) { + // Clean-up any projects we were using + for (IProject project : projects) { + project.delete(true, null); + } + projects.clear(); } - projects.clear(); } /** diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java index e0bd32d4bfd..965ee5a0438 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2011 QNX Software Systems and others.
+ * Copyright (c) 2011, 2012 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,9 @@ package org.eclipse.cdt.managedbuilder.core.tests;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.model.CoreModel;
@@ -28,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
+import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -39,11 +38,10 @@ import org.eclipse.core.resources.IWorkspaceDescription; import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-public class ManagedBuildDependencyLibsTests extends TestCase {
+public class ManagedBuildDependencyLibsTests extends AbstractBuilderTest {
private static final String PROJ_PATH = "depLibsProjects";
private static final String MESSAGE_TAIL = " (see .log file for more details).";
@@ -60,12 +58,12 @@ public class ManagedBuildDependencyLibsTests extends TestCase { suite.addTest(new ManagedBuildDependencyLibsTests("testDepLibs"));
suite.addTest(new ManagedBuildDependencyLibsTests("testDepUObjs"));
+ suite.addTest(new ManagedBuildDependencyLibsTests("testGetArtifactTimeStampEscapeURI_bug377295"));
return suite;
}
private void buildProject(IProject curProject) {
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject);
try {
IProject[] referencedProjects = curProject.getReferencedProjects();
for(int i = 0; i < referencedProjects.length; ++i)
@@ -117,20 +115,6 @@ public class ManagedBuildDependencyLibsTests extends TestCase { ManagedBuildTestHelper.removeProject(fTlib.getName());
ManagedBuildTestHelper.removeProject(fTobjs.getName());
}
-
- private void deleteFiles(IFolder dir, String pattern, IProgressMonitor monitor) {
- List<IFile> files = new ArrayList<IFile>();
- findFiles(dir, pattern, files);
- for(Iterator<IFile> i = files.iterator(); i.hasNext(); ) {
- IFile file = i.next();
- try {
- file.delete(true, monitor);
- } catch (CoreException e) {
- e.printStackTrace();
- fail("Error deleting file " + file.getFullPath().toString() + '.' + MESSAGE_TAIL);
- }
- }
- }
private void findFiles(IResource dir, String pattern, List<IFile> files) {
IResource resource = null;
@@ -146,7 +130,7 @@ public class ManagedBuildDependencyLibsTests extends TestCase { for(int i = 0; i < members.length; ++i) {
resource = members[i];
if(resource.getType() == IResource.FOLDER)
- findFiles((IFolder)resource, pattern, files);
+ findFiles(resource, pattern, files);
else {
if(resource.getName().matches(pattern))
files.add((IFile)resource);
@@ -291,4 +275,20 @@ public class ManagedBuildDependencyLibsTests extends TestCase { fail("Error. This time it should build application.");
}
}
+
+ // Tests that the URI used to get the time stamp of the artifact is escaped correctly
+ // See AdditionalInput.getArtifactTimeStamp(IToolChain toolChain)
+ public void testGetArtifactTimeStampEscapeURI_bug377295() throws CoreException {
+ setWorkspace("regressions");
+ final IProject project = loadProject("helloworldC");
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
+ for (IConfiguration configuration : configs) {
+ configuration.setArtifactName("test [377295]");
+ }
+
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ // This will trigger AdditionalInput.getArtifactTimeStamp to get called, no IllegalArgumentException should be thrown
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ }
}
\ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java index 0ac2ec3976f..e7535c98a39 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java @@ -1,13 +1,14 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 Intel Corporation and others. + * Copyright (c) 2005, 2012 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Intel Corporation - Initial API and implementation - * IBM Corporation + * Intel Corporation - Initial API and implementation + * IBM Corporation + * Marc-Andre Laperle *******************************************************************************/ package org.eclipse.cdt.managedbuilder.internal.core; @@ -40,6 +41,7 @@ import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo; import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData; import org.eclipse.cdt.managedbuilder.macros.BuildMacroException; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; +import org.eclipse.cdt.utils.EFSExtensionManager; import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver; import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor; import org.eclipse.core.filesystem.EFS; @@ -380,7 +382,7 @@ public class AdditionalInput implements IAdditionalInput { } catch (BuildMacroException e) { } - URI buildArtifactURI = buildLocationURI.resolve(artifactName); + URI buildArtifactURI = EFSExtensionManager.getDefault().append(buildLocationURI, artifactName); try { IFileStore artifact = EFS.getStore(buildArtifactURI); |