Skip to content

Commit

Permalink
Revert JENKINS-20679 (jenkins-infra#591)
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/io/jenkins/update_center/Main.java
#	src/main/java/io/jenkins/update_center/PluginUpdateCenterEntry.java
  • Loading branch information
basil authored and nfalco79 committed Aug 12, 2022
1 parent f7d9182 commit 45a255c
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 358 deletions.
8 changes: 0 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,3 @@ Once update site JSON files are generated, configure Jenkins to download them in
Either set up a local HTTP server so the URL would be something like `+http://localhost:8000/update-center.json+`, or specify a `file://` URL like `+file:///Users/yourname/git/update-center2/www2/update-center.json+`

NOTE: For historical reason, the configured URL points to `update-center.json`, but the file actually downloaded by Jenkins (at least up to 2.235 as of this writing) is `update-center.json.html`.

=== Filtering Java versions

The `--java-version <version>` CLI argument can be used to filter plugins based on their minimum Java version requirement.
By default such filtering happens based on the `Minimum-Java-Version` manifest entry provided in Plugin HPIs starting from https://github.com/jenkinsci/maven-hpi-plugin#30-2018-12-05[Maven HPI Plugin 3.0] and https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md#329[Plugin POM 3.29].

Plugin HPIs without `Minimum-Java-Version` will be accepted by default.
If you want to create an update center for old Java, use the `--limit-plugin-core-dependency` option to set the filter for core dependencies in plugins.
18 changes: 0 additions & 18 deletions src/main/java/io/jenkins/update_center/HPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.alibaba.fastjson.annotation.JSONField;
import com.google.common.annotations.VisibleForTesting;
import hudson.util.VersionNumber;
import io.jenkins.update_center.util.JavaSpecificationVersion;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
Expand All @@ -44,7 +43,6 @@
import org.owasp.html.Sanitizers;
import org.xml.sax.SAXException;

import javax.annotation.CheckForNull;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -112,22 +110,6 @@ public String getCompatibleSinceVersion() throws IOException {
return getManifestAttributes().getValue("Compatible-Since-Version");
}

/**
* Gets Minimum Java Version required by the plugin.
* This uses the value of the {@code Minimum-Java-Version} manifest entry
* @return Minimum Java Version or {@code null} if it is unknown
* @throws IOException Manifest read error
*/
@CheckForNull
public JavaSpecificationVersion getMinimumJavaVersion() throws IOException {
String manifestEntry = getManifestAttributes().getValue("Minimum-Java-Version");
if (StringUtils.isNotBlank(manifestEntry)) {
return new JavaSpecificationVersion(manifestEntry);
}

return null;
}

public List<Dependency> getDependencies() throws IOException {
String deps = getManifestAttributes().getValue("Plugin-Dependencies");
if(deps==null) return Collections.emptyList();
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/io/jenkins/update_center/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

import io.jenkins.update_center.filters.JavaVersionPluginFilter;
import io.jenkins.update_center.json.PluginVersionsRoot;
import io.jenkins.update_center.json.ReleaseHistoryRoot;
import io.jenkins.update_center.json.UpdateCenterRoot;
import io.jenkins.update_center.util.JavaSpecificationVersion;
import io.jenkins.update_center.wrappers.FilteringRepository;
import io.jenkins.update_center.wrappers.TruncatedMavenRepository;
import io.jenkins.update_center.wrappers.AllowedArtifactsListMavenRepository;
import org.kohsuke.args4j.ClassParser;
Expand Down Expand Up @@ -100,9 +97,6 @@ public class Main {
@Option(name = "--with-experimental", usage = "Include experimental alpha/beta releases")
public boolean includeExperimental;

@Option(name = "--java-version", usage = "Target Java version for the update center. Plugins will be excluded if their minimum Java version does not match. If not set, required Java version will be ignored")
@CheckForNull public String javaVersion;

@Option(name = "--max-plugins", usage = "For testing purposes: Limit the number of plugins included to the specified number.")
@CheckForNull public Integer maxPlugins;

Expand Down Expand Up @@ -369,9 +363,6 @@ private MavenRepository createRepository() throws Exception {
VersionNumber vc = capCore == null ? null : new VersionNumber(capCore);
repo = new VersionCappedMavenRepository(vp, vc).withBaseRepository(repo);
}
if (javaVersion != null) {
repo = new FilteringRepository().withPluginFilter(new JavaVersionPluginFilter(new JavaSpecificationVersion(this.javaVersion))).withBaseRepository(repo);
}
return repo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.alibaba.fastjson.annotation.JSONField;
import hudson.util.VersionNumber;
import io.jenkins.update_center.util.Environment;
import io.jenkins.update_center.util.JavaSpecificationVersion;

import javax.annotation.CheckForNull;
import java.io.IOException;
Expand Down Expand Up @@ -132,11 +131,6 @@ public String getCompatibleSinceVersion() throws IOException {
return latestOffered.getCompatibleSinceVersion();
}

public String getMinimumJavaVersion() throws IOException {
final JavaSpecificationVersion minimumJavaVersion = latestOffered.getMinimumJavaVersion();
return minimumJavaVersion == null ? null : minimumJavaVersion.toString();
}

public String getBuildDate() throws IOException {
return latestOffered.getTimestampAsString();
}
Expand Down

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions src/test/java/ListPluginsAndVersionsJava6.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 45a255c

Please sign in to comment.