Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/Commands/PackCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public Dictionary<string, string> Properties
[Option(typeof(NuGetCommand), "PackageCommandConfigFile")]
public new string ConfigFile { get; set; }

[Option(typeof(NuGetCommand), "PackageCommandDeterministic")]
public bool Deterministic { get; set; }

[Option(typeof(NuGetCommand), "PackageCommandDeterministicTimestamp")]
public string DeterministicTimestamp { get; set; }

public override void ExecuteCommand()
{
var packArgs = new PackArgs();
Expand All @@ -111,6 +117,8 @@ public override void ExecuteCommand()
packArgs.OutputDirectory = OutputDirectory;
packArgs.BasePath = BasePath;
packArgs.MsBuildDirectory = new Lazy<string>(() => MsBuildUtility.GetMsBuildDirectoryFromMsBuildPath(MSBuildPath, MSBuildVersion, Console).Value.Path);
packArgs.Deterministic = Deterministic;
packArgs.DeterministicTimestamp = DeterministicTimestamp;

if (!string.IsNullOrEmpty(PackagesDirectory))
{
Expand Down
12 changes: 11 additions & 1 deletion src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class ProjectFactory : IProjectFactory, CoreV2.NuGet.IPropertyProvider, I

private IEnvironmentVariableReader _environmentVariableReader;

private bool _deterministic;
private string _deterministicTimestamp;

// Files we want to always exclude from the resulting package
private static readonly HashSet<string> ExcludeFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
NuGetConstants.PackageReferenceFile,
Expand Down Expand Up @@ -73,6 +76,8 @@ public static IProjectFactory ProjectCreator(PackArgs packArgs, string path)
{
return new ProjectFactory(packArgs.MsBuildDirectory.Value, path, packArgs.Properties)
{
_deterministic = packArgs.Deterministic,
_deterministicTimestamp = packArgs.DeterministicTimestamp,
IsTool = packArgs.Tool,
LogLevel = packArgs.LogLevel,
Logger = packArgs.Logger,
Expand Down Expand Up @@ -236,7 +241,11 @@ public PackageBuilder CreateBuilder(string basePath, NuGetVersion version, strin
}
}

builder = new PackageBuilder(false, Logger);
// TODO is deterministic-ness tied in here?
builder = new PackageBuilder(_deterministic, Logger)
{
DeterministicTimestamp = _deterministicTimestamp,
};

try
{
Expand Down Expand Up @@ -705,6 +714,7 @@ private PackageDependency CreateDependencyFromProject(dynamic project, Dictionar
projectFactory.ProjectProperties = ProjectProperties;
projectFactory.SymbolPackageFormat = SymbolPackageFormat;
projectFactory.BuildProject();
// TODO: does deterministicness matter here?
var builder = new PackageBuilder();

projectFactory.ExtractMetadata(builder);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/NuGetCommand.resx
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ nuget trusted-signers Remove -Name TrustedRepo</value>
<data name="PackageCommandDeterministic" xml:space="preserve">
<value>Specify if the command should create a deterministic package. Multiple invocations of the pack command will create the exact same package.</value>
</data>
<data name="PackageCommandDeterministicTimestamp" xml:space="preserve">
<value>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</value>
</data>
<data name="ClientCertificatesCommandFilePathDescription" xml:space="preserve">
<value>Path to certificate file.</value>
</data>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Určete, jestli má příkaz vytvořit deterministický balíček. Vícenásobné vyvolání příkazu pack vytvoří úplně stejný balíček.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Určuje nejméně jeden vzor zástupných znaků, který se má vyloučit při vytváření balíčku.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Geben Sie an, ob der Befehl ein deterministisches Paket erstellen soll. Durch mehrere Aufrufe des Paketbefehls wird genau dasselbe Paket erstellt.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Gibt mindestens ein Platzhaltermuster an, das beim Erstellen eines Pakets ausgeschlossen werden soll.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Especifique si el comando debe crear un paquete determinista. Varias invocaciones del comando pack crearán exactamente el mismo paquete.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Especifica uno o varios patrones de comodines que se excluirán al crear un paquete.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Spécifiez si la commande doit créer un package déterministe. Plusieurs appels de la commande pack créent exactement le même package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Spécifie un ou plusieurs modèles à caractère générique à exclure durant la création d'un package.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Specificare se il comando deve creare un pacchetto deterministico. Le chiamate multiple del comando pack creeranno lo stesso pacchetto.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Specifica uno o più caratteri jolly da escludere durante la creazione di un pacchetto.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">コマンドで決定論的パッケージを作成する必要があるかどうかを指定します。パック コマンドを複数回呼び出すと、まったく同じパッケージが作成されます。</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">パッケージの作成時に除外する 1 つまたは複数のワイルドカード パターンを指定します。</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">명령이 결정적 패키지를 생성해야 하는지 여부를 지정합니다. pack 명령을 여러 번 호출하면 정확히 동일한 패키지가 생성됩니다.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">패키지를 만들 때 제외할 와일드카드 패턴을 하나 이상 지정합니다.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Określ, czy polecenie powinno utworzyć pakiet deterministyczny. Wiele wywołań polecenia pakietu spowoduje utworzenie dokładnie tego samego pakietu.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Określa co najmniej jeden wzorzec symboli wieloznacznych do wykluczenia podczas tworzenia pakietu.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Especifique se o comando deve criar um pacote determinístico. Várias invocações do comando pack criarão exatamente o mesmo pacote.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Especifica um ou mais padrões de curinga a serem excluídos ao criar um pacote.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">Укажите, должна ли эта команда создавать детерминированный пакет. Если вызвать команду упаковки несколько раз, будет создаваться одинаковый пакет.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Задает шаблоны подстановочных знаков, которые нужно исключить при создании пакета.</target>
Expand Down
5 changes: 5 additions & 0 deletions src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Sürüm 2.1.0</target>
<target state="translated">Komutun belirleyici bir paket oluşturması gerekip gerekmediğini belirtin. Paket komutunun birden çok çağrısı aynı paketi oluşturur.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">Bir paket oluşturulurken hariç tutulacak bir veya daha fazla joker karakter desenini belirtir.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">指定命令是否应创建确定性包。多次调用包命令将创建完全相同的包。</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">创建包时指定一个或多个要排除的通配符模式。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
<target state="translated">指定命令是否應該建立確定性封裝。多次呼叫封裝命令將會建立完全相同的封裝。</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandDeterministicTimestamp">
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
<note />
</trans-unit>
<trans-unit id="PackageCommandExcludeDescription">
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
<target state="translated">指定一或多個在建立套件時要排除的萬用字元模式。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public interface IPackTaskRequest<TItem>
string PackageLicenseFile { get; }
string Readme { get; }
bool Deterministic { get; }
string DeterministicTimestamp { get; }
string PackageIcon { get; }
}
}
2 changes: 2 additions & 0 deletions src/NuGet.Core/NuGet.Build.Tasks.Pack/PackTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ internal PackTask(IEnvironmentVariableReader environmentVariableReader)
public string PackageLicenseExpressionVersion { get; set; }
public string Readme { get; set; }
public bool Deterministic { get; set; }
public string DeterministicTimestamp { get; set; }
public string PackageIcon { get; set; }
public ILogger Logger => new MSBuildLogger(Log);

Expand Down Expand Up @@ -225,6 +226,7 @@ private IPackTaskRequest<IMSBuildItem> GetRequest()
PackageLicenseExpressionVersion = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageLicenseExpressionVersion),
Readme = MSBuildStringUtility.TrimAndGetNullForEmpty(Readme),
Deterministic = Deterministic,
DeterministicTimestamp = MSBuildStringUtility.TrimAndGetNullForEmpty(DeterministicTimestamp),
PackageIcon = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageIcon),
};
}
Expand Down
Loading