Skip to content

Commit

Permalink
Fixes issue #11. Toolbox packaging does not put <toolboxdir>/util and…
Browse files Browse the repository at this point in the history
… <toolboxdir>/doc on the path.
  • Loading branch information
rpurser47 committed Jan 26, 2023
1 parent 0a4efc6 commit d404e11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ToolboxPackaging.prj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<param.summary>MATLAB(R) Tools to access the Climate Data Store (https://cds.climate.copernicus.eu/)</param.summary>
<param.description>MATLAB Tools to access the Climate Data Store (https://cds.climate.copernicus.eu/). It is a wealth of information about the Earth's past, present and future climate. There are hundreds of data sets associated with climate change. See the GettingStarted.mlx in the doc directory!</param.description>
<param.screenshot>${PROJECT_ROOT}\img\ToolboxPackaging.jpg</param.screenshot>
<param.version>2.2.1.42</param.version>
<param.version>2.2.2.45</param.version>
<param.output>${PROJECT_ROOT}\Climate Data Store Toolbox for MATLAB.mltbx</param.output>
<param.products.name />
<param.products.id />
Expand Down
15 changes: 12 additions & 3 deletions buildutil/packageToolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
% packageTookbox('specific',versionString) VERSIONSTRING is a string containing
% the specific 3 part semantic version (i.e. "2.3.4") to use.

% Copyright 2022 The MathWorks, Inc.
% Copyright 2023 The MathWorks, Inc.
arguments
releaseType {mustBeTextScalar,mustBeMember(releaseType,["build","major","minor","patch","specific"])} = "build"
versionString {mustBeTextScalar} = "";
Expand All @@ -25,16 +25,25 @@
if tbxPackagingProjectFile == ""
error("releaseToolbox:NoTbxPrjFound","No Toolbox Packaging Project found.")
end

% GitHub issue #11. Toolbox packaging from GitHub action does not put <toolboxdir>/util and <toolboxdir>/doc on the path.
previouspath = addpath(fullfile(pwd,"climatedatastoreToolbox","util"),...
fullfile(pwd,"climatedatastoreToolbox","doc"));

newVersion = updateMLTBXVersion(tbxPackagingProjectFile,releaseType, versionString);
matlab.addons.toolbox.packageToolbox(tbxPackagingProjectFile);

% Revert path changes
path(previouspath);

mltbxFile = findMLTBXFile(pwd);
% Replace spaces with underscores to be GitHub friendly and move to releases directory
[path,filename,ext] = fileparts(mltbxFile);
[filepath,filename,ext] = fileparts(mltbxFile);
newMltbxFilename = strrep(filename," ","_");
if isempty(dir(outputDirectory))
mkdir(outputDirectory)
end
movefile(mltbxFile,fullfile(path,outputDirectory,newMltbxFilename+ext));
movefile(mltbxFile,fullfile(filepath,outputDirectory,newMltbxFilename+ext));

function tbxPackagingProjectFilename = findTBXPackagingProjectFile(directoryToSearch)
% Unfortunately, Toolbox Packaging Projects and MATLAB projects both use the
Expand Down

0 comments on commit d404e11

Please sign in to comment.