8000 Merge pull request #3 from DNNCommunity/package-module · DNNCommunity/Dnn.ModuleCreator@63725d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 63725d3

Browse files
authored
Merge pull request #3 from DNNCommunity/package-module
Implemented packaging build scripts
2 parents 9eba784 + bcb4836 commit 63725d3

10 files changed

+265
-157
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
/bin
77
/obj
88
/packages
9-
/**/*csproj.user
9+
/**/*csproj.user
10+
/.tmp
11+
/Artifacts
12+
/build

.nuke

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dnn.Modules.ModuleCreator.sln

App.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration />

Dnn.Modules.ModuleCreator.csproj

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -8,73 +8,41 @@
88
</ProductVersion>
99
<SchemaVersion>2.0</SchemaVersion>
1010
<ProjectGuid>{BD519B8A-169C-4328-BF67-62CD278435BC}</ProjectGuid>
11-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1211
<OutputType>Library</OutputType>
12+
<RuntimeIdentifier>win</RuntimeIdentifier>
1313
<AppDesignerFolder>Properties</AppDesignerFolder>
1414
<RootNamespace>Dnn.Modules.ModuleCreator</RootNamespace>
1515
<AssemblyName>Dnn.Modules.ModuleCreator</AssemblyName>
1616
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1717
<UseIISExpress>true</UseIISExpress>
18+
<Use64BitIISExpress />
1819
<IISExpressSSLPort />
1920
<IISExpressAnonymousAuthentication />
2021
<IISExpressWindowsAuthentication />
2122
<IISExpressUseClassicPipelineMode />
22-
<Use64BitIISExpress />
2323
<UseGlobalApplicationHostFile />
2424
</PropertyGroup>
2525
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2626
<DebugSymbols>true</DebugSymbols>
2727
<DebugType>full</DebugType>
2828
<Optimize>false</Optimize>
29-
<OutputPath>bin\</OutputPath>
29+
<OutputPath>bin\Debug\</OutputPath>
3030
<DefineConstants>DEBUG;TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>
3333
<DocumentationFile>bin\Dnn.Modules.ModuleCreator.XML</DocumentationFile>
34-
<LangVersion>7</LangVersion>
3534
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3635
</PropertyGroup>
3736
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3837
<DebugType>pdbonly</DebugType>
3938
<Optimize>true</Optimize>
40-
<OutputPath>bin\</OutputPath>
39+
<OutputPath>bin\Release\</OutputPath>
4140
<DefineConstants>TRACE</DefineConstants>
4241
<ErrorReport>prompt</ErrorReport>
4342
<WarningLevel>4</WarningLevel>
4443
<DocumentationFile>bin\Dnn.Modules.ModuleCreator.XML</DocumentationFile>
45-
<LangVersion>7</LangVersion>
4644
</PropertyGroup>
4745
<ItemGroup>
48-
<Reference Include="DotNetNuke, Version=9.7.1.0, Culture=neutral, processorArchitecture=MSIL">
49-
<HintPath>packages\DotNetNuke.Core.9.7.1\lib\net45\DotNetNuke.dll</HintPath>
50-
</Reference>
51-
<Reference Include="DotNetNuke.Abstractions, Version=9.7.1.0, Culture=neutral, processorArchitecture=MSIL">
52-
<HintPath>packages\DotNetNuke.Abstractions.9.7.1\lib\netstandard2.0\DotNetNuke.Abstractions.dll</HintPath>
53-
</Reference>
54-
<Reference Include="DotNetNuke.DependencyInjection, Version=9.7.1.0, Culture=neutral, processorArchitecture=MSIL">
55-
<HintPath>packages\DotNetNuke.DependencyInjection.9.7.1\lib\netstandard2.0\DotNetNuke.DependencyInjection.dll</HintPath>
56-
</Reference>
57-
<Reference Include="DotNetNuke.Instrumentation, Version=9.7.1.0, Culture=neutral, processorArchitecture=MSIL">
58-
<HintPath>packages\DotNetNuke.Instrumentation.9.7.1\lib\net45\DotNetNuke.Instrumentation.dll</HintPath>
59-
</Reference>
60-
<Reference Include="DotNetNuke.log4net, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
61-
<HintPath>packages\DotNetNuke.Instrumentation.9.7.1\lib\net45\DotNetNuke.log4net.dll</HintPath>
62-
</Reference>
63-
<Reference Include="DotNetNuke.Web, Version=9.7.1.0, Culture=neutral, processorArchitecture=MSIL">
64-
<HintPath>packages\DotNetNuke.Web.9.7.1\lib\net45\DotNetNuke.Web.dll</HintPath>
65-
</Reference>
66-
<Reference Include="DotNetNuke.WebUtility, Version=4.2.1.783, Culture=neutral, processorArchitecture=MSIL">
67-
<HintPath>packages\DotNetNuke.Web.9.7.1\lib\net45\DotNetNuke.WebUtility.dll</HintPath>
68-
</Reference>
69-
<Reference Include="Microsoft.ApplicationBlocks.Data, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
70-
<HintPath>packages\DotNetNuke.Core.9.7.1\lib\net45\Microsoft.ApplicationBlocks.Data.dll</HintPath>
71-
</Reference>
72-
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
73-
<HintPath>packages\Microsoft.Extensions.DependencyInjection.2.1.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
74-
</Reference>
75-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
76-
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
77-
</Reference>
7846
<Reference Include="System.Web.DynamicData" />
7947
<Reference Include="System.Web.Entity" />
8048
<Reference Include="System.Web.ApplicationServices" />
@@ -102,6 +70,7 @@
10270
<Compile Include="CreateModule.ascx.designer.cs">
10371
<DependentUpon>CreateModule.ascx</DependentUpon>
10472
</Compile>
73+
<Content Include=".gitignore" />
10574
<Content Include="Templates\C#\Class File\template.cs" />
10675
<Content Include="Templates\C#\DAL2\templateController.cs" />
10776
<Content Include="Templates\C#\DAL2\templateInfo.cs" />
@@ -213,36 +182,28 @@
213182
<Content Include="web.config" />
214183
</ItemGroup>
215184
<ItemGroup>
216-
<None Include="packages.config" />
217185
<AdditionalFiles Include="stylecop.json" />
218186
</ItemGroup>
219187
<ItemGroup>
220-
<Analyzer Include="packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
221-
<Analyzer Include="packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
188+
<PackageReference Include="DotNetNuke.Abstractions">
189+
<Version>9.7.1</Version>
190+
</PackageReference>
191+
<PackageReference Include="DotNetNuke.Instrumentation">
192+
<Version>9.7.1</Version>
193+
</PackageReference>
194+
<PackageReference Include="DotNetNuke.Web">
195+
<Version>9.7.1</Version>
196+
</PackageReference>
197+
<PackageReference Include="StyleCop.Analyzers">
198+
<Version>1.1.118</Version>
199+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
200+
<PrivateAssets>all</PrivateAssets>
201+
</PackageReference>
222202
</ItemGroup>
223203
<PropertyGroup>
224204
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
225205
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
226206
</PropertyGroup>
227207
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
228-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
229-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
230-
<ProjectExtensions>
231-
<VisualStudio>
232-
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
233-
<WebProjectProperties>
234-
<UseIIS>True</UseIIS>
235-
<AutoAssignPort>True</AutoAssignPort>
236-
<DevelopmentServerPort>56695</DevelopmentServerPort>
237-
<DevelopmentServerVPath>/</DevelopmentServerVPath>
238-
<IISUrl>http://localhost:56695/</IISUrl>
239-
<NTLMAuthentication>False</NTLMAuthentication>
240-
<UseCustomServer>False</UseCustomServer>
241-
<CustomServerUrl>
242-
</CustomServerUrl>
243-
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
244-
</WebProjectProperties>
245-
</FlavorProperties>
246-
</VisualStudio>
247-
</ProjectExtensions>
208+
<ProjectExtensions />
248209
</Project>

Dnn.Modules.ModuleCreator.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ VisualStudioVersion = 16.0.30503.244
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dnn.Modules.ModuleCreator", "Dnn.Modules.ModuleCreator.csproj", "{BD519B8A-169C-4328-BF67-62CD278435BC}"
77
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{A8DFAD83-8270-4E86-AB1D-3FEA67D5862B}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
1113
Release|Any CPU = Release|Any CPU
1214
EndGlobalSection
1315
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{A8DFAD83-8270-4E86-AB1D-3FEA67D5862B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{A8DFAD83-8270-4E86-AB1D-3FEA67D5862B}.Release|Any CPU.ActiveCfg = Release|Any CPU
1418
{BD519B8A-169C-4328-BF67-62CD278435BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1519
{BD519B8A-169C-4328-BF67-62CD278435BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
1620
{BD519B8A-169C-4328-BF67-62CD278435BC}.Release|Any CPU.ActiveCfg = Release|Any CPU

build.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:; set -eo pipefail
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
4+
:; exit $?
5+
6+
@ECHO OFF
7+
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*

build.ps1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
4+
[string[]]$BuildArguments
5+
)
6+
7+
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
8+
9+
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
10+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
11+
12+
###########################################################################
13+
# CONFIGURATION
14+
###########################################################################
15+
16+
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
17+
$TempDirectory = "$PSScriptRoot\\.tmp"
18+
19+
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
20+
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
21+
$DotNetChannel = "Current"
22+
23+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
24+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25+
$env:DOTNET_MULTILEVEL_LOOKUP = 0
26+
27+
###########################################################################
28+
# EXECUTION
29+
###########################################################################
30+
31+
function ExecSafe([scriptblock] $cmd) {
32+
& $cmd
33+
if ($LASTEXITCODE) { exit $LASTEXITCODE }
34+
}
35+
36+
# If dotnet CLI is installed globally and it matches requested version, use for execution
37+
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
38+
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
39+
$env:DOTNET_EXE = (Get-Command "dotnet").Path
40+
}
41+
else {
42+
# Download install script
43+
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
44+
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
45+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
46+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
47+
48+
# If global.json exists, load expected version
49+
if (Test-Path $DotNetGlobalFile) {
50+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
51+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
52+
$DotNetVersion = $DotNetGlobal.sdk.version
53+
}
54+
}
55+
56+
# Install by channel or version
57+
$DotNetDirectory = "$TempDirectory\dotnet-win"
58+
if (!(Test-Path variable:DotNetVersion)) {
59+
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
60+
} else {
61+
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
62+
}
63+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
64+
}
65+
66+
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
67+
68+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
69+
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
bash --version 2>&1 | head -n 1
4+
5+
set -eo pipefail
6+
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
7+
8+
###########################################################################
9+
# CONFIGURATION
10+
###########################################################################
11+
12+
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
13+
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
14+
15+
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
16+
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
17+
DOTNET_CHANNEL="Current"
18+
19+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
20+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
21+
export DOTNET_MULTILEVEL_LOOKUP=0
22+
23+
###########################################################################
24+
# EXECUTION
25+
###########################################################################
26+
27+
function FirstJsonValue {
28+
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
29+
}
30+
31+
# If dotnet CLI is installed globally and it matches requested version, use for execution
32+
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
33+
export DOTNET_EXE="$(command -v dotnet)"
34+
else
35+
# Download install script
36+
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
37+
mkdir -p "$TEMP_DIRECTORY"
38+
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
39+
chmod +x "$DOTNET_INSTALL_FILE"
40+
41+
# If global.json exists, load expected version
42+
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
43+
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
44+
if [[ "$DOTNET_VERSION" == "" ]]; then
45+
unset DOTNET_VERSION
46+
fi
47+
fi
48+
49+
# Install by channel or version
50+
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
51+
if [[ -z ${DOTNET_VERSION+x} ]]; then
52+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
53+
else
54+
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
55+
fi
56+
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
57+
fi
58+
59+
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
60+
61+
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
62+
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

0 commit comments

Comments
 (0)
0