|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + Copyright (c) 2000, 2024, Oracle and/or its affiliates. |
| 4 | +
|
| 5 | + Licensed under the Universal Permissive License v 1.0 as shown at |
| 6 | + http://oss.oracle.com/licenses/upl. |
| 7 | +--> |
| 8 | +<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 9 | +<!-- MSBuild distribution build script for Oracle Coherence for .NET --> |
| 10 | +<!-- --> |
| 11 | +<!-- Usage: --> |
| 12 | +<!-- MsBuild Coherence.msbuild /t:dist /p:buildofficial=true \ --> |
| 13 | +<!-- /p:buildnumber=%P4_CHANGELIST% --> |
| 14 | +<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 15 | + |
| 16 | +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 17 | + |
| 18 | + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 19 | + <!-- Global properties --> |
| 20 | + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 21 | + |
| 22 | + <Import Project="Coherence.properties"/> |
| 23 | + |
| 24 | + <PropertyGroup> |
| 25 | + <BuildTargetVersion Condition="'$(BuildTargetVersion)'==''">net6.0</BuildTargetVersion> |
| 26 | + <TargetFrameworkVersion>v$(BuildTargetVersion)</TargetFrameworkVersion> |
| 27 | + <BuildVersion>$(AssemblyMajorVersion).$(AssemblyMinorVersion).$(AssemblyServicePack).$(AssemblyPatch)</BuildVersion> |
| 28 | + <BuildDescription Condition="'$(BuildOfficial)' != ''">$(AssemblyDescriptions)</BuildDescription> |
| 29 | + <BuildNumber Condition="'$(BuildOfficial)' == ''" >0</BuildNumber> |
| 30 | + <BuildOracleVersion>$(AssemblyMajorVersion).$(AssemblyMinorVersion).$(AssemblyServicePack).$(ComponentVersion).$(Patch)</BuildOracleVersion> |
| 31 | + |
| 32 | + <ProjectDir>$(MSBuildProjectDirectory)</ProjectDir> |
| 33 | + <BuildDir>$(ProjectDir)\build</BuildDir> |
| 34 | + |
| 35 | + <BinDir>$(ProjectDir)\bin</BinDir> |
| 36 | + |
| 37 | + <DistDir>$(ProjectDir)\dist</DistDir> |
| 38 | + <DistPatchesDir>$(DistDir)\patches\$(BuildVersion)</DistPatchesDir> |
| 39 | + <DistVersionDir>$(DistDir)\$(BuildVersion)b$(BuildNumber)</DistVersionDir> |
| 40 | + |
| 41 | + <DocDir>$(ProjectDir)\doc</DocDir> |
| 42 | + <SetupDir>$(ProjectDir)\setup</SetupDir> |
| 43 | + <SrcDir>$(ProjectDir)\src</SrcDir> |
| 44 | + <ToolsDir>$(ProjectDir)\tools</ToolsDir> |
| 45 | + |
| 46 | + <PropertiesDir>$(SrcDir)\Coherence\Properties</PropertiesDir> |
| 47 | + |
| 48 | + <ExtensionTasksPath>$(ToolsDir)\internal\msbuild\build\net40</ExtensionTasksPath> |
| 49 | + </PropertyGroup> |
| 50 | + |
| 51 | + <!-- Import the MSBuild extensions --> |
| 52 | + <Import Project="$(ExtensionTasksPath)\MSBuild.Extension.Pack.targets"/> |
| 53 | + |
| 54 | + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 55 | + <!-- Global project Targets --> |
| 56 | + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 57 | + |
| 58 | + <!-- Remove all build artifacts --> |
| 59 | + <Target Name="Clean"> |
| 60 | + <ItemGroup> |
| 61 | + <Files Include="$(BuildDir)"/> |
| 62 | + <Files Include="$(SrcDir)\Coherence\bin"/> |
| 63 | + <Files Include="$(SrcDir)\Coherence\obj"/> |
| 64 | + |
| 65 | + <Dist Include="$(DistVersionDir)"/> |
| 66 | + <Dist Include="$(DistDir)\coherence-net-$(BuildOracleVersion)b$(BuildNumber).zip"/> |
| 67 | + </ItemGroup> |
| 68 | + |
| 69 | + <RemoveDir ContinueOnError="true" Directories="@(Files)"/> |
| 70 | + <Delete Condition="'$(ClearDist)' != ''" ContinueOnError="true" Files="@(Dist)"/> |
| 71 | + <Delete ContinueOnError="true" Files="$(ProjectDir)\AssemblyInfo.cs" /> |
| 72 | + </Target> |
| 73 | + |
| 74 | + <!-- Main distribution target --> |
| 75 | + <Target Name="Dist"> |
| 76 | + <MakeDir Directories="$(DistDir)"/> |
| 77 | + <MakeDir Directories="$(DistVersionDir)"/> |
| 78 | + |
| 79 | + <MSBuild.ExtensionPack.Framework.Guid TaskAction="Create"> |
| 80 | + <Output TaskParameter="FormattedGuidString" PropertyName="ProductGuid"/> |
| 81 | + </MSBuild.ExtensionPack.Framework.Guid> |
| 82 | + |
| 83 | + <MSBuild.ExtensionPack.Framework.TextString TaskAction="ToUpper" OldString="$(ProductGuid)"> |
| 84 | + <Output PropertyName="ProductGuid" TaskParameter="NewString"/> |
| 85 | + </MSBuild.ExtensionPack.Framework.TextString> |
| 86 | + |
| 87 | + <PropertyGroup> |
| 88 | + <ProductName Condition="'$(BuildOfficial)' == ''">coherence-net-$(BuildDescription)</ProductName> |
| 89 | + <ProductName Condition="'$(BuildOfficial)' != ''">coherence-net-$(BuildOracleVersion)</ProductName> |
| 90 | + <OutFileName>Coherence.msi</OutFileName> |
| 91 | + <LogFileName>Coherence.msi.log</LogFileName> |
| 92 | + <MsiFileName>$(ProductName).msi</MsiFileName> |
| 93 | + <ZipFileName>$(ProductName)b$(BuildNumber).zip</ZipFileName> |
| 94 | + <OutFile>$(BuildDir)\$(OutFileName)</OutFile> |
| 95 | + <LogFile>$(BuildDir)\$(LogFileName)</LogFile> |
| 96 | + <MsiFile>$(DistVersionDir)\$(MsiFileName)</MsiFile> |
| 97 | + <ZipFile>$(DistDir)\$(ZipFileName)</ZipFile> |
| 98 | + </PropertyGroup> |
| 99 | + |
| 100 | + <Delete Files="$(OutFile);$(LogFile);$(ZipFile)"/> |
| 101 | + |
| 102 | + <ItemGroup> |
| 103 | + <MetaDataFile Include="$(SrcDir)\Coherence\product.xml"/> |
| 104 | + <MetaDataFileDest Include="$(BuildDir)\product.xml"/> |
| 105 | + <SetupFile Include="$(SetupDir)\Coherence.Setup\Coherence.Setup.Template.vdproj"/> |
| 106 | + <SetupFileDest Include="$(SetupDir)\Coherence.Setup\Coherence.Setup.vdproj" /> |
| 107 | + </ItemGroup> |
| 108 | + |
| 109 | + <ItemGroup> |
| 110 | + <TokenValues Include="VERSION"> |
| 111 | + <Replacement>$(BuildOracleVersion)</Replacement> |
| 112 | + </TokenValues> |
| 113 | + <TokenValues Include="DESCRIPTION"> |
| 114 | + <Replacement>$(AssemblyDescription)</Replacement> |
| 115 | + </TokenValues> |
| 116 | + <SetupTokens Include="INSTALLER_VERSION"> |
| 117 | + <Replacement>$(AssemblyMajorVersion).$(AssemblyMinorVersion).$(AssemblyServicePack)$(AssemblyPatch)</Replacement> |
| 118 | + </SetupTokens> |
| 119 | + <SetupTokens Include="PRODUCT_VERSION"> |
| 120 | + <Replacement>$(BuildVersion)</Replacement> |
| 121 | + </SetupTokens> |
| 122 | + <SetupTokens Include="PRODUCT_GUID"> |
| 123 | + <Replacement>$(ProductGuid)</Replacement> |
| 124 | + </SetupTokens> |
| 125 | + </ItemGroup> |
| 126 | + |
| 127 | + <!-- Copy the OPatch product metadata file --> |
| 128 | + <Copy SourceFiles="@(MetaDataFile)" DestinationFiles="@(MetaDataFileDest)"/> |
| 129 | + |
| 130 | + <MSBuild.ExtensionPack.FileSystem.Detokenise TaskAction="Detokenise" |
| 131 | + TargetFiles="@(MetaDataFileDest)" ReplacementValues="@(TokenValues)"/> |
| 132 | + |
| 133 | + <!-- Parameterize the setup project --> |
| 134 | + <Delete Files="@(SetupFileDest)"/> |
| 135 | + |
| 136 | + <Copy SourceFiles="@(SetupFile)" DestinationFiles="@(SetupFileDest)"/> |
| 137 | + |
| 138 | + <MSBuild.ExtensionPack.FileSystem.Detokenise TaskAction="Detokenise" |
| 139 | + TargetFiles="@(SetupFileDest)" ReplacementValues="@(SetupTokens)"/> |
| 140 | + |
| 141 | + <Exec Command="devenv.exe @(SetupFileDest) /build $(BuildType) /out $(LogFile)"/> |
| 142 | + |
| 143 | + <Error Condition="!Exists($(OutFile))" Text="The MSI failed to build. See $(LogFile) for more details."/> |
| 144 | + |
| 145 | + <Copy SourceFiles="$(OutFile)" DestinationFiles="$(MsiFile)"/> |
| 146 | + |
| 147 | + <!-- Copy the metalink readme and update it with the appropriate information --> |
| 148 | + <PropertyGroup> |
| 149 | + <ReadmeFileName>readme.txt</ReadmeFileName> |
| 150 | + <ReadmeFileName Condition=" '$(BuildDescription)'=='prerelease' ">readme-prerelease.txt</ReadmeFileName> |
| 151 | + </PropertyGroup> |
| 152 | + |
| 153 | + <ItemGroup> |
| 154 | + <ReadmeFile Include="$(DocDir)\build\$(ReadmeFileName)"/> |
| 155 | + <ReadmeFileDest Include="$(DistVersionDir)\README.txt"/> |
| 156 | + </ItemGroup> |
| 157 | + |
| 158 | + <Copy SourceFiles="@(ReadmeFile)" DestinationFiles="@(ReadmeFileDest)"/> |
| 159 | + |
| 160 | + <MSBuild.ExtensionPack.FileSystem.Detokenise TaskAction="Detokenise" |
| 161 | + TargetFiles="@(ReadmeFileDest)" ReplacementValues="@(TokenValues)"/> |
| 162 | + |
| 163 | + <ItemGroup> |
| 164 | + <ZipFiles Include="@(ReadmeFileDest)"/> |
| 165 | + <ZipFiles Include="$(MsiFile)"/> |
| 166 | + </ItemGroup> |
| 167 | + |
| 168 | + <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressFiles="@(ZipFiles)" |
| 169 | + RemoveRoot="$(DistVersionDir)" ZipFileName="$(ZipFile)" /> |
| 170 | + </Target> |
| 171 | + |
| 172 | + <!-- Escrow target --> |
| 173 | + <Target Name="Escrow" DependsOnTargets="Clean" > |
| 174 | + <ItemGroup> |
| 175 | + <EscrowFile Include="$(DistDir)\escrow-net-$(BuildOracleVersion).zip"/> |
| 176 | + <ZipFiles Include="$(ProjectDir)\**\*" |
| 177 | + Exclude="$(DistDir)\**\*; $(ProjectDir)\**\*.suo; $(ProjectDir)\**\*.user; $(ProjectDir)\**\*.xsx; $(ProjectDir)\**\_ReSharper*\**; $(ProjectDir)\**\obj\**; $(ProjectDir)\**\bin\**"/> |
| 178 | + </ItemGroup> |
| 179 | + |
| 180 | + <Delete Files="@(EscrowFile)"/> |
| 181 | + |
| 182 | + <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressFiles="@(ZipFiles)" |
| 183 | + CompressPath="$(ProjectDir)" RemoveRoot="$(ProjectDir)" |
| 184 | + ZipFileName="@(EscrowFile)" /> |
| 185 | + </Target> |
| 186 | + |
| 187 | + <!-- Patch target --> |
| 188 | + <Target Name="Patch" > |
| 189 | + <!-- Make sure this is a patch build --> |
| 190 | + <PropertyGroup> |
| 191 | + <BuildVersionPatch>$(AssemblyPatch)</BuildVersionPatch> |
| 192 | + </PropertyGroup> |
| 193 | + |
| 194 | + <Error Condition="'$(BuildVersionPatch)' == '0'" Text="Not a patch build: $(BuildVersion)"/> |
| 195 | + <Error Condition="'$(BuildVersionPatch)' == ''" Text="Not a patch build: $(BuildVersion)"/> |
| 196 | + |
| 197 | + <PropertyGroup> |
| 198 | + <PatchName>cohnet-$(AssemblyMajorVersion)$(AssemblyMinorVersion)$(AssemblyServicePack)-patch-$(BuildVersionPatch)</PatchName> |
| 199 | + <PatchDir>$(DistPatchesDir)</PatchDir> |
| 200 | + <PatchFile>$(PatchDir)\$(PatchName).zip</PatchFile> |
| 201 | + <BinDir>$(PatchDir)\bin</BinDir> |
| 202 | + <Root>$(PatchDir)\</Root> |
| 203 | + </PropertyGroup> |
| 204 | + |
| 205 | + <Message Text="Building patch: $(PatchName) in $(PatchDir)"/> |
| 206 | + |
| 207 | + <Error Condition="!Exists($(PatchDir))" Text="Missing patch directory: $(PatchDir)"/> |
| 208 | + |
| 209 | + <!-- Create the patch --> |
| 210 | + |
| 211 | + <Delete Files="@(PatchFile)"/> |
| 212 | + <MakeDir Directories="$(BinDir)"/> |
| 213 | + <ItemGroup> |
| 214 | + <BinFiles Include="$(BuildDir)\Coherence.2010\$(BuildType)\Coherence.*" /> |
| 215 | + </ItemGroup> |
| 216 | + |
| 217 | + <Copy SourceFiles="@(BinFiles)" DestinationFolder="$(BinDir)"/> |
| 218 | + |
| 219 | + <ItemGroup> |
| 220 | + <ZipFiles Include="$(DistPatchesDir)\$(ReadmeFileName)"/> |
| 221 | + <ZipFiles Include="$(BinDir)\**"/> |
| 222 | + </ItemGroup> |
| 223 | + |
| 224 | + <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" |
| 225 | + CompressFiles="@(ZipFiles)" ZipFileName="$(PatchFile)" RemoveRoot="$(Root)" /> |
| 226 | + |
| 227 | + <RemoveDir Directories="$(BinDir)" /> |
| 228 | + </Target> |
| 229 | + |
| 230 | +</Project> |
0 commit comments