Skip to content

Commit 94adcd5

Browse files
committed
Merge pull request #651 from jmecosta/feature/windows-build
add build for windows
2 parents 0447a5c + 2f9678e commit 94adcd5

File tree

12 files changed

+393
-348
lines changed

12 files changed

+393
-348
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[![Build Status](https://travis-ci.org/wenns/sonar-cxx.svg?branch=master)](https://travis-ci.org/wenns/sonar-cxx)
2+
[![Build status](https://ci.appveyor.com/api/projects/status/mi5ft6fo1qx3q8o7?svg=true)](https://ci.appveyor.com/project/jorgecosta/sonar-cxx)
3+
24

35
## SonarQube C++ Community plugin
46

appveyor.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: '{build}'
2+
os: Windows Server 2012
3+
install:
4+
- ps: |
5+
Add-Type -AssemblyName System.IO.Compression.FileSystem
6+
if (!(Test-Path -Path "C:\maven" )) {
7+
(new-object System.Net.WebClient).DownloadFile(
8+
'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
9+
'C:\maven-bin.zip'
10+
)
11+
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
12+
}
13+
- ps: |
14+
If ($env:Platform -Match "x86") {
15+
$env:PCRE_PLATFORM="Win32"
16+
$env:JAVA_HOME="c:/Program Files (x86)/Java/jdk1.8.0"
17+
$env:MSBuildDir="C:/Program Files (x86)/MSBuild/14.0/Bin/msbuild.exe"
18+
$env:VCVARS_PLATFORM="x86"
19+
$env:LANG_PLATFORM=""
20+
} Else {
21+
$env:PCRE_PLATFORM="x64"
22+
$env:JAVA_HOME="c:/Program Files/Java/jdk1.8.0"
23+
$env:MSBuildDir="C:/Program Files/MSBuild/14.0/Bin/msbuild.exe"
24+
$env:VCVARS_PLATFORM="amd64"
25+
$env:LANG_PLATFORM="-x64"
26+
}
27+
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;%JAVA_HOME%\bin;%PATH%
28+
- cmd: SET
29+
build_script:
30+
- mvn clean install
31+
cache:
32+
- C:\maven\
33+
- C:\Users\appveyor\.m2
34+
artifacts:
35+
- path: 'sonar-cxx-plugin\target\sonar-cxx-plugin-0.9.4-SNAPSHOT.jar'
36+
- path: 'sslr-cxx-toolkit\target\sslr-cxx-toolkit-0.9.4-SNAPSHOT.jar'
37+
on_failure:
38+
- ps: Get-ChildItem cxx-squid\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
39+
- ps: Get-ChildItem cxx-checks\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
40+
- ps: Get-ChildItem sonar-cxx-plugin\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
41+

cxx-squid/src/test/resources/compiler/vc++13.txt

Lines changed: 310 additions & 310 deletions
Large diffs are not rendered by default.

sonar-cxx-plugin/src/test/java/org/sonar/plugins/cxx/coverage/CxxBullseyeCoverageSensorTest.java

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import static org.mockito.Mockito.mock;
3838
import static org.mockito.Mockito.times;
3939
import static org.mockito.Mockito.verify;
40+
import org.sonar.plugins.cxx.utils.CxxUtils;
4041

4142
public class CxxBullseyeCoverageSensorTest {
4243

@@ -63,16 +64,16 @@ public void shouldReportCorrectCoverage() {
6364
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
6465
settings.setProperty(CxxCoverageSensor.IT_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
6566
settings.setProperty(CxxCoverageSensor.OVERALL_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
66-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.h");
67-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.cpp");
68-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/main.cpp");
69-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.h");
70-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.cpp");
71-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/source_1.cpp");
72-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.h");
73-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.cpp");
74-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/main.cpp");
75-
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.h");
67+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.h"));
68+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.cpp"));
69+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/main.cpp"));
70+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.h"));
71+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.cpp"));
72+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/source_1.cpp"));
73+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.h"));
74+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.cpp"));
75+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/main.cpp"));
76+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.h"));
7677
} else {
7778
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-linux.xml");
7879
settings.setProperty(CxxCoverageSensor.IT_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-linux.xml");
@@ -98,16 +99,16 @@ public void shoulParseTopLevelFiles() {
9899
Settings settings = new Settings();
99100
if (TestUtils.isWindows()) {
100101
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-win.xml");
101-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/anotherincludeattop.h");
102-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test/test.c");
103-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test2/test2.c");
104-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/main.c");
102+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/anotherincludeattop.h"));
103+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test/test.c"));
104+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test2/test2.c"));
105+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/main.c"));
105106
} else {
106107
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-linux.xml");
107-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/anotherincludeattop.h");
108-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test/test.c");
109-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test2/test2.c");
110-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/main.c");
108+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/anotherincludeattop.h");
109+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test/test.c");
110+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test2/test2.c");
111+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/main.c");
111112
}
112113
sensor = new CxxCoverageSensor(settings, fs, TestUtils.mockReactor());
113114
sensor.analyse(project, context);
@@ -119,17 +120,17 @@ public void shoulCorrectlyHandleDriveLettersWithoutSlash() {
119120
Settings settings = new Settings();
120121
if (TestUtils.isWindows()) {
121122
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-win.xml");
122-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/main.c");
123-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test.c");
124-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas2/test2.c");
125-
TestUtils.addInputFile(fs, perspectives, issuable, "e:/anotherincludeattop.h");
123+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/main.c"));
124+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test.c"));
125+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas2/test2.c"));
126+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/anotherincludeattop.h"));
126127
}
127128
else {
128129
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-linux.xml");
129-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/main.c");
130-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test.c");
131-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test2/test2.c");
132-
TestUtils.addInputFile(fs, perspectives, issuable, "/e/anotherincludeattop.h");
130+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/main.c");
131+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test.c");
132+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test2/test2.c");
133+
TestUtils.addInputFile(fs, perspectives, issuable, "/c/anotherincludeattop.h");
133134
}
134135
sensor = new CxxCoverageSensor(settings, fs, TestUtils.mockReactor());
135136
sensor.analyse(project, context);

sonar-cxx-plugin/src/test/java/org/sonar/plugins/cxx/coverage/CxxCoverageSensorTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import static org.mockito.Mockito.verify;
4040
import static org.mockito.Mockito.when;
4141
import static org.mockito.Mockito.mock;
42+
import org.sonar.plugins.cxx.utils.CxxUtils;
4243

4344
public class CxxCoverageSensorTest {
4445

@@ -133,9 +134,9 @@ public void shouldReportCoverageWhenVisualStudioCase() {
133134
Settings settings = new Settings();
134135
if (TestUtils.isWindows()) {
135136
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/cobertura/specific-cases/coverage-result-visual-studio-win.xml");
136-
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project1/source1.cpp");
137-
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project2/source1.cpp");
138-
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project2/source2.cpp");
137+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project1/source1.cpp"));
138+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project2/source1.cpp"));
139+
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project2/source2.cpp"));
139140
} else {
140141
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/cobertura/specific-cases/coverage-result-visual-studio-linux.xml");
141142
TestUtils.addInputFile(fs, perspectives, issuable, "/x/coveragetest/project1/source1.cpp");

sonar-cxx-plugin/src/test/resources/org/sonar/plugins/cxx/reports-project/coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-linux.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<BullseyeCoverage name="coverage.cov" dir="/e" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
2+
<BullseyeCoverage name="coverage.cov" dir="/c" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
33
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
44
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
55
<probe line="3" column="3" kind="function" event="full"/>

sonar-cxx-plugin/src/test/resources/org/sonar/plugins/cxx/reports-project/coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-win.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<BullseyeCoverage name="coverage.cov" dir="e:" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
2+
<BullseyeCoverage name="coverage.cov" dir="C:" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
33
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
44
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
55
<probe line="3" column="3" kind="function" event="full"/>

sonar-cxx-plugin/src/test/resources/org/sonar/plugins/cxx/reports-project/coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-linux.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<BullseyeCoverage name="coverage.cov" dir="/e/test/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
2+
<BullseyeCoverage name="coverage.cov" dir="/c/test/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
33
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
44
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
55
<probe line="3" column="3" kind="function" event="full"/>

sonar-cxx-plugin/src/test/resources/org/sonar/plugins/cxx/reports-project/coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-win.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<BullseyeCoverage name="coverage.cov" dir="e:/randomfoldernamethatihopeknowmachinehas/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
2+
<BullseyeCoverage name="coverage.cov" dir="C:/randomfoldernamethatihopeknowmachinehas/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
33
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
44
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
55
<probe line="3" column="3" kind="function" event="full"/>

sonar-cxx-plugin/src/test/resources/org/sonar/plugins/cxx/reports-project/coverage-reports/bullseye/coverage-result-bullseye-win.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- BullseyeCoverage 8.7.8 Linux x86 License 110389 -->
3-
<BullseyeCoverage name="coveragefile.cov" dir="d:/home/path/" buildId="d80ba2ba, 2012-08-02 12:15:13" version="4" xmlns="http://www.bullseye.com/covxml">
3+
<BullseyeCoverage name="coveragefile.cov" dir="C:/home/path/" buildId="d80ba2ba, 2012-08-02 12:15:13" version="4" xmlns="http://www.bullseye.com/covxml">
44
<folder name="TESTCOV" fn_cov="9" fn_total="15" cd_cov="34" cd_total="54" d_cov="18" d_total="30">
55
<src name="main.cpp" mtime="1343898900" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
66
<fn name="main(int,char**)" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">

0 commit comments

Comments
 (0)