This commit is contained in:
2025-05-13 01:22:44 +03:00
parent 245b02f962
commit 03602b8138
27 changed files with 2078 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
/Build/bin
/Build/obj
/Build/.vs
/DependenciesBuild
/DependenciesSource
+3
View File
@@ -0,0 +1,3 @@
[submodule "Dependencies/Actions.Library"]
path = Dependencies/Actions.Library
url = https://github.com/L-proger/Actions.Library.git
+14
View File
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Dependencies\Actions.Library\Actions.Library.csproj" />
</ItemGroup>
</Project>
+28
View File
@@ -0,0 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build.csproj", "{227CD697-3936-44E6-9804-5FD12EDF17E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Actions.Library", "..\Dependencies\Actions.Library\Actions.Library.csproj", "{15ECFF80-DEAF-4227-831B-D71FC0B65371}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{227CD697-3936-44E6-9804-5FD12EDF17E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{227CD697-3936-44E6-9804-5FD12EDF17E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{227CD697-3936-44E6-9804-5FD12EDF17E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{227CD697-3936-44E6-9804-5FD12EDF17E6}.Release|Any CPU.Build.0 = Release|Any CPU
{15ECFF80-DEAF-4227-831B-D71FC0B65371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15ECFF80-DEAF-4227-831B-D71FC0B65371}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15ECFF80-DEAF-4227-831B-D71FC0B65371}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15ECFF80-DEAF-4227-831B-D71FC0B65371}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+87
View File
@@ -0,0 +1,87 @@
using Actions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Build {
public static class Dependencies {
static readonly string APR_VERSION = "1.7.5";
static readonly string APU_VERSION = "1.6.3";
static readonly string PY3C_VERSION = "1.1";
static readonly string SERF_VERSION = "1.3.10";
static readonly string ZLIB_VERSION = "1.2.8";
static readonly string SQLITE_VERSION = "3.39.4";
static readonly int SQLITE_VERSION_REL_YEAR = 2022;
static readonly string APACHE_MIRROR = "https://archive.apache.org/dist";
public static async Task<string?> DownloadIfNotExist(string url, string outPath) {
string? result = outPath;
if (!File.Exists(outPath)) {
Console.Write($"Downloading: {url}");
result = await Download.FileFromUrl(url, outPath);
Console.WriteLine($" Done");
} else {
Console.WriteLine($"Skip downloading: {url}");
}
return result;
}
public static async Task<string> GetZLib(string dir) {
var ZLIB = $"zlib-{ZLIB_VERSION}";
var archiveFile = await DownloadIfNotExist($"https://github.com/madler/zlib/archive/refs/tags/v{ZLIB_VERSION}.tar.gz", Path.Combine(dir, $"{ZLIB}.tar.gz"));
Archive.UnpackTarGz(archiveFile, dir);
return Path.Combine(dir, ZLIB);
}
public static async Task<string> GetSqlite(string dir) {
var SQLITE_VERSION_LIST = SQLITE_VERSION.Split(".");
var SQLITE = string.Format("sqlite-amalgamation-{0}{1}{2}00", SQLITE_VERSION_LIST[0], SQLITE_VERSION_LIST[1].PadLeft(2, '0'), SQLITE_VERSION_LIST[2].PadLeft(2, '0'));
var archiveFile = await DownloadIfNotExist($"https://www.sqlite.org/{SQLITE_VERSION_REL_YEAR}/{SQLITE}.zip", Path.Combine(dir, $"{SQLITE}.zip"));
Archive.UnpackZip(archiveFile, dir);
return Path.Combine(dir, $"{SQLITE}");
}
public static async Task<string> GetSerf(string dir) {
var SERF = $"serf-{SERF_VERSION}";
var archiveFile = await DownloadIfNotExist($"https://archive.apache.org/dist/serf/{SERF}.tar.bz2", Path.Combine(dir, $"{SERF}.tar.bz2"));
Archive.UnpackTarBz2(archiveFile, dir);
return Path.Combine(dir, $"{SERF}");
}
public static async Task<string> GetExpat(string dir) {
var archiveFile = await DownloadIfNotExist($"https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat-win64bin-2.6.4.zip", Path.Combine(dir, $"expat-win64bin-2.6.4.zip"));
var resultDir = Path.Combine(dir, "expat-win64bin-2.6.4");
Directory.CreateDirectory(resultDir);
Archive.UnpackZip(archiveFile, resultDir);
return Path.Combine(dir, resultDir);
}
public static async Task<string> GetOpenssl(string dir) {
var archiveFile = await DownloadIfNotExist($"https://github.com/openssl/openssl/releases/download/openssl-3.2.3/openssl-3.2.3.tar.gz", Path.Combine(dir, $"openssl-3.2.3.tar.gz"));
Archive.UnpackTarGz(archiveFile, dir);
return Path.Combine(dir, $"openssl-3.2.3");
}
public static async Task<string> GetApr(string dir) {
var APR = $"apr-{APR_VERSION}";
var archiveFile = await DownloadIfNotExist($"{APACHE_MIRROR}/apr/{APR}.tar.bz2", Path.Combine(dir, $"{APR}.tar.bz2"));
Archive.UnpackTarBz2(archiveFile, dir);
return Path.Combine(dir, $"{APR}");
}
public static async Task<string> GetAprUtil(string dir) {
var APR_UTIL = $"apr-util-{APU_VERSION}";
var archiveFile = await DownloadIfNotExist($"{APACHE_MIRROR}/apr/{APR_UTIL}.tar.bz2", Path.Combine(dir, $"{APR_UTIL}.tar.bz2"));
Archive.UnpackTarBz2(archiveFile, dir);
return Path.Combine(dir, $"{APR_UTIL}");
}
public static async Task<string> GetSubversion(string projectRootDir) {
return Path.GetFullPath(Path.Combine(projectRootDir, "..", "subversion"));
}
}
}
+195
View File
@@ -0,0 +1,195 @@
using Actions;
using Actions.Library;
using Build;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using static System.Runtime.InteropServices.JavaScript.JSType;
class Application {
static string GetCurrentFileDir([CallerFilePath]string callerFilePath = null) {
return Path.GetDirectoryName(callerFilePath);
}
static string GetProjectRootDir() {
return Path.GetDirectoryName(GetCurrentFileDir());
}
static void BuildZLib(string zlib, string installDir) {
var buildDir = TempDirectory.New();
var cmake = Find.Executable("cmake");
var ninja = Find.Executable("ninja");
var configResult = cmake.Run($"-G \"Ninja\" -DCMAKE_INSTALL_PREFIX={Path.Combine(installDir, "zlib")} -DCMAKE_BUILD_TYPE=RELEASE {zlib}", buildDir);
var buildResult = ninja.Run("", buildDir);
var installResult = ninja.Run("install", buildDir);
}
static void BuildOpenssl(string source, string installDir) {
var tmpDir = TempDirectory.New();
var perl = Find.Executable("perl");
if (perl == null) {
throw new Exception("Perl not found but required for OpenSSL build");
}
var nasm = Find.Executable("nasm");
if (nasm == null) {
throw new Exception("Nasm not found but required for OpenSSL build");
}
var installPrefix = Path.Combine(installDir, "openssl").Replace("\\", "/");
var configFilePath = Path.Combine(source, "Configure").Replace("\\", "/");
var configureResult = perl.Run($"{configFilePath} VC-WIN64A enable-capieng --prefix={installPrefix} --openssldir={installPrefix}", tmpDir);
var nmake = Find.Executable("nmake");
var buildResult = nmake.Run("", tmpDir);
var installResult = nmake.Run("install", tmpDir);
}
static void BuildApr(string source, string installDir) {
var tmpDir = TempDirectory.New();
var cmake = Find.Executable("cmake");
var ninja = Find.Executable("ninja");
var installPrefix = Path.Combine(installDir, "apr").Replace("\\", "/");
var configResult = cmake.Run($"-DCMAKE_INSTALL_PREFIX={installPrefix} -G \"Ninja\" -DAPR_INSTALL_PRIVATE_H=ON -DCMAKE_BUILD_TYPE=RELEASE -DAPR_BUILD_STATIC=ON {source}", tmpDir);
var buildResult = ninja.Run("", tmpDir);
var installResult = ninja.Run("install", tmpDir);
}
static void BuildAprUtil(string source, string expatLibDir, string installDir) {
var tmpDir = TempDirectory.New();
var cmake = Find.Executable("cmake");
var ninja = Find.Executable("ninja");
var installPrefix = Path.Combine(installDir, "apr").Replace("\\", "/");
var expatLibPath = Path.Combine(expatLibDir, "Bin", "libexpat.lib").Replace("\\", "/");
var expatIncPath = Path.Combine(expatLibDir, "Source", "lib").Replace("\\", "/");
var opensslPath = Path.Combine(installDir, "openssl").Replace("\\", "/");
var configResult = cmake.Run($"-DCMAKE_INSTALL_PREFIX={installPrefix} -G \"Ninja\" -DAPR_INSTALL_PRIVATE_H=ON -DCMAKE_BUILD_TYPE=RELEASE -DEXPAT_LIBRARY={expatLibPath} -DEXPAT_INCLUDE_DIR={expatIncPath} -DAPU_HAVE_CRYPTO=ON -DOPENSSL_ROOT_DIR={opensslPath} {source}", tmpDir);
var buildResult = ninja.Run("", tmpDir);
var installResult = ninja.Run("install", tmpDir);
}
static void BuildSerf(string source, string installDir) {
var scons = Find.Executable("scons");
var installPrefix = Path.Combine(installDir, "serf").Replace("\\", "/");
var libinstallPrefix = Path.Combine(installPrefix, "lib").Replace("\\", "/");
var aprPath = Path.Combine(installDir, "apr").Replace("\\", "/");
var aprUtilPath = Path.Combine(installDir, "apr").Replace("\\", "/");
var zlibPath = Path.Combine(installDir, "zlib").Replace("\\", "/");
var opensslPath = Path.Combine(installDir, "openssl").Replace("\\", "/");
//
scons.Run($"APR={aprPath} APU={aprUtilPath} ZLIB={zlibPath} OPENSSL={opensslPath} SOURCE_LAYOUT=0 TARGET_ARCH=X64 MSVC_VERSION=2022 PREFIX={installPrefix} LIBDIR={libinstallPrefix}", source);
scons.Run("install", source);
}
static void FixAprForSerf(string installDir) {
var aprPath = Path.Combine(installDir, "apr");
var incPath = Path.Combine(aprPath, "include");
var fixPath = Path.Combine(incPath, "apr-1");
Directory.CreateDirectory(fixPath);
var files = Directory.GetFiles(incPath);
foreach (var file in files) {
var name = Path.GetFileName(file);
var destPath = Path.Combine(fixPath, name);
File.Copy(file, destPath, true);
}
}
static void PatchSerf(string serfSource) {
var sconstructPath = Path.Combine(serfSource, "SConstruct");
string text = File.ReadAllText(sconstructPath);
text = text.Replace("$OPENSSL/include/openssl", "$OPENSSL/include");
File.WriteAllText(sconstructPath, text);
}
static void BuildSubversion(string svnSource, string sqlSource, string installDir) {
var aprPath = Path.Combine(installDir, "apr").Replace("\\", "/");
var serfPath = Path.Combine(installDir, "serf").Replace("\\", "/");
var zlibPath = Path.Combine(installDir, "zlib").Replace("\\", "/");
var opensslPath = Path.Combine(installDir, "openssl").Replace("\\", "/");
string libPaths = $"{aprPath};{serfPath};{zlibPath}";
string expatBinDir = "e:/SvnDeps/expat/Bin";
string expatIncDir = "e:/SvnDeps/expat/Source/lib";
string installPrefix = Path.Combine(installDir, "subversion");
List<string> args = new List<string>();
args.Add("-G \"Ninja\"");
args.Add($"-DCMAKE_LIBRARY_PATH={libPaths}");
args.Add($"-DCMAKE_PREFIX_PATH={libPaths}");
args.Add($"-DPC_EXPAT_LIBRARY_DIRS={expatBinDir}");
args.Add($"-DPC_EXPAT_INCLUDE_DIRS={expatIncDir}");
args.Add($"-DSVN_SQLITE_USE_AMALGAMATION=ON");
args.Add($"-DSQLITE_AMALGAMATION_DIR={sqlSource}");
args.Add($"-DCMAKE_BUILD_TYPE=RELEASE");
args.Add($"-DSVN_ENABLE_RA_SERF=ON");
args.Add($"-DOPENSSL_ROOT_DIR={opensslPath}");
args.Add($"-DSVN_ENABLE_SVNXX=ON");
args.Add($"-DSVN_ENABLE_NLS=OFF");
args.Add($"-DZLIB_USE_STATIC_LIBS=ON");
args.Add($"-DCMAKE_INSTALL_PREFIX={installPrefix}");
args.Add($"{svnSource}");
var argsString = string.Join(" ", args);
var cmake = Find.Executable("cmake");
var ninja = Find.Executable("ninja");
var tmpDir = TempDirectory.New();
var configResult = cmake.Run(argsString, tmpDir);
var buildResult = ninja.Run("", tmpDir);
var installResult = ninja.Run("install", tmpDir);
}
public static async Task<int> Main() {
VisualStudio.SetupEnvironment(CpuArchitecture.x64);
var projectRootDir = GetProjectRootDir();
var depsSourceDirectory = Path.Combine(projectRootDir, "DependenciesSource");
Directory.CreateDirectory(depsSourceDirectory);
var depsBuildDirectory = Path.Combine(projectRootDir, "DependenciesBuild");
Directory.CreateDirectory(depsBuildDirectory);
var svn = await Dependencies.GetSubversion(projectRootDir);
var zLib = await Dependencies.GetZLib(depsSourceDirectory);
var sqLite = await Dependencies.GetSqlite(depsSourceDirectory);
var apr = await Dependencies.GetApr(depsSourceDirectory);
var aprUtil = await Dependencies.GetAprUtil(depsSourceDirectory);
var serf = await Dependencies.GetSerf(depsSourceDirectory);
var openssl = await Dependencies.GetOpenssl(depsSourceDirectory);
var expat = await Dependencies.GetExpat(depsSourceDirectory);
BuildOpenssl(openssl, depsBuildDirectory);
BuildZLib(zLib, depsBuildDirectory);
BuildApr(apr, depsBuildDirectory);
BuildAprUtil(aprUtil, expat, depsBuildDirectory);
FixAprForSerf(depsBuildDirectory);
PatchSerf(serf);
BuildSerf(serf, depsBuildDirectory);
BuildSubversion(svn, sqLite, depsBuildDirectory);
return 0;
}
}
+2
View File
@@ -0,0 +1,2 @@
/bin
/obj
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions {
public class Action {
}
}
+14
View File
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Actions</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SharpCompress" Version="0.39.0" />
</ItemGroup>
</Project>
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Formats.Tar;
using SharpCompress.Compressors.BZip2;
using SharpCompress.Archives;
using SharpCompress.Common;
namespace Actions {
public static class Archive {
public static void UnpackTarGz(string archiveFileName, string outDirectory) {
using var fileStream = File.OpenRead(archiveFileName);
using var gzipStream = new GZipStream(fileStream, CompressionMode.Decompress);
TarFile.ExtractToDirectory(gzipStream, outDirectory, true);
}
public static void UnpackTarBz2(string archiveFileName, string outDirectory) {
using var fileStream = File.OpenRead(archiveFileName);
using var bz2Stream = new BZip2Stream(fileStream, SharpCompress.Compressors.CompressionMode.Decompress, false);
TarFile.ExtractToDirectory(bz2Stream, outDirectory, true);
}
public static void UnpackZip(string archiveFileName, string outDirectory) {
using var fileStream = File.OpenRead(archiveFileName);
using var zipArchive = SharpCompress.Archives.Zip.ZipArchive.Open(fileStream);
foreach (var entry in zipArchive.Entries.Where(entry => !entry.IsDirectory)) {
entry.WriteToDirectory(outDirectory, new ExtractionOptions() {
ExtractFullPath = true,
Overwrite = true
});
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Library {
public class CMake {
public static void Configure(string sourceDirectoryPath, string buildDirectoryPath) {
SystemProcess.Run("cmake", $"-DCMAKE_BUILD_TYPE:STRING=\"Release\" -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE:PATH=\"{buildDirectoryPath}/bin\" -H{sourceDirectoryPath} -B{buildDirectoryPath}", null);
}
public static void Build(string buildDirectoryPath) {
SystemProcess.Run("cmake", $"--build {buildDirectoryPath} --config Release", null);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Library {
public static class Config {
private static string PropertyNamePrefix = "Actions_";
private static string? Get([CallerMemberName]string? name = null) {
if(string.IsNullOrWhiteSpace(name)) {
throw new ArgumentNullException(nameof(name));
}
var result = System.Environment.GetEnvironmentVariable(PropertyNamePrefix + name);
return result;
}
private static void Set(string? value, [CallerMemberName] string? name = null) {
if (string.IsNullOrWhiteSpace(name)) {
throw new ArgumentNullException(nameof(name));
}
System.Environment.SetEnvironmentVariable(PropertyNamePrefix + name, value);
}
public static string? Nuget_RepoAuth { get { return Get(); } set { Set(value); } }
public static string? Nuget_RepoName { get { return Get(); } set { Set(value); } }
public static string? ArtifactsOutputDirectory { get { var result = Get(); return string.IsNullOrWhiteSpace(result) ? ".artifacts" : result; } set { Set(value); } }
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions {
public enum CpuArchitecture {
x86,
x64,
armeabi_v7a,
arm64_v8a,
riscv32
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Actions.Library.SystemProcess;
namespace Actions {
public static class Download {
public static async Task<byte[]?> BytesFromUrl(string url) {
using (var client = new HttpClient())
using (var result = await client.GetAsync(url))
return result.IsSuccessStatusCode ? await result.Content.ReadAsByteArrayAsync() : null;
}
public static async Task<string?> FileFromUrl(string url, string outputFilePath) {
using var client = new HttpClient();
using var result = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
if(!result.IsSuccessStatusCode) {
return null;
}
using var responseStream = result.Content.ReadAsStream();
using var destinationFileStream = new FileStream(outputFilePath, FileMode.CreateNew);
responseStream.CopyTo(destinationFileStream);
return outputFilePath;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
using Actions.Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions {
public class Executable {
public string FullPath {
get; private set;
}
private Executable() { FullPath = "UNKNOWN"; }
public Executable(string fullPath) {
if (!File.Exists(fullPath)) {
throw new FileNotFoundException($"Executable file not found at path {fullPath}");
}
FullPath = fullPath;
}
public SystemProcess.Result Run(string args, string? workingDirectory = null) {
return SystemProcess.Run(FullPath, args, workingDirectory);
}
}
}
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions {
public static class Find {
public static string? SystemFilePath(string name) {
name = Environment.ExpandEnvironmentVariables(name);
if (!File.Exists(name)) {
if (string.IsNullOrEmpty(Path.GetDirectoryName(name))) {
foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(';')) {
string path = test.Trim();
if (!String.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, name)))
return Path.GetFullPath(path);
}
}
return null;
}
return Path.GetFullPath(name);
}
public static string? ExecutablePath(string name) {
string? result = SystemFilePath(name);
if (result == null) {
if (!name.ToLower().EndsWith(".exe")) {
name = name + ".exe";
result = SystemFilePath(name);
}
}
return result;
}
public static Executable? Executable(string name) {
var path = ExecutablePath(name);
if (path == null) {
return null;
}
return new Executable(path);
}
}
}
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Sergey Serb
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+31
View File
@@ -0,0 +1,31 @@
using Actions.Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Nuget {
public class Nuget {
public static void DeletePackage(string repository, string packageName, string packageVersion) {
var result = SystemProcess.Run("dotnet", $"nuget delete {packageName} {packageVersion} -s {repository} --non-interactive");
if (!result.Succeeded) {
throw new Exception("Failed to delete nuget package");
}
}
public static void PushPackage(string repository, string packageFilePath, string? workingDirectory = null) {
var result = SystemProcess.Run("dotnet", $"nuget push --source {repository} {packageFilePath}", workingDirectory);
if (!result.Succeeded) {
throw new Exception("Failed to push nuget package");
}
}
public static void PackPackage(string workingDirectory) {
var result = SystemProcess.Run("nuget", "pack", workingDirectory);
if (!result.Succeeded) {
throw new Exception($"Failed to pack nuget package: {string.Join("\n", result.StdError)}");
}
}
}
}
+58
View File
@@ -0,0 +1,58 @@
using Actions.Nuget.Nuspec;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Actions.Nuget {
public class NuspecFile {
public Nuspec.Package package;
public NuspecFile() {
package = new Nuspec.Package();
}
public NuspecFile(string id, string version, string authors, string owners, Uri projectUrl, bool requireLicenseAcceptance, string description, string[] tags, string license) {
package = new Nuspec.Package();
package.Metadata = new Nuspec.PackageMetadata();
package.Metadata.Authors = authors;
package.Metadata.Owners = owners;
package.Metadata.Id = id;
package.Metadata.Version = version;
package.Metadata.ProjectUrl = projectUrl.ToString();
package.Metadata.RequireLicenseAcceptance = requireLicenseAcceptance;
package.Metadata.Description = description;
package.Metadata.Tags = string.Join(" ", tags);
package.Metadata.License = new PackageMetadataLicense();
package.Metadata.License.Value = license;
package.Metadata.License.Type = "expression";
}
public void Serialize(Stream outStream) {
XmlSerializer serializer = new XmlSerializer(typeof(Nuspec.Package), "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd");
serializer.Serialize(outStream, package);
}
public void SerializeToFile(string path) {
var outFileStream = System.IO.File.Open(path, FileMode.Create, FileAccess.Write);
Serialize(outFileStream);
outFileStream.Close();
}
public void Deserialize(Stream inStream) {
XmlSerializer serializer = new XmlSerializer(typeof(Nuspec.Package), "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd");
package = (Nuspec.Package)serializer.Deserialize(inStream);
}
public void DeserializeFromFile(string path) {
var inFileStream = System.IO.File.Open(path, FileMode.Open, FileAccess.Read);
Deserialize(inFileStream);
inFileStream.Close();
}
}
}
+962
View File
@@ -0,0 +1,962 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// This code was generated by XmlSchemaClassGenerator version 2.1.1142.0 using the following command:
// XmlSchemaClassGenerator.Console -n http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd=Actions.Nuget.Nuspec --nullable E:\nuspec.xsd
namespace Actions.Nuget.Nuspec {
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("dependency", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class Dependency {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("id")]
public string Id { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("version")]
public string Version { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("include")]
public string Include { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("exclude")]
public string Exclude { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("dependencyGroup", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DependencyGroup {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<Dependency> _dependency;
[System.Xml.Serialization.XmlElementAttribute("dependency")]
public System.Collections.ObjectModel.Collection<Dependency> Dependency {
get {
return _dependency;
}
private set {
_dependency = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Dependency collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool DependencySpecified {
get {
return (this.Dependency.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="DependencyGroup" /> class.</para>
/// </summary>
public DependencyGroup() {
this._dependency = new System.Collections.ObjectModel.Collection<Dependency>();
}
[System.Xml.Serialization.XmlAttributeAttribute("targetFramework")]
public string TargetFramework { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("reference", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class Reference {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("file")]
public string File { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("contentFileEntries", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ContentFileEntries {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("include")]
public string Include { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("exclude")]
public string Exclude { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("buildAction")]
public string BuildAction { get; set; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlAttributeAttribute("copyToOutput")]
public bool CopyToOutputValue { get; set; }
/// <summary>
/// <para xml:lang="en">Gets or sets a value indicating whether the CopyToOutput property is specified.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool CopyToOutputValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable<bool> CopyToOutput {
get {
if (this.CopyToOutputValueSpecified) {
return this.CopyToOutputValue;
} else {
return null;
}
}
set {
this.CopyToOutputValue = value.GetValueOrDefault();
this.CopyToOutputValueSpecified = value.HasValue;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlAttributeAttribute("flatten")]
public bool FlattenValue { get; set; }
/// <summary>
/// <para xml:lang="en">Gets or sets a value indicating whether the Flatten property is specified.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool FlattenValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable<bool> Flatten {
get {
if (this.FlattenValueSpecified) {
return this.FlattenValue;
} else {
return null;
}
}
set {
this.FlattenValue = value.GetValueOrDefault();
this.FlattenValueSpecified = value.HasValue;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("referenceGroup", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ReferenceGroup {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<Reference> _reference;
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("reference")]
public System.Collections.ObjectModel.Collection<Reference> Reference {
get {
return _reference;
}
private set {
_reference = value;
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="ReferenceGroup" /> class.</para>
/// </summary>
public ReferenceGroup() {
this._reference = new System.Collections.ObjectModel.Collection<Reference>();
}
[System.Xml.Serialization.XmlAttributeAttribute("targetFramework")]
public string TargetFramework { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("frameworkReference", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class FrameworkReference {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("name")]
public string Name { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("frameworkReferenceGroup", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class FrameworkReferenceGroup {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<FrameworkReference> _frameworkReference;
[System.Xml.Serialization.XmlElementAttribute("frameworkReference")]
public System.Collections.ObjectModel.Collection<FrameworkReference> FrameworkReference {
get {
return _frameworkReference;
}
private set {
_frameworkReference = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the FrameworkReference collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FrameworkReferenceSpecified {
get {
return (this.FrameworkReference.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="FrameworkReferenceGroup" /> class.</para>
/// </summary>
public FrameworkReferenceGroup() {
this._frameworkReference = new System.Collections.ObjectModel.Collection<FrameworkReference>();
}
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("targetFramework")]
public string TargetFramework { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("package", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute("package", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public partial class Package {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("metadata")]
public PackageMetadata Metadata { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageFilesFile> _files;
[System.Xml.Serialization.XmlArrayAttribute("files", IsNullable = true)]
[System.Xml.Serialization.XmlArrayItemAttribute("file", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public System.Collections.ObjectModel.Collection<PackageFilesFile> Files {
get {
return _files;
}
private set {
_files = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Files collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FilesSpecified {
get {
return (this.Files.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="Package" /> class.</para>
/// </summary>
public Package() {
this._files = new System.Collections.ObjectModel.Collection<PackageFilesFile>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadata", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadata {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("id")]
public string Id { get; set; }
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("version")]
public string Version { get; set; }
[System.Xml.Serialization.XmlElementAttribute("title")]
public string Title { get; set; }
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("authors")]
public string Authors { get; set; }
[System.Xml.Serialization.XmlElementAttribute("owners")]
public string Owners { get; set; }
[System.Xml.Serialization.XmlElementAttribute("licenseUrl")]
public string LicenseUrl { get; set; }
[System.Xml.Serialization.XmlElementAttribute("projectUrl")]
public string ProjectUrl { get; set; }
[System.Xml.Serialization.XmlElementAttribute("iconUrl")]
public string IconUrl { get; set; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlElementAttribute("requireLicenseAcceptance")]
public bool RequireLicenseAcceptanceValue { get; set; }
/// <summary>
/// <para xml:lang="en">Gets or sets a value indicating whether the RequireLicenseAcceptance property is specified.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool RequireLicenseAcceptanceValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable<bool> RequireLicenseAcceptance {
get {
if (this.RequireLicenseAcceptanceValueSpecified) {
return this.RequireLicenseAcceptanceValue;
} else {
return null;
}
}
set {
this.RequireLicenseAcceptanceValue = value.GetValueOrDefault();
this.RequireLicenseAcceptanceValueSpecified = value.HasValue;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlElementAttribute("developmentDependency")]
public bool DevelopmentDependencyValue { get; set; }
/// <summary>
/// <para xml:lang="en">Gets or sets a value indicating whether the DevelopmentDependency property is specified.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool DevelopmentDependencyValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable<bool> DevelopmentDependency {
get {
if (this.DevelopmentDependencyValueSpecified) {
return this.DevelopmentDependencyValue;
} else {
return null;
}
}
set {
this.DevelopmentDependencyValue = value.GetValueOrDefault();
this.DevelopmentDependencyValueSpecified = value.HasValue;
}
}
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlElementAttribute("description")]
public string Description { get; set; }
[System.Xml.Serialization.XmlElementAttribute("summary")]
public string Summary { get; set; }
[System.Xml.Serialization.XmlElementAttribute("releaseNotes")]
public string ReleaseNotes { get; set; }
[System.Xml.Serialization.XmlElementAttribute("copyright")]
public string Copyright { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private string _language = "en-US";
[System.ComponentModel.DefaultValueAttribute("en-US")]
[System.Xml.Serialization.XmlElementAttribute("language")]
public string Language {
get {
return _language;
}
set {
_language = value;
}
}
[System.Xml.Serialization.XmlElementAttribute("tags")]
public string Tags { get; set; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Xml.Serialization.XmlElementAttribute("serviceable")]
public bool ServiceableValue { get; set; }
/// <summary>
/// <para xml:lang="en">Gets or sets a value indicating whether the Serviceable property is specified.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public bool ServiceableValueSpecified { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Nullable<bool> Serviceable {
get {
if (this.ServiceableValueSpecified) {
return this.ServiceableValue;
} else {
return null;
}
}
set {
this.ServiceableValue = value.GetValueOrDefault();
this.ServiceableValueSpecified = value.HasValue;
}
}
[System.Xml.Serialization.XmlElementAttribute("icon")]
public string Icon { get; set; }
[System.Xml.Serialization.XmlElementAttribute("readme")]
public string Readme { get; set; }
[System.Xml.Serialization.XmlElementAttribute("repository")]
public PackageMetadataRepository Repository { get; set; }
[System.Xml.Serialization.XmlElementAttribute("license")]
public PackageMetadataLicense License { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType> _packageTypes;
[System.Xml.Serialization.XmlArrayAttribute("packageTypes")]
[System.Xml.Serialization.XmlArrayItemAttribute("packageType", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType> PackageTypes {
get {
return _packageTypes;
}
private set {
_packageTypes = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the PackageTypes collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool PackageTypesSpecified {
get {
return (this.PackageTypes.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadata" /> class.</para>
/// </summary>
public PackageMetadata() {
this._packageTypes = new System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType>();
this._frameworkAssemblies = new System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly>();
this._frameworkReferences = new System.Collections.ObjectModel.Collection<FrameworkReferenceGroup>();
this._contentFiles = new System.Collections.ObjectModel.Collection<ContentFileEntries>();
}
[System.Xml.Serialization.XmlElementAttribute("dependencies")]
public PackageMetadataDependencies Dependencies { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly> _frameworkAssemblies;
[System.Xml.Serialization.XmlArrayAttribute("frameworkAssemblies")]
[System.Xml.Serialization.XmlArrayItemAttribute("frameworkAssembly", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly> FrameworkAssemblies {
get {
return _frameworkAssemblies;
}
private set {
_frameworkAssemblies = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the FrameworkAssemblies collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FrameworkAssembliesSpecified {
get {
return (this.FrameworkAssemblies.Count != 0);
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<FrameworkReferenceGroup> _frameworkReferences;
[System.Xml.Serialization.XmlArrayAttribute("frameworkReferences")]
[System.Xml.Serialization.XmlArrayItemAttribute("group", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public System.Collections.ObjectModel.Collection<FrameworkReferenceGroup> FrameworkReferences {
get {
return _frameworkReferences;
}
private set {
_frameworkReferences = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the FrameworkReferences collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FrameworkReferencesSpecified {
get {
return (this.FrameworkReferences.Count != 0);
}
}
[System.Xml.Serialization.XmlElementAttribute("references")]
public PackageMetadataReferences References { get; set; }
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<ContentFileEntries> _contentFiles;
[System.Xml.Serialization.XmlArrayAttribute("contentFiles")]
[System.Xml.Serialization.XmlArrayItemAttribute("files", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
public System.Collections.ObjectModel.Collection<ContentFileEntries> ContentFiles {
get {
return _contentFiles;
}
private set {
_contentFiles = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the ContentFiles collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ContentFilesSpecified {
get {
return (this.ContentFiles.Count != 0);
}
}
[System.Xml.Serialization.XmlAttributeAttribute("minClientVersion")]
public string MinClientVersion { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataRepository", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataRepository {
[System.Xml.Serialization.XmlAttributeAttribute("type")]
public string Type { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("url")]
public string Url { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("branch")]
public string Branch { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("commit")]
public string Commit { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataLicense", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataLicense {
/// <summary>
/// <para xml:lang="en">Gets or sets the text value.</para>
/// </summary>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value { get; set; }
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("type")]
public string Type { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("version")]
public string Version { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataPackageTypes", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataPackageTypes {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType> _packageType;
[System.Xml.Serialization.XmlElementAttribute("packageType")]
public System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType> PackageType {
get {
return _packageType;
}
private set {
_packageType = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the PackageType collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool PackageTypeSpecified {
get {
return (this.PackageType.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataPackageTypes" /> class.</para>
/// </summary>
public PackageMetadataPackageTypes() {
this._packageType = new System.Collections.ObjectModel.Collection<PackageMetadataPackageTypesPackageType>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataPackageTypesPackageType", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataPackageTypesPackageType {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("name")]
public string Name { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("version")]
public string Version { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataDependencies", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataDependencies {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<Dependency> _dependency;
[System.Xml.Serialization.XmlElementAttribute("dependency")]
public System.Collections.ObjectModel.Collection<Dependency> Dependency {
get {
return _dependency;
}
private set {
_dependency = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Dependency collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool DependencySpecified {
get {
return (this.Dependency.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataDependencies" /> class.</para>
/// </summary>
public PackageMetadataDependencies() {
this._dependency = new System.Collections.ObjectModel.Collection<Dependency>();
this._group = new System.Collections.ObjectModel.Collection<DependencyGroup>();
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<DependencyGroup> _group;
[System.Xml.Serialization.XmlElementAttribute("group")]
public System.Collections.ObjectModel.Collection<DependencyGroup> Group {
get {
return _group;
}
private set {
_group = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Group collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool GroupSpecified {
get {
return (this.Group.Count != 0);
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataFrameworkAssemblies", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataFrameworkAssemblies {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly> _frameworkAssembly;
[System.Xml.Serialization.XmlElementAttribute("frameworkAssembly")]
public System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly> FrameworkAssembly {
get {
return _frameworkAssembly;
}
private set {
_frameworkAssembly = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the FrameworkAssembly collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FrameworkAssemblySpecified {
get {
return (this.FrameworkAssembly.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataFrameworkAssemblies" /> class.</para>
/// </summary>
public PackageMetadataFrameworkAssemblies() {
this._frameworkAssembly = new System.Collections.ObjectModel.Collection<PackageMetadataFrameworkAssembliesFrameworkAssembly>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataFrameworkAssembliesFrameworkAssembly", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataFrameworkAssembliesFrameworkAssembly {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("assemblyName")]
public string AssemblyName { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("targetFramework")]
public string TargetFramework { get; set; }
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataFrameworkReferences", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataFrameworkReferences {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<FrameworkReferenceGroup> _group;
[System.Xml.Serialization.XmlElementAttribute("group")]
public System.Collections.ObjectModel.Collection<FrameworkReferenceGroup> Group {
get {
return _group;
}
private set {
_group = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Group collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool GroupSpecified {
get {
return (this.Group.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataFrameworkReferences" /> class.</para>
/// </summary>
public PackageMetadataFrameworkReferences() {
this._group = new System.Collections.ObjectModel.Collection<FrameworkReferenceGroup>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataReferences", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataReferences {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<Reference> _reference;
[System.Xml.Serialization.XmlElementAttribute("reference")]
public System.Collections.ObjectModel.Collection<Reference> Reference {
get {
return _reference;
}
private set {
_reference = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Reference collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ReferenceSpecified {
get {
return (this.Reference.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataReferences" /> class.</para>
/// </summary>
public PackageMetadataReferences() {
this._reference = new System.Collections.ObjectModel.Collection<Reference>();
this._group = new System.Collections.ObjectModel.Collection<ReferenceGroup>();
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<ReferenceGroup> _group;
[System.Xml.Serialization.XmlElementAttribute("group")]
public System.Collections.ObjectModel.Collection<ReferenceGroup> Group {
get {
return _group;
}
private set {
_group = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Group collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool GroupSpecified {
get {
return (this.Group.Count != 0);
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageMetadataContentFiles", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageMetadataContentFiles {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<ContentFileEntries> _files;
[System.Xml.Serialization.XmlElementAttribute("files")]
public System.Collections.ObjectModel.Collection<ContentFileEntries> Files {
get {
return _files;
}
private set {
_files = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the Files collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FilesSpecified {
get {
return (this.Files.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageMetadataContentFiles" /> class.</para>
/// </summary>
public PackageMetadataContentFiles() {
this._files = new System.Collections.ObjectModel.Collection<ContentFileEntries>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageFiles", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageFiles {
[System.Xml.Serialization.XmlIgnoreAttribute()]
private System.Collections.ObjectModel.Collection<PackageFilesFile> _file;
[System.Xml.Serialization.XmlElementAttribute("file")]
public System.Collections.ObjectModel.Collection<PackageFilesFile> File {
get {
return _file;
}
private set {
_file = value;
}
}
/// <summary>
/// <para xml:lang="en">Gets a value indicating whether the File collection is empty.</para>
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool FileSpecified {
get {
return (this.File.Count != 0);
}
}
/// <summary>
/// <para xml:lang="en">Initializes a new instance of the <see cref="PackageFiles" /> class.</para>
/// </summary>
public PackageFiles() {
this._file = new System.Collections.ObjectModel.Collection<PackageFilesFile>();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "2.1.1142.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute("PackageFilesFile", Namespace = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd", AnonymousType = true)]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PackageFilesFile {
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings = true)]
[System.Xml.Serialization.XmlAttributeAttribute("src")]
public string Src { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("target")]
public string Target { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute("exclude")]
public string Exclude { get; set; }
}
}
+1
View File
@@ -0,0 +1 @@
# Actions.Library
+10
View File
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions {
public class RunCmake : Action {
}
}
+65
View File
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Library {
public class SystemProcess {
public class Result {
public List<string> StdError = new List<string>();
public List<string> StdOut = new List<string>();
public int ExitCode;
public bool Succeeded {
get { return ExitCode == 0; }
}
}
public static Result Run(string executablePath, string arguments, string? workingDirectory = null) {
Result result = new Result();
Process process = new Process();
process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => {
if(e.Data != null) {
result.StdOut.Add(e.Data);
Console.WriteLine(e.Data);
}
};
process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
if (e.Data != null) {
result.StdError.Add(e.Data);
Console.WriteLine(e.Data);
}
};
process.StartInfo.FileName = executablePath;
process.StartInfo.Arguments = arguments;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
if (!string.IsNullOrWhiteSpace(workingDirectory)) {
process.StartInfo.WorkingDirectory = workingDirectory;
}
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
result.ExitCode = process.ExitCode;
return result;
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Actions.Library {
public static class TempDirectory {
public static string New() {
var assemblyPath = Assembly.GetEntryAssembly().Location;
var assemblyDir = Path.GetDirectoryName(assemblyPath);
var tmpDir = Path.Combine(assemblyDir, "Temp");
Directory.CreateDirectory(tmpDir);
int id = 0;
while (true) {
var dir = Path.Combine(tmpDir, id.ToString());
if (!Directory.Exists(dir)) {
Directory.CreateDirectory(dir);
return dir;
}
++id;
}
}
}
}
+117
View File
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using Actions.Library;
namespace Actions {
public static class VisualStudio {
public static class Version {
public static readonly string VisualStudio2017 = "14.16";
public static readonly string VisualStudio2015 = "14.0";
}
public class VSWhereOutput {
public List<Instance> Instances = new List<Instance>();
public class Instance {
public System.Text.Json.JsonElement JsonElement;
public string DisplayName => JsonElement.GetProperty("displayName").GetString();
public bool IsLaunchable => JsonElement.GetProperty("isLaunchable").GetBoolean();
public bool IsPrerelease => JsonElement.GetProperty("isPrerelease").GetBoolean();
public string Catalog_ProductLineVersion => JsonElement.GetProperty("catalog").GetProperty("productLineVersion").GetString();
public string Catalog_ProductSemanticVersion => JsonElement.GetProperty("catalog").GetProperty("productSemanticVersion").GetString();
//
}
public VSWhereOutput(System.Text.Json.JsonDocument vswhereJsonOutput) {
var cnt = vswhereJsonOutput.RootElement.GetArrayLength();
for (int i = 0; i < cnt; i++) {
Instance inst = new Instance();
inst.JsonElement = vswhereJsonOutput.RootElement[i];
Instances.Add(inst);
}
}
}
public static VSWhereOutput VSWhereQuery(bool latest, bool prerelease) {
var programFilesDir = System.Environment.GetEnvironmentVariable("ProgramFiles(x86)");
var vsInstalledDir = Path.Combine(programFilesDir, @"Microsoft Visual Studio\Installer\");
var vsWherePath = Path.Combine(vsInstalledDir, "vswhere.exe");
var vsWhereResult = SystemProcess.Run(vsWherePath, $"-format json -nologo {(latest ? "-latest" : "")} {(prerelease ? "-prerelease" : "")}");
var json = System.Text.Json.JsonDocument.Parse(string.Join("\n", vsWhereResult.StdOut));
VSWhereOutput result = new VSWhereOutput(json);
return result;
}
public static string FindVisualStudioPath() {
var programFilesDir = System.Environment.GetEnvironmentVariable("ProgramFiles(x86)");
var vsInstalledDir = Path.Combine(programFilesDir, @"Microsoft Visual Studio\Installer\");
var vsWherePath = Path.Combine(vsInstalledDir, "vswhere.exe");
var vsWhereResult = SystemProcess.Run(vsWherePath, "-latest -property installationPath");
Console.WriteLine("Detected VisualStudio installation path: " + vsWhereResult.StdOut[0]);
return vsWhereResult.StdOut[0];
}
public static string FindVCvarsallBatFile() {
var vsInstallPath = FindVisualStudioPath();
return Path.Combine(vsInstallPath, @"VC\Auxiliary\Build\vcvarsall.bat");
}
public static void SetupEnvironment(CpuArchitecture targetArch) {
var programFilesDir = System.Environment.GetEnvironmentVariable("ProgramFiles(x86)");
var vsInstalledDir = Path.Combine(programFilesDir, @"Microsoft Visual Studio\Installer\");
var vsWherePath = Path.Combine(vsInstalledDir, "vswhere.exe");
var vsWhereResult = SystemProcess.Run(vsWherePath, "-latest -property installationPath");
var vsInstallPath = vsWhereResult.StdOut[0];
Console.WriteLine("Setting up build environment");
var vsEnvBatchFile = FindVCvarsallBatFile();
var batchFileArgs = "";
if (targetArch == CpuArchitecture.x86) {
batchFileArgs = "x86";
} else if (targetArch == CpuArchitecture.x64) {
batchFileArgs = "amd64";
} else if (targetArch == CpuArchitecture.armeabi_v7a) {
batchFileArgs = "x86_arm";
} else if (targetArch == CpuArchitecture.arm64_v8a) {
batchFileArgs = "x86_arm64";
}
//batchFileArgs += $" -vcvars_ver={Config.VisualStudio.ToolsetVersion}";
var vsEnvResult = SystemProcess.Run("cmd", $"/C \"{vsEnvBatchFile}\" {batchFileArgs} > nul 2>&1 && set");
Regex r = new Regex("^([^=]+)=(.*)");
foreach (var s in vsEnvResult.StdOut) {
var m = r.Match(s);
if (m.Success) {
System.Environment.SetEnvironmentVariable(m.Groups[1].Value, m.Groups[2].Value);
}
}
}
public static void CleanEnvironment() {
var batchFileArgs = " /clean_env";
var vsEnvBatchFile = FindVCvarsallBatFile();
var vsEnvResult = SystemProcess.Run("cmd", $"/C \"{vsEnvBatchFile}\" {batchFileArgs} > nul 2>&1 && set");
Regex r = new Regex("^([^=]+)=(.*)");
foreach (var s in vsEnvResult.StdOut) {
var m = r.Match(s);
if (m.Success) {
System.Environment.SetEnvironmentVariable(m.Groups[1].Value, m.Groups[2].Value);
}
}
}
}
}
+155
View File
@@ -0,0 +1,155 @@
$APR_VERSION="1.7.5"
$APU_VERSION="1.6.3"
$PY3C_VERSION="1.1"
$SERF_VERSION="1.3.10"
$ZLIB_VERSION="1.2.8"
$SQLITE_VERSION="3.39.4"
# Used to construct the SQLite download URL.
$SQLITE_VERSION_REL_YEAR=2022
$HTTPD_VERSION="2.4.10"
$APR_ICONV_VERSION="1.2.1"
$APR="apr-$APR_VERSION"
$APR_UTIL="apr-util-$APU_VERSION"
$PY3C="py3c-$PY3C_VERSION"
$SERF="serf-$SERF_VERSION"
$ZLIB="zlib-$ZLIB_VERSION"
$SQLITE_VERSION_LIST= $SQLITE_VERSION.Split(".")
$SQLITE=[string]::Format("sqlite-amalgamation-{0}{1}{2}00", $SQLITE_VERSION_LIST[0], $SQLITE_VERSION_LIST[1].PadLeft(2, '0'), $SQLITE_VERSION_LIST[2].PadLeft(2, '0'))
$BASEDIR=$PSScriptRoot
$TEMPDIR="$BASEDIR/temp"
$APACHE_MIRROR="https://archive.apache.org/dist"
New-Item -ItemType Directory -Force -Path "$TEMPDIR"
function DownloadFile {
param ( $Src, $Dst )
if(-Not (Test-Path "$Dst" -PathType Leaf)){
Invoke-WebRequest "$Src" -OutFile "$Dst"
}
}
function extractTarBz2{
param ( $Src )
7z x -y "$Src"
$srcFile = Get-ChildItem "$Src"
$tarFile = $srcFile.BaseName
Write-Host "TAR file name: $tarFile"
7z x -y "$tarFile"
}
function extractTarGzip{
param ( $Src )
7z x -tgzip -y "$Src"
$srcFile = Get-ChildItem "$Src"
$tarFile = $srcFile.BaseName
Write-Host "TAR file name: $tarFile"
7z x -y "$tarFile"
}
function moveDir{
param ( $Src, $Dst )
if (Test-Path -LiteralPath $Dst) {
Remove-Item -LiteralPath $Dst -Recurse
}
Move-Item -Path $Src -Destination "$Dst" -force
}
function getApr {
Set-Location $TEMPDIR
DownloadFile -Src "$APACHE_MIRROR/apr/$APR.tar.bz2" -Dst "$APR.tar.bz2"
extractTarBz2 -Src "$APR.tar.bz2"
moveDir -Src $APR -Dst "$BASEDIR/apr"
DownloadFile -Src "$APACHE_MIRROR/apr/$APR_UTIL.tar.bz2" -Dst "$APR_UTIL.tar.bz2"
extractTarBz2 -Src "$APR_UTIL.tar.bz2"
moveDir -Src $APR_UTIL -Dst "$BASEDIR/apr-util"
Set-Location $BASEDIR
}
function getZlib() {
Set-Location $TEMPDIR
DownloadFile -Src "https://github.com/madler/zlib/archive/refs/tags/v$ZLIB_VERSION.tar.gz" -Dst "$ZLIB.tar.gz"
extractTarGzip -Src "$ZLIB.tar.gz"
moveDir -Src $ZLIB -Dst "$BASEDIR/zlib"
Set-Location $BASEDIR
}
function getSqlite() {
Set-Location $TEMPDIR
Write-Host "!!!! https://www.sqlite.org/$SQLITE_VERSION_REL_YEAR/$SQLITE.zip"
DownloadFile -Src "https://www.sqlite.org/$SQLITE_VERSION_REL_YEAR/$SQLITE.zip" -Dst "$SQLITE.zip"
Expand-Archive "$SQLITE.zip" -Force -DestinationPath "./"
moveDir -Src $SQLITE -Dst "$BASEDIR/sqlite-amalgamation"
Set-Location $BASEDIR
}
function getSerf() {
Set-Location $TEMPDIR
DownloadFile -Src "https://archive.apache.org/dist/serf/$SERF.tar.bz2" -Dst "$SERF.tar.bz2"
extractTarBz2 -Src "$SERF.tar.bz2"
moveDir -Src $SERF -Dst "$BASEDIR/serf"
Set-Location $BASEDIR
}
function getExpat() {
Set-Location $TEMPDIR
DownloadFile -Src "https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.bz2" -Dst "expat-2.2.9.tar.bz2"
extractTarBz2 -Src "expat-2.2.9.tar.bz2"
moveDir -Src "expat-2.2.9" -Dst "$BASEDIR/expat"
Set-Location $BASEDIR
}
function getOpenssl() {
Set-Location $TEMPDIR
DownloadFile -Src "https://github.com/openssl/openssl/releases/download/openssl-3.2.3/openssl-3.2.3.tar.gz" -Dst "openssl-3.2.3.tar.gz"
extractTarGzip -Src "openssl-3.2.3.tar.gz"
moveDir -Src "openssl-3.2.3" -Dst "$BASEDIR/openssl"
Set-Location $BASEDIR
}
# function getPy3C
# {
# $py3cdist="v${PY3C_VERSION}.tar.gz"
# Set-Location $TEMPDIR
# DownloadFile -Src "https://github.com/encukou/py3c/archive/$py3cdist" -Dst "$py3cdist"
# extractTarBz2 -Src "$py3cdist"
# moveDir -Src $PY3C -Dst "$BASEDIR/py3c"
# Set-Location $BASEDIR
# }
#getOpenssl
#getExpat
#getSqlite
#getZlib
getApr
getSerf
#getPy3C
Remove-Item -LiteralPath $TEMPDIR -Recurse
Write-Host "Done!"
+68 -1
View File
@@ -1,2 +1,69 @@
# BuildSubversion
# Linux build
```sh
apt update -y
apt install -y autoconf libtool gcc libsqlite3-dev libarchive-dev libz-dev libutf8proc-dev \
libserf-dev libapr1-dev libaprutil1-dev libssl-dev libmagic-dev liblz4-dev
wget https://mirrors.gigenet.com/apache/subversion/subversion-1.14.1.tar.gz
cd subversion-1.14.1
./configure ; make
sudo make install
```
# Windows build
## Download expat
```
https://sourceforge.net/projects/expat/files/expat_win64/2.6.4/expat-win64bin-2.6.4.exe/download
Install to E:\SvnDeps\expat
```
## Build APR
```bat
cmake -DCMAKE_INSTALL_PREFIX=e:/SvnDeps/apr -G "Ninja" -DAPR_INSTALL_PRIVATE_H=ON -DCMAKE_BUILD_TYPE=RELEASE -DAPR_BUILD_STATIC=ON ../apr
ninja
ninja install
```
## Build APR-UTIL
```bat
cmake -DCMAKE_INSTALL_PREFIX=e:/SvnDeps/apr -G "Ninja" -DAPR_INSTALL_PRIVATE_H=ON -DCMAKE_BUILD_TYPE=RELEASE -DEXPAT_LIBRARY=e:/SvnDeps/expat/Bin/libexpat.lib -DEXPAT_INCLUDE_DIR=e:/SvnDeps/expat/Source/lib -DAPU_HAVE_CRYPTO=ON -DOPENSSL_ROOT_DIR=e:/SvnDeps/openssl ../apr-util
ninja
ninja install
```
## Build ZLib
```bat
cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=e:/SvnDeps/zlib -DCMAKE_BUILD_TYPE=RELEASE ..
```
## Build Openssl
```
Install https://strawberryperl.com/
Install https://www.nasm.us/ https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/win64/nasm-2.16.03-installer-x64.exe
perl Configure VC-WIN64A --prefix=e:/SvnDeps/openssl --openssldir=e:/SvnDeps/openssl
nmake
nmake install
```
## Build serf
```
scons APR=e:/SvnDeps/apr APU=e:/SvnDeps/apr-util ZLIB=e:/SvnDeps/zlib OPENSSL=e:/SvnDeps/openssl SOURCE_LAYOUT=0 TARGET_ARCH=X64 MSVC_VERSION=2022 PREFIX=e:/SvnDeps/serf
-and patch file SConstruct
```
## Build subversion
```bat
cmake -G "Ninja" ^
-DCMAKE_LIBRARY_PATH=e:/SvnDeps/apr;e:/SvnDeps/serf;e:/SvnDeps/zlib -DCMAKE_PREFIX_PATH=e:/SvnDeps/apr;e:/SvnDeps/serf;e:/SvnDeps/zlib ^
-DPC_EXPAT_LIBRARY_DIRS=e:/SvnDeps/expat/Bin -DPC_EXPAT_INCLUDE_DIRS=e:/SvnDeps/expat/Source/lib ^
-DSVN_SQLITE_USE_AMALGAMATION=ON ^
-DSQLITE_AMALGAMATION_DIR=e:/SvnDeps/sqlite-amalgamation ^
-DCMAKE_BUILD_TYPE=RELEASE ^
-DSVN_ENABLE_RA_SERF=ON ^
-DOPENSSL_ROOT_DIR=e:/SvnDeps/openssl ^
-DSVN_ENABLE_SVNXX=ON ^
-DSVN_ENABLE_NLS=OFF ^
-DZLIB_USE_STATIC_LIBS=ON ^
-DCMAKE_INSTALL_PREFIX=e:/CustomSvnBuild ^
../subversion
```