Skip to content

Commit

Permalink
Add a Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Dohbedoh authored Mar 28, 2018
2 parents 33009ae + c8317ee commit d420ddc
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 52 deletions.
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildPlugin()
40 changes: 3 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.30</version>
<relativePath />
</parent>

<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
</properties>

<artifactId>semantic-versioning-plugin</artifactId>
Expand All @@ -32,45 +34,9 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.106</version>
<configuration>
<pluginFirstClassLoader>true</pluginFirstClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>

<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.9</version>
</dependency>
</dependencies>

<developers>
<developer>
<id>ciroque</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Messages {
public static final String SEMANTIC_VERSION_COLUMN_DISPLAY_NAME = "Semantic Version";
public static final String UNKNOWN_VERSION = "Unknown";

public class Parsers {
public static class Parsers {
public static final String SBT_BUILD_SBT_PARSER = "SBT build.sbt parser";
public static final String MAVEN_POM_PARSER = "Maven Pom Parser";
public static final String SBT_BUILD_SCALA_PARSER = "SBT Build.scala Parser";
Expand All @@ -39,14 +39,14 @@ public class Parsers {
public static final String COMPOSER_JSON_PARSER = "Composer composer.json Parser";
}

public class ColumnDisplayStrategies {
public static class ColumnDisplayStrategies {
public static final String LAST_JENKINS_BUILD_NUMBER_STRATEGY = "Show Last Jenkins Build Number";
public static final String LAST_SUCCESSFUL_JENKINS_BUILD_NUMBER_STRATEGY = "Show Last Successful Jenkins Build Number";
public static final String LAST_SUCCESSFUL_BUILD_VERSION_STRATEGY = "Show Last Successful Semantic Version";
public static final String NA_STRATEGY = "Show 'N/A'";
}

public class NamingStrategies {
public static class NamingStrategies {
public static final String NOOP_NAMING = "none";
public static final String MAVEN_RELEASE_DEVELOPMENT = "Maven, release and development version";
public static final String UNTOUCHED = "As found";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class SemanticVersionColumn extends ListViewColumn {
@DataBoundConstructor
public SemanticVersionColumn(String displayStrategyName) {
try {
this.displayStrategy = (ColumnDisplayStrategy) Jenkins.getInstance().getExtensionList(displayStrategyName).iterator().next();
this.displayStrategy = (ColumnDisplayStrategy) Jenkins.getActiveInstance().getExtensionList(displayStrategyName).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public SemanticVersioningBuilder(String parser, String namingStrategy, boolean u
this.useJenkinsBuildNumber = useJenkinsBuildNumber;
this.envVariable = envVariable;
try {
this.parser = (BuildDefinitionParser) Jenkins.getInstance().getExtensionList(parser).iterator().next();
this.parser = (BuildDefinitionParser) Jenkins.getActiveInstance().getExtensionList(parser).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.namingStrategy = (NamingStrategy) Jenkins.getInstance().getExtensionList(namingStrategy).iterator().next();
this.namingStrategy = (NamingStrategy) Jenkins.getActiveInstance().getExtensionList(namingStrategy).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
this.namingStrategy = new NoopNamingStrategy();
Expand Down Expand Up @@ -182,7 +182,7 @@ public SemanticVersioningBuilderDescriptor() {
*/
public ListBoxModel doFillParserItems() {
ListBoxModel parsersModel = new ListBoxModel();
for (BuildDefinitionParser parser : Jenkins.getInstance()
for (BuildDefinitionParser parser : Jenkins.getActiveInstance()
.getExtensionList(BuildDefinitionParser.class)) {
parsersModel.add(parser.getDescriptor().getDisplayName(), parser
.getClass().getCanonicalName());
Expand All @@ -192,7 +192,7 @@ public ListBoxModel doFillParserItems() {

public ListBoxModel doFillNamingStrategyItems() {
ListBoxModel namingStrategiesModel = new ListBoxModel();
for (NamingStrategy namingStrategy : Jenkins.getInstance()
for (NamingStrategy namingStrategy : Jenkins.getActiveInstance()
.getExtensionList(NamingStrategy.class)) {
namingStrategiesModel.add(namingStrategy.getDescriptor().getDisplayName(), namingStrategy.getClass().getCanonicalName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

public abstract class AbstractColumnDisplayStrategy extends ExtensionPoint implements ColumnDisplayStrategy {
public static ExtensionList<ColumnDisplayStrategy> getStrategies() {
return Jenkins.getInstance().getExtensionList(ColumnDisplayStrategy.class);
return Jenkins.getActiveInstance().getExtensionList(ColumnDisplayStrategy.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
*/

public abstract class AbstractBuildDefinitionParser extends ExtensionPoint implements BuildDefinitionParser, Serializable {
protected static Logger logger = Logger.getLogger(String.valueOf(AbstractBuildDefinitionParser.class));
static final Logger logger = Logger.getLogger(String.valueOf(AbstractBuildDefinitionParser.class));
public static ExtensionList<BuildDefinitionParser> getParsers() {
return Jenkins.getInstance().getExtensionList(BuildDefinitionParser.class);
return Jenkins.getActiveInstance().getExtensionList(BuildDefinitionParser.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.FilePath.FileCallable;
import hudson.maven.AbstractMavenBuild;
import hudson.maven.MavenModuleSet;
import hudson.model.AbstractBuild;
import hudson.model.Descriptor;
import hudson.remoting.VirtualChannel;

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/index.jelly
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!--
This view is used to render the installed plugins page.
-->
<?jelly escape-by-default='true'?>
<div>
Jenkins Plugin that generates a semantic version from a build definition file (SBT, POM, Bower, Scala.build). Includes a Dashboard column plugin that displays the semantic version of the last successful build.
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:f="/lib/form">
<f:entry title="Display Strategy (for unsuccessful previous builds)" field="displayStrategy">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Version Number Parser" field="parser">
<f:select />
Expand Down

0 comments on commit d420ddc

Please sign in to comment.