소스 검색

Fixes #415 v2. Colors: OpenSUSE - The native method "COLOR_PAIRS" does not exist

BDisp 1 년 전
부모
커밋
8ab759b30f
5개의 변경된 파일84개의 추가작업 그리고 4개의 파일을 삭제
  1. 25 0
      .dockerignore
  2. 20 2
      Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs
  3. 35 0
      UICatalog/Dockerfile
  4. 2 2
      UICatalog/Properties/launchSettings.json
  5. 2 0
      UICatalog/UICatalog.csproj

+ 25 - 0
.dockerignore

@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md

+ 20 - 2
Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs

@@ -43,6 +43,7 @@
 //
 //
 using System;
 using System;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
+using Terminal.Gui;
 
 
 namespace Unix.Terminal {
 namespace Unix.Terminal {
 #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
 #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
@@ -83,8 +84,25 @@ namespace Unix.Terminal {
 		static void LoadMethods ()
 		static void LoadMethods ()
 		{
 		{
 			var libs = UnmanagedLibrary.IsMacOSPlatform ? new string [] { "libncurses.dylib" } : new string [] { "libncursesw.so.6", "libncursesw.so.5" };
 			var libs = UnmanagedLibrary.IsMacOSPlatform ? new string [] { "libncurses.dylib" } : new string [] { "libncursesw.so.6", "libncursesw.so.5" };
-			curses_library = new UnmanagedLibrary (libs, false);
-			methods = new NativeMethods (curses_library);
+			var attempts = 1;
+			while (true) {
+				try {
+					curses_library = new UnmanagedLibrary (libs, false);
+					methods = new NativeMethods (curses_library);
+					break;
+				} catch (Exception ex) {
+
+					if (attempts == 1) {
+						attempts++;
+						var (exitCode, result) = ClipboardProcessRunner.Bash ("cat /etc/os-release", waitForOutput: true);
+						if (exitCode == 0 && result.Contains ("opensuse")) {
+							libs [0] = "libncursesw.so.5";
+						}
+					} else {
+						throw ex.GetBaseException ();
+					}
+				}
+			}
 		}
 		}
 
 
 		static void FindNCurses ()
 		static void FindNCurses ()

+ 35 - 0
UICatalog/Dockerfile

@@ -0,0 +1,35 @@
+#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM opensuse/tumbleweed AS base
+RUN zypper -n update
+RUN zypper --non-interactive install libicu
+RUN zypper --non-interactive install libncurses5
+RUN zypper --non-interactive install wget
+RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc
+RUN wget https://packages.microsoft.com/config/opensuse/15/prod.repo
+RUN mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo
+RUN chown root:root /etc/zypp/repos.d/microsoft-prod.repo
+RUN zypper --non-interactive install dotnet-sdk-7.0
+
+ENV LANG=en_US.UTF-8 \
+	TERM=xterm-256color \
+	DISPLAY=:0
+WORKDIR /app
+
+FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
+WORKDIR /src
+COPY ["Terminal.Gui/Directory.Build.props", "Terminal.Gui/"]
+COPY ["UICatalog/UICatalog.csproj", "UICatalog/"]
+COPY ["Terminal.Gui/Terminal.Gui.csproj", "Terminal.Gui/"]
+RUN dotnet restore "UICatalog/UICatalog.csproj"
+COPY . .
+WORKDIR "/src/UICatalog"
+RUN dotnet build "UICatalog.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "UICatalog.csproj" -c Release -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "UICatalog.dll"]

+ 2 - 2
UICatalog/Properties/launchSettings.json

@@ -54,8 +54,8 @@
       "commandName": "Project",
       "commandName": "Project",
       "commandLineArgs": "\"Windows & FrameViews\""
       "commandLineArgs": "\"Windows & FrameViews\""
     },
     },
-    "Profile 1": {
-      "commandName": "Executable"
+    "Docker": {
+      "commandName": "Docker"
     }
     }
   }
   }
 }
 }

+ 2 - 0
UICatalog/UICatalog.csproj

@@ -11,6 +11,7 @@
     <FileVersion>2.0</FileVersion>
     <FileVersion>2.0</FileVersion>
     <Version>2.0</Version>
     <Version>2.0</Version>
     <InformationalVersion>2.0</InformationalVersion>
     <InformationalVersion>2.0</InformationalVersion>
+    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
     <DefineConstants>TRACE</DefineConstants>
     <DefineConstants>TRACE</DefineConstants>
@@ -28,6 +29,7 @@
   <None Update="./Scenarios/Spinning_globe_dark_small.gif" CopyToOutputDirectory="PreserveNewest" />
   <None Update="./Scenarios/Spinning_globe_dark_small.gif" CopyToOutputDirectory="PreserveNewest" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
+    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
     <PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
     <PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
     <PackageReference Include="CsvHelper" Version="30.0.1" />
     <PackageReference Include="CsvHelper" Version="30.0.1" />
     <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
     <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />