From 84a827de40dc0f845d76a8e05694f54021e290df Mon Sep 17 00:00:00 2001 From: RPJosh Date: Fri, 6 Jan 2023 18:01:04 +0100 Subject: [PATCH] Add jenkinsfile --- .gitignore | 3 ++ .project | 20 ++++++------ Jenkinsfile | 32 +++++++++++++++++++ build.gradle | 15 +++++---- .../de/rpjosh/installer/InstallConfig.java | 20 ++++++++---- 5 files changed, 66 insertions(+), 24 deletions(-) create mode 100644 Jenkinsfile diff --git a/.gitignore b/.gitignore index 8f4abe9..f8ae77e 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ local.properties # Gradle .gradle + +# Space for private notes +/notes \ No newline at end of file diff --git a/.project b/.project index cdb9980..c69d3ee 100755 --- a/.project +++ b/.project @@ -21,15 +21,6 @@ org.eclipse.buildship.core.gradleprojectnature - - 0 - - 26 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-bin - - 0 @@ -40,7 +31,7 @@ - 1648988993992 + 0 30 @@ -48,5 +39,14 @@ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + 1672944921592 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6ab7b22 --- /dev/null +++ b/Jenkinsfile @@ -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}" + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0424bcd..8cdfa62 100644 --- a/build.gradle +++ b/build.gradle @@ -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') { diff --git a/src/main/java/de/rpjosh/installer/InstallConfig.java b/src/main/java/de/rpjosh/installer/InstallConfig.java index d64c933..3bb3869 100644 --- a/src/main/java/de/rpjosh/installer/InstallConfig.java +++ b/src/main/java/de/rpjosh/installer/InstallConfig.java @@ -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 to replace the location of the launch script - * @param serviceExecStartPost the commands to execute after the service has started. Use 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 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