Skip to content

Commit 4fe74c0

Browse files
author
Max Schaefer
authored
Merge pull request github#1960 from Semmle/rc/1.22
Merge rc/1.22 into master
2 parents d3f2d81 + d9df5af commit 4fe74c0

File tree

7 files changed

+97
-27
lines changed

7 files changed

+97
-27
lines changed

csharp/autobuilder/Semmle.Autobuild.Tests/BuildScripts.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,53 @@ public void TestWindowCSharpMsBuild()
745745
TestAutobuilderScript(autobuilder, 0, 6);
746746
}
747747

748+
[Fact]
749+
public void TestWindowCSharpMsBuildMultipleSolutions()
750+
{
751+
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\csharp\nuget\nuget.exe restore test1.csproj"] = 0;
752+
Actions.RunProcess["cmd.exe /C CALL ^\"C:\\Program Files ^(x86^)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall.bat^\" && C:\\odasa\\tools\\odasa index --auto msbuild test1.csproj /p:UseSharedCompilation=false /t:Windows /p:Platform=\"x86\" /p:Configuration=\"Debug\" /p:MvcBuildViews=true /P:Fu=Bar"] = 0;
753+
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\csharp\nuget\nuget.exe restore test2.csproj"] = 0;
754+
Actions.RunProcess["cmd.exe /C CALL ^\"C:\\Program Files ^(x86^)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall.bat^\" && C:\\odasa\\tools\\odasa index --auto msbuild test2.csproj /p:UseSharedCompilation=false /t:Windows /p:Platform=\"x86\" /p:Configuration=\"Debug\" /p:MvcBuildViews=true /P:Fu=Bar"] = 0;
755+
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\java\bin\java -jar C:\odasa\tools\extractor-asp.jar ."] = 0;
756+
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\odasa index --xml --extensions config csproj props xml"] = 0;
757+
Actions.FileExists["csharp.log"] = true;
758+
Actions.FileExists[@"test1.csproj"] = true;
759+
Actions.FileExists[@"test2.csproj"] = true;
760+
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = false;
761+
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"] = false;
762+
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"] = true;
763+
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"] = false;
764+
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"] = true;
765+
766+
Actions.GetEnvironmentVariable["TRAP_FOLDER"] = null;
767+
Actions.GetEnvironmentVariable["SOURCE_ARCHIVE"] = null;
768+
Actions.EnumerateFiles[@"C:\Project"] = "test1.csproj\ntest2.csproj\ntest1.cs\ntest2.cs";
769+
Actions.EnumerateDirectories[@"C:\Project"] = "";
770+
771+
var csproj1 = new XmlDocument();
772+
csproj1.LoadXml(@"<?xml version=""1.0"" encoding=""utf - 8""?>
773+
<Project ToolsVersion=""15.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
774+
<ItemGroup>
775+
<Compile Include=""test1.cs"" />
776+
</ItemGroup>
777+
</Project>");
778+
Actions.LoadXml["test1.csproj"] = csproj1;
779+
780+
var csproj2 = new XmlDocument();
781+
csproj2.LoadXml(@"<?xml version=""1.0"" encoding=""utf - 8""?>
782+
<Project ToolsVersion=""15.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
783+
<ItemGroup>
784+
<Compile Include=""test1.cs"" />
785+
</ItemGroup>
786+
</Project>");
787+
Actions.LoadXml["test2.csproj"] = csproj2;
788+
789+
var autobuilder = CreateAutoBuilder("csharp", true, msBuildArguments: "/P:Fu=Bar", msBuildTarget: "Windows", msBuildPlatform: "x86", msBuildConfiguration: "Debug",
790+
vsToolsVersion: "12");
791+
792+
TestAutobuilderScript(autobuilder, 0, 6);
793+
}
794+
748795
[Fact]
749796
public void TestWindowCSharpMsBuildFailed()
750797
{

csharp/autobuilder/Semmle.Autobuild/Autobuilder.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,9 @@ IEnumerable<IProjectOrSolution> FindFiles(string extension, Func<string, Project
156156
if (options.AllSolutions)
157157
return matchingFiles.Select(p => p.ProjectOrSolution);
158158

159-
var firstIsClosest = matchingFiles.Length > 1 && matchingFiles[0].DistanceFromRoot < matchingFiles[1].DistanceFromRoot;
160-
if (matchingFiles.Length == 1 || firstIsClosest)
161-
return matchingFiles.Select(p => p.ProjectOrSolution).Take(1);
162-
163-
var candidates = matchingFiles.
159+
return matchingFiles.
164160
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
165161
Select(f => f.ProjectOrSolution);
166-
Log(Severity.Info, $"Found multiple '{extension}' files, giving up: {string.Join(", ", candidates)}.");
167-
return new IProjectOrSolution[0];
168162
}
169163

170164
// First look for `.proj` files

docs/language/README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ Building and previewing the QL training presentations
8989
*****************************************************
9090

9191
To build the QL training presentations, you need to install a Sphinx extension
92-
called `hieroglyph <https://github.com/nyergler/hieroglyph>`__.
92+
called `hieroglyph <https://github.com/nyergler/hieroglyph>`__.
93+
You also need to install `graphviz <https://graphviz.gitlab.io/download/>`__, which
94+
is used to generate graphs on some slides.
9395

94-
After installing hieroglyph, you can build the QL training presentations by running
96+
After installing hieroglyph and graphviz, you can build the QL training presentations by running
9597
``sphinx-build``, specifying the ``slides`` builder. For example
9698

9799
.. code::

docs/language/learn-ql/ql-training.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Start learning how to use QL in variant analysis for a specific language by look
1919

2020
.. |arrow-r| unicode:: U+2192
2121

22-
When you have selected a presentation, use |arrow-r| and |arrow-l| to navigate between slides, press **p** to view the additional notes for a slide (where available), and press **f** to enter full-screen mode.
22+
.. |info| unicode:: U+24D8
23+
24+
When you have selected a presentation, use |arrow-r| and |arrow-l| to navigate between slides.
25+
Press **p** to view the additional notes on slides that have an information icon |info| in the top right corner, and press **f** to enter full-screen mode.
2326

2427
The presentations contain a number of QL query examples.
2528
We recommend that you download `QL for Eclipse <https://help.semmle.com/ql-for-eclipse/Content/WebHelp/home-page.html>`__ and import the example snapshot for each presentation so that you can find the bugs mentioned in the slides.

docs/language/ql-training/_static-training/slides-semmle-2/layout.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,18 @@
148148
</slides>
149149

150150

151+
<script type="text/javascript">
152+
153+
//insert info buttons on slides that have additional notes
154+
$(".admonition.note").before("<button id='extra-notes'>&#9432;</button>");
155+
$(".admonition-title").before("<button id='close-notes'>&times;</button>");
156+
$(document).ready(function() {
157+
$('button').click(function() {
158+
document.body.classList.toggle('with-notes');
159+
});
160+
});
161+
</script>
151162

152-
<!--[if IE]>
153-
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
154-
<script>CFInstall.check({mode: 'overlay'});</script>
155-
<![endif]-->
156163
<script type="text/javascript">
157164

158165
//assigns font-size when document is ready

docs/language/ql-training/_static-training/slides-semmle-2/static/theme/css/default.css

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -587,15 +587,6 @@ dt {
587587
/* line 386, ../scss/default.scss */
588588
button {
589589
display: inline-block;
590-
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSI0MCUiIHN0b3AtY29sb3I9IiNmOWY5ZjkiLz48c3RvcCBvZmZzZXQ9IjcwJSIgc3RvcC1jb2xvcj0iI2UzZTNlMyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
591-
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(40%, #f9f9f9), color-stop(70%, #e3e3e3));
592-
background: -moz-linear-gradient(#f9f9f9 40%, #e3e3e3 70%);
593-
background: -webkit-linear-gradient(#f9f9f9 40%, #e3e3e3 70%);
594-
background: linear-gradient(#f9f9f9 40%, #e3e3e3 70%);
595-
border: 1px solid #a9a9a9;
596-
-moz-border-radius: 3px;
597-
-webkit-border-radius: 3px;
598-
border-radius: 3px;
599590
padding: 5px 8px;
600591
outline: none;
601592
white-space: nowrap;
@@ -605,7 +596,6 @@ button {
605596
user-select: none;
606597
cursor: pointer;
607598
text-shadow: 1px 1px #fff;
608-
font-size: 10pt;
609599
}
610600

611601
/* line 400, ../scss/default.scss */
@@ -1599,10 +1589,38 @@ p.first.admonition-title {
15991589
font-size: 1em;
16001590
}
16011591

1602-
.admonition.note ul {
1592+
.admonition.note ul li {
16031593
width: inherit;
16041594
}
16051595

1596+
1597+
/* styles for information buttons on slides that have notes */
1598+
1599+
#extra-notes {
1600+
display: block;
1601+
position: fixed;
1602+
top: 0;
1603+
right: 1%;
1604+
font-size: 1em;
1605+
}
1606+
1607+
#close-notes {
1608+
display: block;
1609+
position: fixed;
1610+
top: 0;
1611+
right: -1%;
1612+
font-size: 1.2em;
1613+
}
1614+
1615+
button {
1616+
border: none;
1617+
background: none;
1618+
}
1619+
1620+
button:hover {
1621+
text-decoration: underline;
1622+
}
1623+
16061624
/********* images ************/
16071625
/* general styles to scale and centre images*/
16081626

@@ -1774,4 +1792,4 @@ li > ul > li {
17741792
width: 90%;
17751793
height: 100%;
17761794
}
1777-
}
1795+
}

docs/language/ql-training/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
'sphinx.ext.intersphinx',
3434
'sphinx.ext.mathjax',
3535
'hieroglyph',
36-
'sphinxcontrib.blockdiag',
3736
'sphinx.ext.graphviz',
3837
]
3938

0 commit comments

Comments
 (0)