-
-
Notifications
You must be signed in to change notification settings - Fork 532
/
Copy pathBlazorise.props
163 lines (141 loc) · 6.04 KB
/
Blazorise.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Version>1.7.4</Version>
<PackageVersion>1.7.4</PackageVersion>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageIcon>Blazorise.png</PackageIcon>
<PackageProjectUrl>https://blazorise.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/Megabit/Blazorise</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>Blazorise is a component library built on top of Blazor and CSS frameworks like Bootstrap, Bulma and Material.</Description>
<Authors>Megabit</Authors>
<Company>Megabit</Company>
<Copyright>Copyright 2018-2025 Megabit</Copyright>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<LangVersion>11.0</LangVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<!-- Don't remove this. It is needed for the WASM workloads to publish demo projects. -->
<ItemGroup>
<Content Remove="compilerconfig.json" />
<None Include="compilerconfig.json" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);NET6_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<DefineConstants>$(DefineConstants);NET7_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<DefineConstants>$(DefineConstants);NET8_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<DefineConstants>$(DefineConstants);NET9_0</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.*" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components" Version="7.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.*" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.*" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.*" />
</ItemGroup>
<UsingTask
TaskName="ReplaceVersionInJsFiles"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<SourceFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<Version ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Log.LogMessage(MessageImportance.High, $"------ Custom Build Step : ReplaceVersionInJsFiles : [{SourceFiles.Count()}] files ------");
var matchExpression = @"\?v=([\d.]*-?\w+-?\d*)";
var expectedVersion = string.Empty;;
try {
string[] versionGroups = Version.Split('.');
if (versionGroups.Length < 4)
{
expectedVersion = string.Empty;
for (int i = 0; i < 4; i++)
{
if (i>0)
{
expectedVersion += ".";
}
if (versionGroups.Length > i)
{
expectedVersion += $"{versionGroups[i]}";
}
else
{
expectedVersion += $"0";
}
}
}
else
{
expectedVersion = Version;
}
}
catch (Exception ex)
{
Log.LogMessage(MessageImportance.High, $"------ Custom Build Step : ReplaceVersionInJsFiles : Unable to resolve version : Exception : [{ex.Message}] ------");
return false;
}
var replacementText = $"?v={expectedVersion}";
Log.LogMessage(MessageImportance.High, $"------ Custom Build Step : ReplaceVersionInJsFiles : Match : [{matchExpression}] | Replace : [{replacementText}] ------");
try {
foreach (ITaskItem item in SourceFiles)
{
string fileName = item.ItemSpec;
Log.LogMessage(MessageImportance.High, "------ Custom Build Step : ReplaceVersionInJsFiles : Evaluating File '{0}'.", fileName);
var fileContent = File.ReadAllText(fileName);
var regexMatch = Regex.Match(fileContent, matchExpression);
if (regexMatch.Success && regexMatch.Value != replacementText)
{
Log.LogMessage(MessageImportance.High, "------ Custom Build Step : ReplaceVersionInJsFiles : Updating File '{0}'.", fileName);
File.WriteAllText(fileName, Regex.Replace(File.ReadAllText(fileName), matchExpression, replacementText).Trim());
}
}
}
catch (Exception ex)
{
Log.LogMessage(MessageImportance.High, $"------ Custom Build Step : ReplaceVersionInJsFiles : Exception : [{ex.Message}] ------");
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBuildStep" BeforeTargets="Build">
<ItemGroup>
<JsFiles Include='wwwroot\*.js' />
</ItemGroup>
<ReplaceVersionInJsFiles
SourceFiles="@(JsFiles)"
Version="$(Version)" />
</Target>
</Project>