Test x reinserire task "prettyBIN"

This commit is contained in:
Samuele E. Locatelli
2018-08-29 12:04:14 +02:00
parent 6f1eaffda8
commit 90a46df214
13 changed files with 312 additions and 12 deletions
Vendored
+2 -6
View File
@@ -15,7 +15,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=293']) {
withEnv(['NEXT_BUILD_NUMBER=294']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'SCMA'
@@ -105,12 +105,8 @@ pipeline {
else {
env.currConfig='Release'
}
// Build adapters MTC7OPC-UA-RED
bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=${env.currConfig} /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /m"
// // Build adapters VERI
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/${env.versionNumber} /m"
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/${env.versionNumber} /m"
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=${env.BRANCH_NAME} /p:VisualStudioVersion=15.0 /p:RunCodeAnalysis=false /p:Platform=\"Any CPU\" /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /m"
}
}
}
+10 -5
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
@@ -53,7 +53,7 @@
<!--<add key ="ipPLC" value="192.168.214.1" />-->
<!--CMS PROD-->
<!--<add key ="ipPLC" value="192.168.139.1" />-->
<add key ="ipPLC" value="192.168.157.2" />
<add key="ipPLC" value="192.168.157.2"/>
<add key="recTime" value="true"/>
<add key="verbose" value="true"/>
@@ -117,12 +117,16 @@
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
<add name="ClientAuthenticationMembershipProvider"
type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
<add name="ClientRoleProvider"
type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
@@ -133,7 +137,8 @@
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol"/>
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType"
name="OPENcontrol"/>
</client>
</system.serviceModel>
<runtime>
+4
View File
@@ -158,6 +158,7 @@
<DependentUpon>SetupAdapter.cs</DependentUpon>
</Compile>
<Compile Include="utils.cs" />
<Content Include="Resources\SteamWare.ico" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@@ -196,6 +197,9 @@
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.dll" />
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.Wrapper.dll" />
<Content Include="Readme\ToDos_Siemens.txt" />
<Content Include="Resources\ChangeLog.html" />
<Content Include="Resources\logoSteamware.png" />
<Content Include="Resources\manifest.xml" />
<Content Include="Resources\SCM\SCM_ESA.xml" />
<Content Include="Readme\Analisi tempi.txt" />
<None Include="App.CMS-OSAI.config">
+1 -1
View File
@@ -3,7 +3,7 @@
<package id="NLog" version="4.5.8" targetFramework="net452" />
<package id="NLog.Config" version="4.5.8" targetFramework="net452" />
<package id="NLog.Schema" version="4.5.8" targetFramework="net452" />
<package id="PrettyBin" version="1.1.0" targetFramework="net452" />
<package id="PrettyBin" version="1.0.4" targetFramework="net452" />
<package id="SlowCheetah" version="2.5.48" targetFramework="net452" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net452" />
</packages>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<config>
<add key="repositoryPath" value="..\..\..\commonNugetPackages" />
</config>
</configuration>
+139
View File
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="http://nuget.loc/api/v2/" />
</ItemGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>
<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>
<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
PrettyBin
=========
Nuget package for C#, that moves dll,pdb and xml in bin/lib subfolder and ensures, that everything works.
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime xdt:Transform="InsertIfMissing">
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
xdt:Transform="InsertIfMissing">
<probing xdt:Transform="InsertIfMissing"
privatePath="lib;libs" />
</assemblyBinding>
</runtime>
</configuration>
+2
View File
@@ -0,0 +1,2 @@
del PrettyBin.*.*.*.nupkg
nuget.exe pack PrettyBin.nuspec
+3
View File
@@ -0,0 +1,3 @@
param($installPath, $toolsPath, $package, $project)
Write-Host 'Init BinPrettify'
+78
View File
@@ -0,0 +1,78 @@
param($installPath, $toolsPath, $package, $project)
Try
{
$path = $project.FullName
Write-Host 'Install PrettifyBin; '
[xml]$doc = [xml](Get-Content $path)
# If a Namespace URI was not given, use the Xml document's default namespace.
$NamespaceURI = $doc.DocumentElement.NamespaceURI
Write-Host $NamespaceURI
# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up.
$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable)
$xmlNsManager.AddNamespace("ns", $NamespaceURI)
# ============ This script attemps to Create this tags in csproj: ========
#
# <Target Name="AfterBuild">
# <ItemGroup>
# <MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" />
# </ItemGroup>
# <Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
# </Target>
$targetNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']", $xmlNsManager)
if ($targetNode -eq $null)
{
Write-Host 'No Target AfterBuild Node. Creating'
$targetNode = $doc.CreateElement('Target', $NamespaceURI )
$targetNode.SetAttribute("Name" ,"AfterBuild")
$doc.Project.AppendChild($targetNode)
}
$filesToMoveNode = $targetNode.SelectSingleNode("//ns:ItemGroup/ns:MoveToLibFolder", $xmlNsManager)
if ($filesToMoveNode -eq $null)
{
Write-Host 'No ItemGroup whith MoveToLibFolder tag. Creating'
$itemGroup = $doc.CreateElement('ItemGroup', $NamespaceURI)
$filesToMoveNode = $doc.CreateElement('MoveToLibFolder', $NamespaceURI)
$itemGroup.AppendChild($filesToMoveNode)
$targetNode.AppendChild($itemGroup)
}
$filesToMoveNode.SetAttribute("Include" ,'$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml')
$MoveNode = $targetNode.SelectSingleNode('//ns:Move[contains(@SourceFiles,"@(MoveToLibFolder)")]', $xmlNsManager)
if ($MoveNode -eq $null)
{
Write-Host 'No Move tag in AfterBuild Target. Creating'
$MoveNode = $doc.CreateElement('Move', $NamespaceURI)
$MoveNode.SetAttribute("SourceFiles" ,'@(MoveToLibFolder)')
$targetNode.AppendChild($MoveNode)
}
$MoveNode.SetAttribute("DestinationFolder",'$(OutputPath)lib')
$MoveNode.SetAttribute("OverwriteReadOnlyFiles","true")
$doc.Save($path)
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Host $ErrorMessage
Write-Host $FailedItem
Break
}
@@ -0,0 +1,45 @@
param($installPath, $toolsPath, $package, $project)
Try
{
$path = $project.FullName
Write-Host 'Uninstall PrettifyBin; '
[ xml ]$doc = [ xml ](Get-Content $path)
# If a Namespace URI was not given, use the Xml document's default namespace.
$NamespaceURI = $doc.DocumentElement.NamespaceURI
Write-Host $NamespaceURI
# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up.
$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable)
$xmlNsManager.AddNamespace("ns", $NamespaceURI)
# ============ This script attemps to remove this tags in csproj: ========
#
# <Target Name="AfterBuild">
# <Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
# </Target>
$moveNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']/ns:Move[contains(@SourceFiles,'@(MoveToLibFolder)')]", $xmlNsManager)
if ($moveNode -ne $null)
{
Write-Host 'We will delete move node'
$moveNode.ParentNode.RemoveChild($moveNode)
}
$doc.Save($path)
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Host $ErrorMessage
Write-Host $FailedItem
Break
}