-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Release Action
committed
May 17, 2021
1 parent
e5baffe
commit c56073b
Showing
76 changed files
with
2,569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2020, The MathWorks, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. In all cases, the software is, and all modifications and derivatives of the | ||
software shall be, licensed to you solely for use in conjunction with | ||
MathWorks products and service offerings. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
@echo off | ||
rem Executes a specified MATLAB command in batch mode. With MATLAB R2018b+, | ||
rem running this script is equivalent to executing "matlab -batch command" from | ||
rem the system prompt. | ||
rem | ||
rem Copyright 2020 The MathWorks, Inc. | ||
|
||
setlocal enableextensions enabledelayedexpansion | ||
|
||
set command=%~1 | ||
if "%command%" == "" ( | ||
call :usage | ||
exit /b 1 | ||
) | ||
|
||
for %%a in (matlab.exe) do set matlab_path=%%~$PATH:a | ||
|
||
if "%matlab_path%" == "" ( | ||
echo 'matlab.exe' command not found. Please make sure MATLAB_ROOT\bin is on | ||
echo the system path, where MATLAB_ROOT is the full path to your MATLAB | ||
echo installation directory. | ||
exit /b 1 | ||
) | ||
|
||
for %%a in ("%matlab_path%\..\..") do set matlab_root=%%~fa | ||
|
||
rem try to discover the MATLAB version | ||
if exist "%matlab_root%\VersionInfo.xml" ( | ||
rem get version tag contents | ||
for /f %%a in ('findstr "<version>.*</version>" "%matlab_root%\VersionInfo.xml"') do ( | ||
set ver_line=%%a | ||
set ver_line=!ver_line:*^<version^>=! | ||
for /f "tokens=1 delims=<" %%b in ("!ver_line!") do set matlab_ver=%%b | ||
) | ||
) else if exist "%matlab_root%\toolbox\matlab\general\Contents.m" ( | ||
rem get version printed after "MATLAB Version" | ||
for /f "delims=" %%a in ('findstr /r /c:"MATLAB Version .*" "%matlab_root%\toolbox\matlab\general\Contents.m"') do ( | ||
set ver_line=%%a | ||
set ver_line=!ver_line:*MATLAB Version =! | ||
for /f "tokens=1" %%b in ("!ver_line!") do set matlab_ver=%%b | ||
) | ||
) | ||
|
||
rem if version not discovered, assume worst-case version of 0 | ||
if not defined matlab_ver set matlab_ver=0 | ||
|
||
rem use -r to launch MATLAB versions below R2018b (i.e. 9.5), otherwise use -batch | ||
call :ver_less_than %matlab_ver% 9.5 | ||
if %errorlevel% == 0 ( | ||
rem define start-up options | ||
set opts=-nosplash -nodesktop -wait -log | ||
call :ver_less_than %matlab_ver% 8.5 | ||
if not !errorlevel! == 0 set opts=!opts! -noDisplayDesktop | ||
|
||
rem escape single quotes in command | ||
set exp=!command:'=''! | ||
|
||
matlab.exe !opts! -r "try,eval('!exp!'),catch e,disp(getReport(e,'extended')),exit(1),end,exit" > NUL | ||
) else ( | ||
matlab.exe -batch "%command%" | ||
) | ||
exit /b %errorlevel% | ||
|
||
:usage | ||
echo Usage: run_matlab_command.sh command | ||
echo. | ||
echo command - MATLAB script, statement, or function to execute. | ||
echo. | ||
goto :eof | ||
|
||
:ver_less_than | ||
setlocal | ||
call :ver_str %~1 v1 | ||
call :ver_str %~2 v2 | ||
if "%v1%" lss "%v2%" ( exit /b 0 ) else ( exit /b 1 ) | ||
|
||
:ver_str | ||
setlocal | ||
set ver=%~1 | ||
for /f "tokens=1-4 delims=." %%a in ("%ver%") do ( | ||
set major=%%a | ||
set minor=000%%b | ||
set minor=!minor:~-3! | ||
set patch=000%%c | ||
set patch=!patch:~-3! | ||
set build=000000000%%d | ||
set build=!build:~-9! | ||
) | ||
( endlocal & rem return values | ||
set %~2=%major%%minor%%patch%%build% | ||
) | ||
goto :eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/sh | ||
# Executes a specified MATLAB command in batch mode. With MATLAB R2018b+, | ||
# running this script is equivalent to executing "matlab -batch command" from | ||
# the system prompt. | ||
# | ||
# Copyright 2020 The MathWorks, Inc. | ||
|
||
usage() { | ||
echo '' | ||
echo ' Usage: run_matlab_command.sh command' | ||
echo '' | ||
echo ' command - MATLAB script, statement, or function to execute.' | ||
echo '' | ||
} | ||
|
||
ver_less_than() { | ||
[ "$(ver_str "$1")" -lt "$(ver_str "$2")" ] | ||
} | ||
|
||
ver_str() { | ||
echo "$@" | awk -F. '{ printf("%d%03d%03d%09d\n", $1,$2,$3,$4); }'; | ||
} | ||
|
||
command=$1 | ||
if [ -z "$command" ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
if ! matlab_path="$(command -v matlab)" || [ -z "$matlab_path" ]; then | ||
echo "'matlab'"' command not found. Please make sure MATLAB_ROOT/bin is on' | ||
echo 'the system path, where MATLAB_ROOT is the full path to your MATLAB' | ||
echo 'installation directory.' | ||
exit 1 | ||
fi | ||
|
||
# resolve symlink to target | ||
while [ -h "$matlab_path" ]; do | ||
dir=$(dirname -- "$matlab_path") | ||
target=$(readlink "$matlab_path") | ||
matlab_path=$(cd "$dir" && cd "$(dirname -- "$target")" && pwd)/$(basename -- "$target") | ||
done | ||
|
||
matlab_root=$(dirname -- "$(dirname -- "$matlab_path")") | ||
|
||
# try to discover the MATLAB version | ||
if [ -f "$matlab_root"/VersionInfo.xml ]; then | ||
# get version tag contents | ||
matlab_ver=$(sed -n 's:.*<version>\(.*\)</version>.*:\1:p' < "$matlab_root"/VersionInfo.xml) | ||
elif [ -f "$matlab_root"/toolbox/matlab/general/Contents.m ]; then | ||
# get version printed after "MATLAB Version" | ||
matlab_ver=$(grep -o 'MATLAB Version .*' < "$matlab_root"/toolbox/matlab/general/Contents.m | awk -v N=3 '{print $N}') | ||
fi | ||
|
||
# if version not discovered, assume worst-case version of 0 | ||
matlab_ver=${matlab_ver:-0} | ||
|
||
# use -r to launch MATLAB versions below R2018b (i.e. 9.5), otherwise use -batch | ||
if ver_less_than "$matlab_ver" '9.5'; then | ||
# define start-up options | ||
opts='-nosplash -nodesktop' | ||
if ! ver_less_than "$matlab_ver" '8.6'; then | ||
opts="$opts -noAppIcon" | ||
fi | ||
|
||
# escape single quotes in command | ||
exp=$(echo "$command" | sed "s/'/''/g") | ||
|
||
matlab "$opts" -r "try,eval('$exp'),catch e,disp(getReport(e,'extended')),exit(1),end,exit" | ||
else | ||
matlab -batch "$command" | ||
fi |
Large diffs are not rendered by default.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
dist/scriptgen/+scriptgen/+expressions/+test/CreateCoberturaCodePluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
classdef CreateCoberturaCodePluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''coverage.xml''' | ||
Source = {'pwd'} | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
|
||
function set.Source(obj, value) | ||
scriptgen.internal.validateTextArray(value); | ||
obj.Source = value; | ||
end | ||
end | ||
end | ||
|
15 changes: 15 additions & 0 deletions
15
dist/scriptgen/+scriptgen/+expressions/+test/CreateCoberturaModelPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreateCoberturaModelPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''coverage.xml''' | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
end | ||
end | ||
|
20 changes: 20 additions & 0 deletions
20
dist/scriptgen/+scriptgen/+expressions/+test/CreateHTMLCodePluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
classdef CreateHTMLCodePluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FolderPath = '''html''' | ||
Source = {'pwd'} | ||
end | ||
|
||
methods | ||
function set.FolderPath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FolderPath = value; | ||
end | ||
|
||
function set.Source(obj, value) | ||
scriptgen.internal.validateTextArray(value); | ||
obj.Source = value; | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
dist/scriptgen/+scriptgen/+expressions/+test/CreateHasBaseFolderSelectorExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
classdef CreateHasBaseFolderSelectorExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
BaseFolder = {'pwd'} | ||
end | ||
|
||
methods | ||
function set.BaseFolder(obj, value) | ||
scriptgen.internal.validateTextArray(value); | ||
obj.BaseFolder = value; | ||
end | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
dist/scriptgen/+scriptgen/+expressions/+test/CreateHasTagSelectorExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreateHasTagSelectorExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
Tag = '''tag''' | ||
end | ||
|
||
methods | ||
function set.Tag(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.Tag = value; | ||
end | ||
end | ||
end | ||
|
15 changes: 15 additions & 0 deletions
15
dist/scriptgen/+scriptgen/+expressions/+test/CreateJUnitPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreateJUnitPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''results.xml''' | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
end | ||
end | ||
|
15 changes: 15 additions & 0 deletions
15
dist/scriptgen/+scriptgen/+expressions/+test/CreatePDFPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreatePDFPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''report.pdf''' | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
end | ||
end | ||
|
4 changes: 4 additions & 0 deletions
4
dist/scriptgen/+scriptgen/+expressions/+test/CreateSimulinkTestPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
classdef CreateSimulinkTestPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
end | ||
|
15 changes: 15 additions & 0 deletions
15
...criptgen/+scriptgen/+expressions/+test/CreateSimulinkTestResultsPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreateSimulinkTestResultsPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''results.mldatx''' | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
end | ||
end | ||
|
15 changes: 15 additions & 0 deletions
15
dist/scriptgen/+scriptgen/+expressions/+test/CreateTAPPluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
classdef CreateTAPPluginExpressionBuilder < scriptgen.CodeBuilder | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties | ||
FilePath = '''results.tap''' | ||
end | ||
|
||
methods | ||
function set.FilePath(obj, value) | ||
scriptgen.internal.validateTextScalar(value); | ||
obj.FilePath = value; | ||
end | ||
end | ||
end | ||
|
24 changes: 24 additions & 0 deletions
24
...tgen/+scriptgen/+internal/+expressions/+test/CreateCoberturaCodePluginExpressionBuilder.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
classdef CreateCoberturaCodePluginExpressionBuilder < scriptgen.expressions.test.CreateCoberturaCodePluginExpressionBuilder ... | ||
& scriptgen.internal.mixin.VersionDependent | ||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
properties (Constant, Access = protected) | ||
MinSupportedVersion = scriptgen.internal.Version.forRelease('R2017b') | ||
end | ||
|
||
methods | ||
function expression = build(obj) | ||
import scriptgen.Expression; | ||
|
||
imports = { ... | ||
'matlab.unittest.plugins.codecoverage.CoberturaFormat', ... | ||
'matlab.unittest.plugins.CodeCoveragePlugin'}; | ||
|
||
source = strjoin(obj.Source, ', '); | ||
text = sprintf('CodeCoveragePlugin.forFolder({%s}, ''IncludingSubfolders'', true, ''Producing'', CoberturaFormat(%s))', source, obj.FilePath); | ||
|
||
expression = Expression(text, imports); | ||
end | ||
end | ||
end | ||
|
Oops, something went wrong.