public TempFolder provide(BootstrapProperties bootstrapProps) {
if (tempFolder == null) {
String workingDirPath = StringUtils.defaultIfBlank(bootstrapProps.property(CoreProperties.WORKING_DIRECTORY), CoreProperties.WORKING_DIRECTORY_DEFAULT_VALUE);
- File workingDir = new File(workingDirPath);
+ File workingDir = new File(workingDirPath).getAbsoluteFile();
File tempDir = new File(workingDir, ".sonartmp");
try {
FileUtils.forceMkdir(tempDir);
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.utils.MessageException;
+import org.sonar.api.utils.System2;
import org.sonar.batch.mediumtest.BatchMediumTester;
import org.sonar.batch.mediumtest.BatchMediumTester.TaskResult;
import org.sonar.batch.protocol.input.ActiveRule;
import java.io.IOException;
import static org.fest.assertions.Assertions.assertThat;
+import static org.junit.Assume.assumeFalse;
public class FileSystemMediumTest {
}
+ // SONAR-5330
+ @Test
+ public void scanProjectWithSourceSymlink() throws Exception {
+ assumeFalse(System2.INSTANCE.isOsWindows());
+ File projectDir = new File("src/test/resources/mediumtest/xoo/sample-with-symlink");
+ TaskResult result = tester
+ .newScanTask(new File(projectDir, "sonar-project.properties"))
+ .start();
+
+ assertThat(result.inputFiles()).hasSize(3);
+ }
+
}
import org.sonar.api.utils.PathUtils;
import javax.annotation.CheckForNull;
+
import java.io.File;
import java.util.Collection;
import java.util.List;
File file = new File(path);
if (!file.isAbsolute()) {
try {
- file = new File(dir, path).getCanonicalFile();
+ file = new File(dir, path).getAbsoluteFile();
} catch (Exception e) {
throw new IllegalStateException("Fail to resolve path '" + path + "' relative to: " + dir.getAbsolutePath(), e);
}