OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-ivy?expand=0&rev=92
193 lines
12 KiB
Diff
193 lines
12 KiB
Diff
--- a/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
|
|
+++ b/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
|
|
@@ -197,7 +197,7 @@ public class AntWorkspaceResolver extend
|
|
throw new RuntimeException("Unsupported file path : " + artifactFile, e);
|
|
}
|
|
|
|
- res.add(new DefaultArtifact(md.getModuleRevisionId(), new Date(), name, type, ext,
|
|
+ res.add(new DefaultArtifact(md.getModuleRevisionId(), System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), name, type, ext,
|
|
url, null));
|
|
}
|
|
|
|
--- a/src/java/org/apache/ivy/ant/IvyDeliver.java
|
|
+++ b/src/java/org/apache/ivy/ant/IvyDeliver.java
|
|
@@ -374,7 +374,7 @@ public class IvyDeliver extends IvyTask
|
|
if (revision == null) {
|
|
revision = Ivy.getWorkingRevision();
|
|
}
|
|
- Date pubdate = getPubDate(this.pubdate, new Date());
|
|
+ Date pubdate = getPubDate(this.pubdate, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
if (pubRevision == null) {
|
|
if (revision.startsWith("working@")) {
|
|
pubRevision = DateUtil.format(pubdate);
|
|
--- a/src/java/org/apache/ivy/ant/IvyPublish.java
|
|
+++ b/src/java/org/apache/ivy/ant/IvyPublish.java
|
|
@@ -273,7 +273,7 @@ public class IvyPublish extends IvyTask
|
|
if ("working".equals(revision)) {
|
|
revision = Ivy.getWorkingRevision();
|
|
}
|
|
- Date pubdate = getPubDate(this.pubdate, new Date());
|
|
+ Date pubdate = getPubDate(this.pubdate, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
if (pubRevision == null) {
|
|
if (revision.startsWith("working@")) {
|
|
pubRevision = DateUtil.format(pubdate);
|
|
--- a/src/java/org/apache/ivy/ant/IvyTask.java
|
|
+++ b/src/java/org/apache/ivy/ant/IvyTask.java
|
|
@@ -177,7 +177,7 @@ public abstract class IvyTask extends Ta
|
|
return def;
|
|
}
|
|
if ("now".equals(date.toLowerCase(Locale.US))) {
|
|
- return new Date();
|
|
+ return System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date();
|
|
}
|
|
try {
|
|
return DateUtil.parse(date);
|
|
--- a/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
|
|
+++ b/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
|
|
@@ -1472,7 +1472,7 @@ public class DefaultRepositoryCacheManag
|
|
}
|
|
|
|
private Artifact getDefaultMetadataArtifact(ModuleRevisionId mrid) {
|
|
- return new DefaultArtifact(mrid, new Date(), "metadata", "metadata", "ivy", true);
|
|
+ return new DefaultArtifact(mrid, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), "metadata", "metadata", "ivy", true);
|
|
}
|
|
|
|
// not used any more, but may be useful for finer grained locking when downloading artifacts
|
|
--- a/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
|
|
+++ b/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
|
|
@@ -61,7 +61,7 @@ public class DeliverOptions {
|
|
* @return a DeliverOptions instance ready to be used or customized
|
|
*/
|
|
public static DeliverOptions newInstance(IvySettings settings) {
|
|
- return new DeliverOptions(null, new Date(), new DefaultPublishingDRResolver(),
|
|
+ return new DeliverOptions(null, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), new DefaultPublishingDRResolver(),
|
|
settings.doValidate(), true, null);
|
|
}
|
|
|
|
--- a/src/java/org/apache/ivy/core/install/InstallEngine.java
|
|
+++ b/src/java/org/apache/ivy/core/install/InstallEngine.java
|
|
@@ -86,7 +86,7 @@ public class InstallEngine {
|
|
|
|
DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance(
|
|
"apache", "ivy-install", "1.0"), settings.getStatusManager().getDefaultStatus(),
|
|
- new Date());
|
|
+ System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
String resolveId = ResolveOptions.getDefaultResolveId(md);
|
|
md.addConfiguration(new Configuration("default"));
|
|
md.addConflictManager(new ModuleId(ExactPatternMatcher.ANY_EXPRESSION,
|
|
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
|
|
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
|
|
@@ -100,7 +100,7 @@ public class DefaultArtifact extends Abs
|
|
throw new NullPointerException("null arid not allowed");
|
|
}
|
|
if (publicationDate == null) {
|
|
- publicationDate = new Date();
|
|
+ publicationDate = System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date();
|
|
}
|
|
this.publicationDate = publicationDate;
|
|
this.arid = arid;
|
|
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
|
|
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
|
|
@@ -272,7 +272,7 @@ public class DefaultModuleDescriptor imp
|
|
this.resolvedRevId = id;
|
|
this.status = status;
|
|
this.publicationDate = pubDate;
|
|
- this.resolvedPublicationDate = publicationDate == null ? new Date() : publicationDate;
|
|
+ this.resolvedPublicationDate = publicationDate == null ? (System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date()) : publicationDate;
|
|
this.isDefault = isDefault;
|
|
this.parser = XmlModuleDescriptorParser.getInstance();
|
|
}
|
|
@@ -308,7 +308,7 @@ public class DefaultModuleDescriptor imp
|
|
public void setPublicationDate(Date publicationDate) {
|
|
this.publicationDate = publicationDate;
|
|
if (resolvedPublicationDate == null) {
|
|
- resolvedPublicationDate = publicationDate == null ? new Date() : publicationDate;
|
|
+ resolvedPublicationDate = publicationDate == null ? (System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date()) : publicationDate;
|
|
}
|
|
}
|
|
|
|
--- a/src/java/org/apache/ivy/core/publish/PublishEngine.java
|
|
+++ b/src/java/org/apache/ivy/core/publish/PublishEngine.java
|
|
@@ -102,7 +102,7 @@ public class PublishEngine {
|
|
ModuleDescriptor md = null;
|
|
if (options.getSrcIvyPattern() != null) {
|
|
File ivyFile = settings.resolveFile(IvyPatternHelper.substitute(
|
|
- options.getSrcIvyPattern(), DefaultArtifact.newIvyArtifact(pubmrid, new Date())));
|
|
+ options.getSrcIvyPattern(), DefaultArtifact.newIvyArtifact(pubmrid, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date())));
|
|
if (!ivyFile.exists()) {
|
|
throw new IllegalArgumentException("ivy file to publish not found for " + mrid
|
|
+ ": call deliver before (" + ivyFile + ")");
|
|
@@ -132,7 +132,7 @@ public class PublishEngine {
|
|
: options.getStatus())
|
|
.setRevision(options.getPubrevision())
|
|
.setBranch(options.getPubBranch())
|
|
- .setPubdate(options.getPubdate() == null ? new Date()
|
|
+ .setPubdate(options.getPubdate() == null ? (System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date())
|
|
: options.getPubdate())
|
|
.setMerge(options.isMerge())
|
|
.setMergedDescriptor(md)
|
|
--- a/src/java/org/apache/ivy/core/report/ResolveReport.java
|
|
+++ b/src/java/org/apache/ivy/core/report/ResolveReport.java
|
|
@@ -360,7 +360,7 @@ public class ResolveReport {
|
|
|
|
public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, List<ModuleId> midToKeep) {
|
|
DefaultModuleDescriptor fixedmd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
|
|
- md.getStatus(), new Date());
|
|
+ md.getStatus(), System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
|
|
// copy namespaces
|
|
for (Map.Entry<String, String> ns : md.getExtraAttributesNamespaces().entrySet()) {
|
|
--- a/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
|
|
+++ b/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
|
|
@@ -572,7 +572,7 @@ public class ResolveEngine {
|
|
try {
|
|
options.setConfs(confs);
|
|
|
|
- Date reportDate = new Date();
|
|
+ Date reportDate = System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date();
|
|
ResolveData data = context.getResolveData();
|
|
if (data == null) {
|
|
data = new ResolveData(this, options);
|
|
--- a/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
|
|
+++ b/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
|
|
@@ -93,7 +93,7 @@ public class BundleInfoAdapter {
|
|
md.addExtraAttributeNamespace("o", Ivy.getIvyHomeURL() + "osgi");
|
|
ModuleRevisionId mrid = asMrid(BundleInfo.BUNDLE_TYPE, bundle.getSymbolicName(),
|
|
bundle.getVersion());
|
|
- md.setResolvedPublicationDate(new Date());
|
|
+ md.setResolvedPublicationDate(System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
md.setModuleRevisionId(mrid);
|
|
|
|
md.addConfiguration(CONF_DEFAULT);
|
|
--- a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
|
|
+++ b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
|
|
@@ -201,7 +201,7 @@ public abstract class AbstractOSGiResolv
|
|
Collections.singletonMap(CAPABILITY_EXTRA_ATTR, md.getModuleRevisionId().toString()));
|
|
|
|
DefaultModuleDescriptor capabilityMd = new DefaultModuleDescriptor(capabilityRev,
|
|
- getSettings().getStatusManager().getDefaultStatus(), new Date());
|
|
+ getSettings().getStatusManager().getDefaultStatus(), System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date());
|
|
|
|
String useConf = BundleInfoAdapter.CONF_USE_PREFIX + dd.getDependencyRevisionId().getName();
|
|
|
|
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
|
|
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
|
|
@@ -249,7 +249,7 @@ public class PomModuleDescriptorBuilder
|
|
DependencyResolver resolver = parserSettings.getResolver(mrid);
|
|
|
|
if (resolver != null) {
|
|
- DefaultArtifact artifact = new DefaultArtifact(mrid, new Date(), artifactId, "jar",
|
|
+ DefaultArtifact artifact = new DefaultArtifact(mrid, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), artifactId, "jar",
|
|
"jar");
|
|
ArtifactOrigin artifactOrigin = resolver.locate(artifact);
|
|
|
|
@@ -268,7 +268,7 @@ public class PomModuleDescriptorBuilder
|
|
ext = packaging;
|
|
}
|
|
|
|
- mainArtifact = new DefaultArtifact(mrid, new Date(), artifactId, packaging, ext);
|
|
+ mainArtifact = new DefaultArtifact(mrid, System.getenv("SOURCE_DATE_EPOCH") != null ? new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))) : new Date(), artifactId, packaging, ext);
|
|
ivyModuleDescriptor.addArtifact("master", mainArtifact);
|
|
}
|
|
|