Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #3 from jeffmaury/JENKINS-15197
[JENKINS-15197] Add support for Maven toolchains config files Thanks !
- Loading branch information
Showing
15 changed files
with
418 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/buildwrapper/CleanTempFilesAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
src/main/java/org/jenkinsci/plugins/configfiles/buildwrapper/CleanTempFilesRunListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/buildwrapper/ManagedFileUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/custom/CustomConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/groovy/GroovyScript.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/maven/GlobalMavenSettingsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenSettingsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenToolchainsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
The MIT License | ||
Copyright (c) 2011, Dominik Bartholdi, Olivier Lamy | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
package org.jenkinsci.plugins.configfiles.maven; | ||
|
||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
|
||
import hudson.Extension; | ||
import jenkins.model.Jenkins; | ||
|
||
import org.jenkinsci.lib.configprovider.AbstractConfigProviderImpl; | ||
import org.jenkinsci.lib.configprovider.model.Config; | ||
import org.jenkinsci.lib.configprovider.model.ContentType; | ||
import org.jenkinsci.plugins.configfiles.Messages; | ||
|
||
public class MavenToolchainsConfig extends Config { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public MavenToolchainsConfig(String id, String name, String comment, String content) { | ||
super(id, name, comment, content); | ||
} | ||
|
||
@Extension(ordinal = 180) | ||
public static class MavenToolchainsConfigProvider extends AbstractConfigProviderImpl { | ||
|
||
public MavenToolchainsConfigProvider() { | ||
load(); | ||
} | ||
|
||
@Override | ||
public ContentType getContentType() { | ||
return ContentType.DefinedType.XML; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return Messages.mvn_toolchains_provider_name(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.jenkinsci.lib.configprovider.AbstractConfigProviderImpl#getXmlFileName() | ||
*/ | ||
@Override | ||
protected String getXmlFileName() { | ||
return "maven-toolchains-files.xml"; | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.jenkinsci.lib.configprovider.AbstractConfigProviderImpl#newConfig() | ||
*/ | ||
@Override | ||
public Config newConfig() { | ||
String id = this.getProviderId() + System.currentTimeMillis(); | ||
return new Config(id, "MyToolchains", "", loadTemplateContent()); | ||
} | ||
|
||
private String loadTemplateContent() { | ||
String tpl; | ||
try { | ||
InputStream is = this.getClass().getResourceAsStream("toolchains-tpl.xml"); | ||
StringBuilder sb = new StringBuilder(Math.max(16, is.available())); | ||
char[] tmp = new char[4096]; | ||
|
||
try { | ||
InputStreamReader reader = new InputStreamReader(is, "UTF-8"); | ||
for (int cnt; (cnt = reader.read(tmp)) > 0;) | ||
sb.append(tmp, 0, cnt); | ||
|
||
} finally { | ||
is.close(); | ||
} | ||
tpl = sb.toString(); | ||
} catch (Exception e) { | ||
tpl = "<toolchains></toolchains>"; | ||
} | ||
return tpl; | ||
} | ||
|
||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jenkinsci/plugins/configfiles/xml/XmlConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...igfiles/maven/MavenToolchainsConfig/MavenToolchainsConfigProvider/newInstanceDetail.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
The MIT License | ||
Copyright (c) 2012, Dominik Bartholdi | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--> | ||
|
||
|
||
|
||
<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"> | ||
${%mvn_toolchains_provider_description} | ||
</j:jelly> |
24 changes: 24 additions & 0 deletions
24
...es/maven/MavenToolchainsConfig/MavenToolchainsConfigProvider/newInstanceDetail.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The MIT License | ||
# | ||
# Copyright (c) 2012, Dominik Bartholdi | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
mvn_toolchains_provider_description=a toolchains.xml which can be referenced within Apache Maven jobs | ||
|
Oops, something went wrong.