Add jenkinsfile
Gitea/Java-Installer/pipeline/head This commit looks good Details

snapshot v1.0.2
Jonas Letzbor 2023-01-06 18:01:04 +01:00
parent 8549ec30b1
commit 84a827de40
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
5 changed files with 66 additions and 24 deletions

3
.gitignore vendored
View File

@ -68,3 +68,6 @@ local.properties
# Gradle
.gradle
# Space for private notes
/notes

View File

@ -21,15 +21,6 @@
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>0</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-bin</arguments>
</matcher>
</filter>
<filter>
<id>0</id>
<name></name>
@ -40,7 +31,7 @@
</matcher>
</filter>
<filter>
<id>1648988993992</id>
<id>0</id>
<name></name>
<type>30</type>
<matcher>
@ -48,5 +39,14 @@
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
<filter>
<id>1672944921592</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

32
Jenkinsfile vendored 100644
View File

@ -0,0 +1,32 @@
pipeline {
agent any
tools {
jdk '17'
}
stages {
stage('Build') {
steps {
sh './gradlew build publishToMavenLocal --warning-mode all'
}
}
}
post {
success {
archiveArtifacts artifacts: 'release/installer-*', fingerprint: true
}
// Clean after build
cleanup {
cleanWs()
}
failure {
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}

View File

@ -13,6 +13,11 @@ group = "de.rpjosh"
// ----- //
// Set correct encoding
compileJava.options.encoding = 'ISO-8859-1'
tasks.withType(Javadoc) {
options.encoding = 'ISO-8859-1'
}
sourceCompatibility = 11
targetCompatibility = 11
@ -44,6 +49,7 @@ task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
//sourceSets.main.resources { srcDirs = ["src/main/java"]; exclude "**/*.java" }
@ -66,13 +72,13 @@ artifacts {
// the created jar file will be copied automatically into the release directory
task copyJar(type: Copy) {
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/dist/installer-" + version + "-javadoc.jar"), file("$buildDir/dist/installer-" + version + "-sources.jar")
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
into file("$buildDir/../release")
}
// build the maven repo file structure -> Javadoc can be used easily in eclipse
task copyJarToMaven (type: Copy) {
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/dist/installer-" + version + "-javadoc.jar"), file("$buildDir/dist/installer-" + version + "-sources.jar")
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/libs/installer-" + version + "-javadoc.jar"), file("$buildDir/libs/installer-" + version + "-sources.jar")
into file("$buildDir/../release/mavenRepo/de/rpjosh/installer/" + version)
}
@ -120,17 +126,12 @@ repositories {
}
dependencies {
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
// https://mvnrepository.com/artifact/com.github.vatbub/mslinks
api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.2'
// https://mvnrepository.com/artifact/commons-io/commons-io
api group: 'commons-io', name: 'commons-io', version: '2.10.0'
}
tasks.named('jar') {

View File

@ -13,6 +13,9 @@ import java.util.Map;
import org.apache.commons.io.FileUtils;
/**
* Define configuration options for the installation
*/
public class InstallConfig {
private String company;
@ -122,7 +125,9 @@ public class InstallConfig {
this.applicationNameLong = applicationNameLong;
}
// Determine the operating system //
/**
* Specifies an operation system
*/
public enum OSType {
UNDETERMINED, WINDOWS, LINUX, MACOS
}
@ -184,7 +189,7 @@ public class InstallConfig {
*
* @param url the URL
* @param basicAuthUser [ the user for the basic auth ]
* @param basicAuthPassword [ the passwort for the basic auth ]
* @param basicAuthPassword [ the password for the basic auth ]
* @param askForBasicAuth when no basic auth credentials are given and the request gets a 401 response ask the user for credentials at the command line
*/
public void setDownloadURLForProgramm(String url, char[] basicAuthUser, char[] basicAuthPassword, boolean askForBasicAuth) {
@ -200,7 +205,7 @@ public class InstallConfig {
*
* @param url die URL (without file extension)
* @param basicAuthUser [ the user for the basic auth ]
* @param basicAuthPassword [ the passwort for the basic auth ]
* @param basicAuthPassword [ the password for the basic auth ]
* @param askForBasicAuth when no basic auth credentials are given and the request gets a 401 response ask the user for credentials at the command line
* @param end die file ending of the file (.jar)
*/
@ -236,7 +241,7 @@ public class InstallConfig {
* also an entry in the start menu will be created.
* - Linux: the desktop file will be registered into the start menu.
*
* The given picrute will be saved under the program directory under pics/desktop.png / pics/desktop.ico
* The given picture will be saved under the program directory under pics/desktop.png / pics/desktop.ico
*
* @param windowsICO [Windows] the path to the .ico file inside the jar file (resource/pic.ico). The optimum resolution is 256x256
* @param linuxPNG [Linux] the path of the .png file inside the jar file ...
@ -296,11 +301,12 @@ public class InstallConfig {
* @param serviceUser the user for the service
* @param serviceGroup the group for the service
* @param serviceEnvironment the environment variables to set
* @param serviceExecStartPre the commands to execute before the service starts. Use <LaunchScript> to replace the location of the launch script
* @param serviceExecStartPost the commands to execute after the service has started. Use <LaunchScript> to replace the location of the launch script
* @param serviceExecStartPre the commands to execute before the service starts. Use -{@literal <}LaunchScript-{@literal >} to replace it with the real location of the launch script
* @param serviceExecStartPost the commands to execute after the service has started. Use-{@literal <}LaunchScript-{@literal >} to replace the location of the launch script
* @param serviceTimeout the number of seconds which should been allowed to start / stop the service
* @param serviceType the type of the service -{@literal >} oneshot, simple, exec and forking
* @param serviceExecStart the start command. Please take in mind that only with the type "oneshot" multiple commands can be specified. Use <LaunchScript> to replace the location of the launch script
* @param serviceExecStart the start command. Please take in mind that only with the type "oneshot" multiple commands can be specified.
* Use -{@literal <}LaunchScript-{@literal >} to replace it with the real location of the launch script
* @param serviceExecStop the stop command. Use #LaunchScript# to replace the location of the launch script
* @param serviceRestart whether the service should been restarted when the execution failed -{@literal >} on-failure or always
* @param serviceRestartSec the number of seconds to wait between a restart