Skip to content

Commit

Permalink
Implemented -no-mgr key:
Browse files Browse the repository at this point in the history
- Do not use manager for automatic restore the remote package.
  • Loading branch information
3F committed Jan 2, 2021
1 parent 3152550 commit ae127ca
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 161 deletions.
2 changes: 1 addition & 1 deletion Manager/batch/.compressor
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
var vdict = gencomb(cdict, 2, (int i) => { return char.IsLetter(cdict[i]) || cdict[i] == '_'; });
// to skip processing for:
var exvar = new[] { "__p_call", "__dxp_pv", "wMgrArgs", "wPkgVer", "wProxy", "wSlnDir", "wPkgPath", "wMetaLib", "wMetaCor", "wDxpTarget", "wAction", "wSlnFile", "wRootPath", "ngserver" };
var exvar = new[] { "__p_call", "__dxp_pv", "wMgrArgs", "wPkgVer", "wProxy", "wDxpOpt", "wSlnDir", "wPkgPath", "wMetaLib", "wMetaCor", "wDxpTarget", "wAction", "wSlnFile", "wRootPath", "ngserver" };
const string VNAME = "[a-z_][a-z_0-9]+";
const string VERS = "[Minified version]";
Expand Down
110 changes: 61 additions & 49 deletions Manager/batch/Manager.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off & echo Incomplete script. Compile it first via 'build.bat' - github.com/3F/DllExport 1>&2 & exit /B 1

:: Copyright (c) 2016-2020 Denis Kuzmin [ [email protected] ]
:: Copyright (c) 2016-2021 Denis Kuzmin [[email protected]] github/3F
:: https://github.com/3F/DllExport


Expand Down Expand Up @@ -83,6 +83,11 @@ set "buildInfoFile=build_info.txt"
set "fManager=!dpnx0!"
set "wRootPath=!cd!"

:: -
:: bitwise parameters

set /a wDxpOpt=0

:: -

set "dxpDebug="
Expand Down Expand Up @@ -121,7 +126,7 @@ goto commands
echo.
@echo .NET DllExport $-version-$
@echo Copyright (c) 2009-2015 Robert Giesecke
@echo Copyright (c) 2016-2020 Denis Kuzmin [ x-3F@outlook.com ] GitHub/3F
@echo Copyright (c) 2016-2021 Denis Kuzmin ^<x-3F@outlook.com^> github/3F
echo.
echo MIT License
@echo https://github.com/3F/DllExport
Expand All @@ -131,60 +136,61 @@ echo.
@echo Usage: DllExport [args to DllExport] [args to GetNuTool] [args to hMSBuild]
echo ------
echo.
echo Arguments:
echo ----------
echo -action {type} - Specified action for Wizard. Where {type}:
echo * Configure - To configure DllExport for specific projects.
echo * Update - To update pkg reference for already configured projects.
echo * Restore - To restore configured DllExport.
echo * Export - To export configured projects data.
echo * Recover - To re-configure projects via predefined/exported data.
echo * Unset - To unset all data from specified projects.
echo * Upgrade - Aggregates an Update action with additions for upgrading.
echo Arguments
echo ---------
echo -action {type} - Specified action for Wizard. Where {type}:
echo * Configure - To configure DllExport for specific projects.
echo * Update - To update pkg reference for already configured projects.
echo * Restore - To restore configured DllExport.
echo * Export - To export configured projects data.
echo * Recover - To re-configure projects via predefined/exported data.
echo * Unset - To unset all data from specified projects.
echo * Upgrade - Aggregates an Update action with additions for upgrading.
echo.
echo -sln-dir {path} - Path to directory with .sln files to be processed.
echo -sln-file {path} - Optional predefined .sln file to be processed.
echo -metalib {path} - Relative path to meta library.
echo -metacor {path} - Relative path to meta core library.
echo -dxp-target {path} - Relative path to entrypoint wrapper of the main core.
echo -dxp-version {num} - Specific version of DllExport. Where {num}:
echo * Versions: 1.6.6 ...
echo * Keywords:
echo `actual` - Unspecified local/latest remote version;
echo ( Only if you know what you are doing )
echo -sln-dir {path} - Path to directory with .sln files to be processed.
echo -sln-file {path} - Optional predefined .sln file to be processed.
echo -metalib {path} - Relative path to meta library.
echo -metacor {path} - Relative path to meta core library.
echo -dxp-target {path} - Relative path to entrypoint wrapper of the main core.
echo -dxp-version {num} - Specific version of DllExport. Where {num}:
echo * Versions: 1.7.3 ...
echo * Keywords:
echo `actual` - Unspecified local/latest remote version;
echo ( Only if you know what you are doing )
echo.
echo -msb {path} - Full path to specific msbuild.
echo -hMSBuild {args} - Access to hMSBuild tool (packed) https://github.com/3F/hMSBuild
echo -packages {path} - A common directory for packages.
echo -server {url} - Url for searching remote packages.
echo -proxy {cfg} - To use proxy. The format: [usr[:pwd]@]host[:port]
echo -pkg-link {uri} - Direct link to package from the source via specified URI.
echo -force - Aggressive behavior, e.g. like removing pkg when updating.
echo -mgr-up - Updates this manager to version from '-dxp-version'.
echo -wz-target {path} - Relative path to entrypoint wrapper of the main wizard.
echo -pe-exp-list {module} - To list all available exports from PE32/PE32+ module.
echo -eng - Try to use english language for all build messages.
echo -GetNuTool {args} - Access to GetNuTool (integrated) https://github.com/3F/GetNuTool
echo -debug - To show additional information.
echo -version - Displays version for which (together with) it was compiled.
echo -build-info - Displays actual build information from selected DllExport.
echo -help - Displays this help. Aliases: -help -h
echo -msb {path} - Full path to specific msbuild.
echo -hMSBuild {args} - Access to hMSBuild tool (packed) https://github.com/3F/hMSBuild
echo -packages {path} - A common directory for packages.
echo -server {url} - Url for searching remote packages.
echo -proxy {cfg} - To use proxy. The format: [usr[:pwd]@]host[:port]
echo -pkg-link {uri} - Direct link to package from the source via specified URI.
echo -force - Aggressive behavior, e.g. like removing pkg when updating.
echo -no-mgr - Do not use %~nx0 for automatic restore the remote package.
echo -mgr-up - Updates %~nx0 to version from '-dxp-version'.
echo -wz-target {path} - Relative path to entrypoint wrapper of the main wizard.
echo -pe-exp-list {module} - To list all available exports from PE32/PE32+ module.
echo -eng - Try to use english language for all build messages.
echo -GetNuTool {args} - Access to GetNuTool (integrated) https://github.com/3F/GetNuTool
echo -debug - To show additional information.
echo -version - Displays version for which (together with) it was compiled.
echo -build-info - Displays actual build information from selected DllExport.
echo -help - Displays this help. Aliases: -help -h
echo.
echo Flags:
echo ------
echo Flags
echo -----
echo __p_call - To use the call-type logic when invoking %~nx0
echo.
echo Samples:
echo --------
echo DllExport -action Configure -force -pkg-link http://host/v1.6.6.nupkg
echo DllExport -action Restore -sln-file "Conari.sln"
echo DllExport -proxy guest:[email protected]:7428 -action Configure
echo Samples
echo -------
echo DllExport -action Configure -force -pkg-link http://host/v1.7.3.nupkg
echo DllExport -action Restore -sln-file "Conari.sln"
echo DllExport -proxy guest:[email protected]:7428 -action Configure
echo.
echo DllExport -mgr-up -dxp-version 1.6.6
echo DllExport -action Upgrade -dxp-version 1.6.6
echo DllExport -mgr-up -dxp-version 1.7.3
echo DllExport -action Upgrade -dxp-version 1.7.3
echo.
echo DllExport -GetNuTool /p:ngpackages="Conari;regXwild"
echo DllExport -pe-exp-list bin\Debug\regXwild.dll
echo DllExport -GetNuTool /p:ngpackages="Conari;regXwild"
echo DllExport -pe-exp-list bin\Debug\regXwild.dll

goto endpoint

Expand Down Expand Up @@ -279,6 +285,11 @@ set key=!arg[%idx%]!

set kForce=1

goto continue
) else if [!key!]==[-no-mgr] (

set /a wDxpOpt^|=1

goto continue
) else if [!key!]==[-mgr-up] (

Expand Down Expand Up @@ -347,6 +358,7 @@ call :dbgprint "-metalib = " wMetaLib
call :dbgprint "-metacor = " wMetaCor
call :dbgprint "-dxp-target = " wDxpTarget
call :dbgprint "-wz-target = " tWizard
call :dbgprint "#opt " wDxpOpt

if defined dxpVersion (
if "!dxpVersion!"=="actual" (
Expand Down
11 changes: 9 additions & 2 deletions Manager/batch/tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,18 @@ set appl=%app% -pkg-link "..\..\DllExport.$version$.nupkg"
setlocal
echo Test case 16: checking for -dxp-version, -server, -proxy & set "%flagName%=16"

call %mgrFile% -action Default -dxp-version 1.6.5
call %app% -action Default -dxp-version 1.6.5 -server "https://127.0.0.1:8082/" -proxy "guest:[email protected]:7428"
call %mgrFile% -action Default -dxp-version 1.7.3
call %app% -action Default -dxp-version 1.7.3 -server "https://127.0.0.1:8082/" -proxy "guest:[email protected]:7428"
:: -pe-exp-list "bin\Debug\regXwild.dll"

endlocal

setlocal
echo Test case 17: checking for -no-mgr flag & set "%flagName%=17"

call %appl% -no-mgr

endlocal


endlocal
10 changes: 8 additions & 2 deletions Manager/batch/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<CallTarget Targets="testCase14" Condition="'$(testCase)' == '14'" />
<CallTarget Targets="testCase15" Condition="'$(testCase)' == '15'" />
<CallTarget Targets="testCase16" Condition="'$(testCase)' == '16'" />
<CallTarget Targets="testCase17" Condition="'$(testCase)' == '17'" />
</Target>
<Import Project="$(MSBuildThisFileDirectory)\$(tmapFile)" />

Expand Down Expand Up @@ -119,8 +120,8 @@
</Target>

<Target Name="testCase16">
<Error Text="dxpVersion: $(dxpVersion) == 1.6.5" Condition="'$(dxpVersion)' != '1.6.5'" />
<Message Text="dxpVersion: $(dxpVersion) == 1.6.5" Importance="High" />
<Error Text="dxpVersion: $(dxpVersion) == 1.7.3" Condition="'$(dxpVersion)' != '1.7.3'" />
<Message Text="dxpVersion: $(dxpVersion) == 1.7.3" Importance="High" />

<Error Text="pkgSrv: $(pkgSrv) == $(DataDefSrv)" Condition="'$(pkgSrv)' != '$(DataDefSrv)'" />
<Message Text="pkgSrv: $(pkgSrv) == $(DataDefSrv)" Importance="High" />
Expand All @@ -132,4 +133,9 @@
<Message Text="peExpList: $(peExpList) == bin\Debug\regXwild.dll" Importance="High" /> -->
</Target>

<Target Name="testCase17">
<Error Text="wDxpOpt: $(wDxpOpt) &amp; 1 == 1" Condition="$([MSBuild]::BitwiseAnd($(wDxpOpt), 1)) != '1'" />
<Message Text="wDxpOpt: $(wDxpOpt) &amp; 1 == 1" Importance="High" />
</Target>

</Project>
12 changes: 12 additions & 0 deletions Wizard/DllExportCfgTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public string Storage
}
}

/// <summary>
/// Updates type for <see cref="Options"/>.
/// </summary>
public long DxpOpt
{
set => Options = (DxpOptType)value;
}

#endregion

/// <inheritdoc cref="IWizardConfig.Distributable"/>
Expand All @@ -137,6 +145,9 @@ public string Storage
/// <inheritdoc cref="IWizardConfig.CfgStorage"/>
public CfgStorageType CfgStorage { get; set; } = CfgStorageType.Default;

/// <inheritdoc cref="IWizardConfig.Options"/>
public DxpOptType Options { get; protected set; }

/// <inheritdoc cref="IWizardConfig.Type"/>
public ActionType Type { get; protected set; }

Expand Down Expand Up @@ -253,6 +264,7 @@ private void PrintKeys(Message.Level level)
LSender.Send(this, $"Proxy: '{Proxy}'", level);
LSender.Send(this, $"DxpTarget: '{DxpTarget}'", level);
LSender.Send(this, $"RootPath: '{RootPath}'", level);
LSender.Send(this, $"Options: '{Options}'", level);
LSender.Send(this, $"Storage: '{CfgStorage}'", level);
LSender.Send(this, $"StoragePath: '{StoragePath}'", level);
LSender.Send(this, $"Action: '{Type}'", level);
Expand Down
39 changes: 39 additions & 0 deletions Wizard/DxpOptType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 Denis Kuzmin <[email protected]> github/3F
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using System;

namespace net.r_eg.DllExport.Wizard
{
[Flags]
public enum DxpOptType
{
None,

/// <summary>
/// Do not use manager for automatic restore the remote package.
/// </summary>
NoMgr = 0x01,
}
}
27 changes: 27 additions & 0 deletions Wizard/Extensions/XProjectExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,32 @@ internal static void RemovePropertyGroups(this IXProject xp, Func<ProjectPropert

internal static void RemoveEmptyPropertyGroups(this IXProject xp)
=> xp.RemovePropertyGroups(p => p.Properties.Count < 1);

internal static bool RemoveXmlTarget(this IXProject xp, string name)
{
if(string.IsNullOrWhiteSpace(name))
{
return false;
}

var target = xp?.Project.Xml.Targets?.FirstOrDefault(t => t.Name == name);
if(target != null)
{
xp.Project.Xml.RemoveChild(target);
return true;
}
return false;
}

internal static void RemoveProperties(this IXProject xp, params string[] names)
{
if(xp == null) return;

foreach(string name in names)
{
if(!string.IsNullOrWhiteSpace(name)) while(xp.RemoveProperty(name, true)) { }
}
xp.RemoveEmptyPropertyGroups();
}
}
}
5 changes: 5 additions & 0 deletions Wizard/IWizardConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public interface IWizardConfig
/// </summary>
string Proxy { get; }

/// <summary>
/// Options through <see cref="DxpOptType"/>.
/// </summary>
DxpOptType Options { get; }

/// <summary>
/// Path to external storage if used.
/// </summary>
Expand Down
Loading

0 comments on commit ae127ca

Please sign in to comment.