Update Jenkinsfile, pom.xml, and 7 more files...

This commit is contained in:
Andrea Cavalli 2020-10-15 13:00:03 +02:00
parent f63a739139
commit 0831c727a2
11 changed files with 332 additions and 0 deletions

72
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env groovy
// see https://jenkins.io/doc/book/pipeline/syntax/
pipeline {
environment {
MVN_SET = credentials('maven_settings')
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
}
agent any
options {
timestamps()
ansiColor("xterm")
}
parameters {
booleanParam(name: "RELEASE",
description: "Build a release from current commit.",
defaultValue: false)
}
stages {
stage("Setup workspace") {
agent none
steps {
sh "mkdir -p \"/var/jenkins_cache/.m2\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\""
sh "mkdir -p \"/var/jenkins_cache/.ccache\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\""
}
}
stage("Build & Deploy SNAPSHOT") {
agent {
docker {
image 'maven:3.6.3-openjdk-15'
args '-v $HOME:/var/maven'
reuseNode true
}
}
steps {
sh "mvn -s $MVN_SET -B clean package javafx:jlink"
sh "jpackage --name transferapp --runtime-image target/transferapp -m it.cavallium/it.cavallium.App -d target/package"
}
}
stage("Release") {
agent {
docker {
image 'maven:3.6.3-openjdk-15'
args '-v $HOME:/var/maven'
reuseNode true
}
}
when {
expression { params.RELEASE }
}
steps {
sh "git config user.email \"jenkins@mchv.eu\""
sh "git config user.name \"Jenkins\""
sh "cd ${workspace}"
sh "git add --all || true"
sh "git commit -m \"Add generated files\" || true"
sh "mvn -B -s $MVN_SET -Drevision=${BUILD_NUMBER} clean package javafx:jlink"
sh "jpackage --name transferapp --runtime-image target/transferapp -m it.cavallium/it.cavallium.App -d target/package"
}
}
}
post {
always {
/* clean up directory */
deleteDir()
}
}
}

149
pom.xml Normal file
View File

@ -0,0 +1,149 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.cavallium</groupId>
<artifactId>TransferBot</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>mchv-release</id>
<name>MCHV Release Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<repository>
<id>mchv-snapshot</id>
<name>MCHV Snapshot Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>it.tdlight</groupId>
<artifactId>tdlib-session-container</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<stripDebug>true</stripDebug>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<noManPages>true</noManPages>
<launcher>transferapp</launcher>
<jlinkImageName>transferapp</jlinkImageName>
<jlinkZipName>hellozip</jlinkZipName>
<jlinkVerbose>true</jlinkVerbose>
<mainClass>it.cavallium/it.cavallium.App</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-gui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/TransferBot-1.0-SNAPSHOT-jar-with-dependencies.jar</jar>
<outfile>${project.build.directory}/transfer-bot.exe</outfile>
<classPath>
<mainClass>it.cavallium.App</mainClass>
<addDependencies>true</addDependencies>
<preCp>anything</preCp>
</classPath>
<errTitle/>
<cmdLine/>
<chdir/>
<priority>normal</priority>
<downloadUrl>https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.8_10.msi</downloadUrl>
<supportUrl/>
<stayAlive>false</stayAlive>
<manifest/>
<icon/>
<jre>
<path/>
<minVersion>11</minVersion>
<maxVersion/>
<jdkPreference>preferJre</jdkPreference>
<initialHeapSize>256</initialHeapSize>
<maxHeapSize>3000</maxHeapSize>
</jre>
<splash>
<file>${project.basedir}/src/main/build/splash.bmp</file>
<waitForWindow>true</waitForWindow>
<timeout>60</timeout>
<timeoutErr>true</timeoutErr>
</splash>
<versionInfo>
<fileVersion>0.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>Transfer bot</fileDescription>
<copyright>Cavallium 2020</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>Transfer Bot</productName>
<companyName>WARP</companyName>
<internalName>transferbot</internalName>
<originalFilename>transfer-bot.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
</project>

BIN
src/main/build/splash.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,38 @@
package it.cavallium;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
/**
* JavaFX App
*/
public class App extends Application {
private static Scene scene;
@Override
public void start(Stage stage) throws IOException {
scene = new Scene(loadFXML("primary"), 640, 480);
stage.setScene(scene);
stage.show();
}
static void setRoot(String fxml) throws IOException {
scene.setRoot(loadFXML(fxml));
}
private static Parent loadFXML(String fxml) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
return fxmlLoader.load();
}
public static void main(String[] args) {
launch();
}
}

View File

@ -0,0 +1,12 @@
package it.cavallium;
import java.io.IOException;
import javafx.fxml.FXML;
public class PrimaryController {
@FXML
private void switchToSecondary() throws IOException {
App.setRoot("secondary");
}
}

View File

@ -0,0 +1,12 @@
package it.cavallium;
import java.io.IOException;
import javafx.fxml.FXML;
public class SecondaryController {
@FXML
private void switchToPrimary() throws IOException {
App.setRoot("primary");
}
}

View File

@ -0,0 +1,8 @@
package it.cavallium.transferbot;
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@ -0,0 +1,2 @@
package it.cavallium.transferbot;public class MainWindow {
}

View File

@ -0,0 +1,7 @@
module it.cavallium {
requires javafx.controls;
requires javafx.fxml;
opens it.cavallium to javafx.fxml;
exports it.cavallium;
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="it.cavallium.PrimaryController">
<children>
<Label text="Primary View" />
<Button fx:id="primaryButton" text="Switch to Secondary View" onAction="#switchToSecondary"/>
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="it.cavallium.SecondaryController">
<children>
<Label text="Secondary View" />
<Button fx:id="secondaryButton" text="Switch to Primary View" onAction="#switchToPrimary" />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>