Skip to content

Commit 8e626f9

Browse files
committed
Re-enable support for deterministic pack
When enabled (the default for using via msbuild) deterministic pack sets all files timestamps to the value defined by the MSBuild property DeterminisiticPackTimestamp. If DeterminisiticPackTimestamp is not defined, then it uses the current UTC time. DeterminisiticPackTimestamp does not have a default value. See: NuGet/Home#8601
1 parent 8b3572f commit 8e626f9

31 files changed

Lines changed: 181 additions & 15 deletions

src/NuGet.Clients/NuGet.CommandLine/Commands/PackCommand.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ public Dictionary<string, string> Properties
103103
[Option(typeof(NuGetCommand), "PackageCommandConfigFile")]
104104
public new string ConfigFile { get; set; }
105105

106+
[Option(typeof(NuGetCommand), "PackageCommandDeterministic")]
107+
public bool Deterministic { get; set; }
108+
109+
[Option(typeof(NuGetCommand), "PackageCommandDeterministicTimestamp")]
110+
public string DeterministicTimestamp { get; set; }
111+
106112
public override void ExecuteCommand()
107113
{
108114
var packArgs = new PackArgs();
@@ -111,6 +117,8 @@ public override void ExecuteCommand()
111117
packArgs.OutputDirectory = OutputDirectory;
112118
packArgs.BasePath = BasePath;
113119
packArgs.MsBuildDirectory = new Lazy<string>(() => MsBuildUtility.GetMsBuildDirectoryFromMsBuildPath(MSBuildPath, MSBuildVersion, Console).Value.Path);
120+
packArgs.Deterministic = Deterministic;
121+
packArgs.DeterministicTimestamp = DeterministicTimestamp;
114122

115123
if (!string.IsNullOrEmpty(PackagesDirectory))
116124
{

src/NuGet.Clients/NuGet.CommandLine/NuGetCommand.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/NuGet.Clients/NuGet.CommandLine/NuGetCommand.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,9 @@ nuget trusted-signers Remove -Name TrustedRepo</value>
841841
<data name="PackageCommandDeterministic" xml:space="preserve">
842842
<value>Specify if the command should create a deterministic package. Multiple invocations of the pack command will create the exact same package.</value>
843843
</data>
844+
<data name="PackageCommandDeterministicTimestamp" xml:space="preserve">
845+
<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>
846+
</data>
844847
<data name="ClientCertificatesCommandFilePathDescription" xml:space="preserve">
845848
<value>Path to certificate file.</value>
846849
</data>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.cs.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<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>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<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>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.de.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<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>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Gibt mindestens ein Platzhaltermuster an, das beim Erstellen eines Pakets ausgeschlossen werden soll.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.es.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Especifique si el comando debe crear un paquete determinista. Varias invocaciones del comando pack crearán exactamente el mismo paquete.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Especifica uno o varios patrones de comodines que se excluirán al crear un paquete.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.fr.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<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>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Spécifie un ou plusieurs modèles à caractère générique à exclure durant la création d'un package.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.it.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Specificare se il comando deve creare un pacchetto deterministico. Le chiamate multiple del comando pack creeranno lo stesso pacchetto.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Specifica uno o più caratteri jolly da escludere durante la creazione di un pacchetto.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ja.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">コマンドで決定論的パッケージを作成する必要があるかどうかを指定します。パック コマンドを複数回呼び出すと、まったく同じパッケージが作成されます。</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">パッケージの作成時に除外する 1 つまたは複数のワイルドカード パターンを指定します。</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ko.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">명령이 결정적 패키지를 생성해야 하는지 여부를 지정합니다. pack 명령을 여러 번 호출하면 정확히 동일한 패키지가 생성됩니다.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<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>
606+
<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>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">패키지를 만들 때 제외할 와일드카드 패턴을 하나 이상 지정합니다.</target>

0 commit comments

Comments
 (0)