-
Notifications
You must be signed in to change notification settings - Fork 20
Add .NET 8 Targets #991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .NET 8 Targets #991
Changes from 38 commits
5d127de
57c04f7
4f2c955
16d41b7
69d42ee
3589fbc
3ce389d
cd48031
637bbbf
37df7a7
954201c
76c2e92
2915465
57fdb86
fdcf303
938c64a
dfda963
e6b3942
079d3c2
0a1e15a
b6aa441
dcc9221
d2cfc09
b6a2268
7d07082
0f4cd3d
f85eb7f
490d332
0fce5ae
e23f900
fc93748
46caea8
a22283b
2a58ee9
c5d4762
9f69dfd
2a4a21d
194f98c
c67c553
dcbb06f
0f6cde4
a0c7f45
940a564
e7bfa4d
776af45
6fcf34e
66617fe
42fd80a
93bde67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,8 @@ public Build() | |
readonly AbsolutePath TestDirectory = RootDirectory / "_test"; | ||
|
||
const string NetFramework = "net48"; | ||
const string NetCore = "net6.0"; | ||
const string NetCoreWindows = "net6.0-windows"; | ||
const string NetCore = "net8.0"; | ||
const string NetCoreWindows = "net8.0-windows"; | ||
|
||
IEnumerable<string> RuntimeIds => SpecificRuntimeId != null | ||
? new[] { SpecificRuntimeId } | ||
|
@@ -206,7 +206,10 @@ public Build() | |
using var productWxsFile = UpdateMsiProductVersion(); | ||
|
||
RuntimeIds.Where(x => x.StartsWith("linux-")) | ||
.ForEach(runtimeId => RunBuildFor(NetCore, runtimeId)); | ||
.ForEach(runtimeId => | ||
{ | ||
RunBuildFor(NetCore, runtimeId); | ||
}); | ||
|
||
versionInfoFile.Dispose(); | ||
productWxsFile.Dispose(); | ||
|
@@ -222,7 +225,10 @@ public Build() | |
using var productWxsFile = UpdateMsiProductVersion(); | ||
|
||
RuntimeIds.Where(x => x.StartsWith("osx-")) | ||
.ForEach(runtimeId => RunBuildFor(NetCore, runtimeId)); | ||
.ForEach(runtimeId => | ||
{ | ||
RunBuildFor(NetCore, runtimeId); | ||
}); | ||
|
||
versionInfoFile.Dispose(); | ||
productWxsFile.Dispose(); | ||
|
@@ -288,6 +294,7 @@ ModifiableFileWithRestoreContentsOnDispose ModifyTemplatedVersionAndProductFiles | |
ModifiableFileWithRestoreContentsOnDispose UpdateMsiProductVersion() | ||
{ | ||
var productWxsFilePath = RootDirectory / "installer" / "Octopus.Tentacle.Installer" / "Product.wxs"; | ||
var productWxsFile = new ModifiableFileWithRestoreContentsOnDispose(productWxsFilePath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ We made a modification to this file before its creation. Now, we made sure it is created so we can capture the modification. |
||
|
||
var xmlDoc = new XmlDocument(); | ||
xmlDoc.Load(productWxsFilePath); | ||
|
@@ -305,7 +312,7 @@ ModifiableFileWithRestoreContentsOnDispose UpdateMsiProductVersion() | |
|
||
xmlDoc.Save(productWxsFilePath); | ||
|
||
return new ModifiableFileWithRestoreContentsOnDispose(productWxsFilePath); | ||
return productWxsFile; | ||
} | ||
|
||
void RunBuildFor(string framework, string runtimeId) | ||
|
@@ -342,4 +349,4 @@ void TarGZipCompress(AbsolutePath inputDirectory, string fileSpec, AbsolutePath | |
} | ||
|
||
public static int Main() => Execute<Build>(x => x.Default); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ public class ModifiableFileWithRestoreContentsOnDispose : IDisposable | |
public readonly AbsolutePath FilePath; | ||
readonly string OriginalFileText; | ||
string FileText; | ||
bool disposed = false; | ||
|
||
public ModifiableFileWithRestoreContentsOnDispose(AbsolutePath filePath) | ||
{ | ||
|
@@ -20,6 +21,16 @@ public ModifiableFileWithRestoreContentsOnDispose(AbsolutePath filePath) | |
} | ||
|
||
public void Dispose() | ||
{ | ||
if (disposed) | ||
{ | ||
return; | ||
} | ||
disposed = true; | ||
RestoreContents(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ Make sure we only restore the file contents once. |
||
} | ||
|
||
public void RestoreContents() | ||
{ | ||
Log.Information($"Restoring file {FilePath}"); | ||
File.WriteAllText(FilePath, OriginalFileText); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ $SCRIPT_DIR/setup-vm-agent.sh | |
|
||
source $SCRIPT_DIR/set-dotnet-envvars.sh | ||
|
||
itdll=`pwd`/build/outputs/integrationtests/net6.0/linux-x64/Octopus.Tentacle.Tests.Integration.dll | ||
itdll=`pwd`/build/outputs/integrationtests/${TARGET_FRAMEWORK:-net8.0}/linux-x64/Octopus.Tentacle.Tests.Integration.dll | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ If |
||
|
||
|
||
# We don't care about the exit code of dotnet test and instead depend on tests passing. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,15 @@ | |
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
source $SCRIPT_DIR/dotnet-install.sh | ||
# We install the 8.0 sdk and also the 6.0 runtime as the tests require it | ||
install_dotnet --runtime 6.0 --sdk 8.0 | ||
|
||
if [ "${TARGET_FRAMEWORK:-net6.0}" == "net6.0" ]; then | ||
# We install the 8.0 sdk and also the 6.0 runtime as the tests require it | ||
install_dotnet --runtime 6.0 --sdk 8.0 | ||
elif [ "${TARGET_FRAMEWORK:-net6.0}" == "net8.0" ]; then | ||
# Only the 8.0 sdk is required | ||
install_dotnet --sdk 8.0 | ||
else | ||
echo "WARNING: Unknown TARGET_FRAMEWORK: ${TARGET_FRAMEWORK:-net6.0}" 1>&2 | ||
# We install the 8.0 sdk and also the 6.0 runtime as the tests may require it | ||
install_dotnet --runtime 6.0 --sdk 8.0 | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ $SCRIPT_DIR/common/setup-vm-agent.sh | |
|
||
source $SCRIPT_DIR/common/set-dotnet-envvars.sh | ||
|
||
itdll=`pwd`/build/outputs/integrationtests/net6.0/linux-x64/Octopus.Tentacle.Kubernetes.Tests.Integration.dll | ||
itdll=`pwd`/build/outputs/integrationtests/net8.0/linux-x64/Octopus.Tentacle.Kubernetes.Tests.Integration.dll | ||
|
||
|
||
|
||
# We don't care about the exit code of dotnet test and instead depend on tests passing. | ||
|
@@ -22,4 +22,4 @@ if [ "$TENTACLE_IT_WITH_SUDO" = "1" ]; then | |
sudo -E env PATH=$PATH dotnet vstest $itdll "/testcasefilter:TestCategory!=TentacleBackwardsCompatibility" /logger:logger://teamcity /TestAdapterPath:/opt/TeamCity/BuildAgent/plugins/dotnet/tools/vstest15 /logger:console;verbosity=detailed | ||
else | ||
dotnet vstest $itdll "/testcasefilter:TestCategory!=RequiresSudoOnLinux&TestCategory!=TentacleBackwardsCompatibility" /logger:logger://teamcity /TestAdapterPath:/opt/TeamCity/BuildAgent/plugins/dotnet/tools/vstest15 /logger:console;verbosity=detailed | ||
fi | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#if NET8_0_OR_GREATER | ||
using System.Runtime.Versioning; | ||
[assembly: SupportedOSPlatform("windows")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Things complains about using Windows only APIs for this Windows only feature (Tentacle Manager). |
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
<EnableWindowsTargeting>true</EnableWindowsTargeting> | ||
<LangVersion>9</LangVersion> | ||
<Nullable>annotations</Nullable> | ||
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks> | ||
<TargetFrameworks>net48;net6.0-windows;net8.0-windows</TargetFrameworks> | ||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | ||
</PropertyGroup> | ||
|
||
|
@@ -26,6 +26,11 @@ | |
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="'$(TargetFramework)' == 'net8.0-windows'"> | ||
<PropertyGroup> | ||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
</PropertyGroup> | ||
</When> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ This was copied as it was clearer than adding a more complex condition |
||
</Choose> | ||
|
||
<ItemGroup> | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ The removal here is validated against the public doc on the supported Linux distro.