Skip to content

Commit

Permalink
Make Nuspec path platform independent
Browse files Browse the repository at this point in the history
When I run build on Linux, paths was changed.
In Nuspec by convention prefered to always use `\`.
Without that change I have noise after running build.
  • Loading branch information
kant2002 committed May 19, 2022
1 parent 5da3018 commit 2c9fa7d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions gen_lib_nuspecs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ string arch
{
var dir_name = lib.AsString_basename_in_cb();
var lib_name = lib.AsString_libname_in_cb(LibSuffix.DLL);
return Path.Combine("$cb_bin_path$", dir_name, "win", toolset, flavor, arch, lib_name);
return nuget_path_combine("$cb_bin_path$", dir_name, "win", toolset, flavor, arch, lib_name);
}

static string make_cb_path_linux(
Expand All @@ -240,7 +240,7 @@ string cpu
{
var dir_name = lib.AsString_basename_in_cb();
var lib_name = lib.AsString_libname_in_cb(LibSuffix.SO);
return Path.Combine("$cb_bin_path$", dir_name, "linux", cpu, lib_name);
return nuget_path_combine("$cb_bin_path$", dir_name, "linux", cpu, lib_name);
}

static string make_cb_path_wasm(
Expand All @@ -249,7 +249,7 @@ WhichLib lib
{
var dir_name = lib.AsString_basename_in_cb();
var lib_name = lib.AsString_libname_in_cb(LibSuffix.A);
return Path.Combine("$cb_bin_path$", dir_name, "wasm", lib_name);
return nuget_path_combine("$cb_bin_path$", dir_name, "wasm", lib_name);
}

static string make_cb_path_mac(
Expand All @@ -259,7 +259,7 @@ string cpu
{
var dir_name = lib.AsString_basename_in_cb();
var lib_name = lib.AsString_libname_in_cb(LibSuffix.DYLIB);
return Path.Combine("$cb_bin_path$", dir_name, "mac", cpu, lib_name);
return nuget_path_combine("$cb_bin_path$", dir_name, "mac", cpu, lib_name);
}

static string make_cb_path_maccatalyst(
Expand All @@ -269,7 +269,7 @@ string cpu
{
var dir_name = lib.AsString_basename_in_cb();
var lib_name = lib.AsString_libname_in_cb(LibSuffix.DYLIB);
return Path.Combine("$cb_bin_path$", dir_name, "maccatalyst", cpu, lib_name);
return nuget_path_combine("$cb_bin_path$", dir_name, "maccatalyst", cpu, lib_name);
}

static void write_nuspec_file_entry_native_linux(
Expand Down Expand Up @@ -448,7 +448,7 @@ private static void gen_nuspec_lib_e_sqlite3(string dir_src)
var tname = string.Format("{0}.targets", id);
Directory.CreateDirectory(Path.Combine(dir_proj, "net461"));
var path_targets = Path.Combine(dir_proj, "net461", tname);
var relpath_targets = Path.Combine(".", "net461", tname);
var relpath_targets = nuget_path_combine(".", "net461", tname);
gen_nuget_targets(path_targets, WhichLib.E_SQLITE3);
common.write_nuspec_file_entry(
relpath_targets,
Expand All @@ -460,7 +460,7 @@ private static void gen_nuspec_lib_e_sqlite3(string dir_src)
var tname = string.Format("{0}.targets", id);
Directory.CreateDirectory(Path.Combine(dir_proj, "net6.0"));
var path_targets = Path.Combine(dir_proj, "net6.0", tname);
var relpath_targets = Path.Combine(".", "net6.0", tname);
var relpath_targets = nuget_path_combine(".", "net6.0", tname);
gen_nuget_targets_wasm(path_targets, WhichLib.E_SQLITE3);
common.write_nuspec_file_entry(
relpath_targets,
Expand All @@ -473,7 +473,7 @@ private static void gen_nuspec_lib_e_sqlite3(string dir_src)
var tname = string.Format("{0}.targets", id);
Directory.CreateDirectory(Path.Combine(dir_proj, "net6.0-maccatalyst"));
var path_targets = Path.Combine(dir_proj, "net6.0-maccatalyst", tname);
var relpath_targets = Path.Combine(".", "net6.0-maccatalyst", tname);
var relpath_targets = nuget_combine(".", "net6.0-maccatalyst", tname);
gen_nuget_targets_maccatalyst(path_targets, WhichLib.E_SQLITE3);
common.write_nuspec_file_entry(
relpath_targets,
Expand Down Expand Up @@ -527,7 +527,7 @@ private static void gen_nuspec_lib_e_sqlcipher(string dir_src)
var tname = string.Format("{0}.targets", id);
Directory.CreateDirectory(Path.Combine(dir_proj, "net461"));
var path_targets = Path.Combine(dir_proj, "net461", tname);
var relpath_targets = Path.Combine(".", "net461", tname);
var relpath_targets = nuget_path_combine(".", "net461", tname);
gen_nuget_targets(path_targets, WhichLib.E_SQLCIPHER);
common.write_nuspec_file_entry(
relpath_targets,
Expand All @@ -539,7 +539,7 @@ private static void gen_nuspec_lib_e_sqlcipher(string dir_src)
var tname = string.Format("{0}.targets", id);
Directory.CreateDirectory(Path.Combine(dir_proj, "net6.0"));
var path_targets = Path.Combine(dir_proj, "net6.0", tname);
var relpath_targets = Path.Combine(".", "net6.0", tname);
var relpath_targets = nuget_path_combine(".", "net6.0", tname);
gen_nuget_targets_wasm(path_targets, WhichLib.E_SQLCIPHER);
common.write_nuspec_file_entry(
relpath_targets,
Expand Down Expand Up @@ -683,6 +683,11 @@ private static void gen_nuget_targets_wasm(string dest, WhichLib lib)

}

private static string nuget_path_combine(params string[] paths)
{
return Path.Combine(paths).Replace('/', '\\');
}

#if not
private static void gen_nuget_targets_maccatalyst(string dest, WhichLib lib)
{
Expand Down

0 comments on commit 2c9fa7d

Please sign in to comment.