diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..798281d --- /dev/null +++ b/Jenkinsfile @@ -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() + } + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..474a4de --- /dev/null +++ b/pom.xml @@ -0,0 +1,149 @@ + + 4.0.0 + it.cavallium + TransferBot + jar + 1.0-SNAPSHOT + + UTF-8 + 11 + 11 + + + + mchv-release + MCHV Release Apache Maven Packages + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot + MCHV Snapshot Apache Maven Packages + https://mvn.mchv.eu/repository/mchv-snapshot + + + + + org.openjfx + javafx-controls + 13 + + + org.openjfx + javafx-fxml + 13 + + + it.tdlight + tdlib-session-container + 4.0.0-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.4 + + true + 2 + true + true + transferapp + transferapp + hellozip + true + it.cavallium/it.cavallium.App + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.1.1 + + + jar-with-dependencies + + + + + assemble-all + package + + single + + + + + + + + \ No newline at end of file diff --git a/src/main/build/splash.bmp b/src/main/build/splash.bmp new file mode 100644 index 0000000..282c270 Binary files /dev/null and b/src/main/build/splash.bmp differ diff --git a/src/main/java/it/cavallium/App.java b/src/main/java/it/cavallium/App.java new file mode 100644 index 0000000..b2b297f --- /dev/null +++ b/src/main/java/it/cavallium/App.java @@ -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(); + } + +} \ No newline at end of file diff --git a/src/main/java/it/cavallium/PrimaryController.java b/src/main/java/it/cavallium/PrimaryController.java new file mode 100644 index 0000000..7359d3b --- /dev/null +++ b/src/main/java/it/cavallium/PrimaryController.java @@ -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"); + } +} diff --git a/src/main/java/it/cavallium/SecondaryController.java b/src/main/java/it/cavallium/SecondaryController.java new file mode 100644 index 0000000..a9ed1a0 --- /dev/null +++ b/src/main/java/it/cavallium/SecondaryController.java @@ -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"); + } +} \ No newline at end of file diff --git a/src/main/java/it/cavallium/transferbot/App.java b/src/main/java/it/cavallium/transferbot/App.java new file mode 100644 index 0000000..9ac9e7f --- /dev/null +++ b/src/main/java/it/cavallium/transferbot/App.java @@ -0,0 +1,8 @@ +package it.cavallium.transferbot; + +public class App { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/src/main/java/it/cavallium/transferbot/MainWindow.java b/src/main/java/it/cavallium/transferbot/MainWindow.java new file mode 100644 index 0000000..32cd96a --- /dev/null +++ b/src/main/java/it/cavallium/transferbot/MainWindow.java @@ -0,0 +1,2 @@ +package it.cavallium.transferbot;public class MainWindow { +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..c0233e2 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module it.cavallium { + requires javafx.controls; + requires javafx.fxml; + + opens it.cavallium to javafx.fxml; + exports it.cavallium; +} \ No newline at end of file diff --git a/src/main/resources/it/cavallium/primary.fxml b/src/main/resources/it/cavallium/primary.fxml new file mode 100644 index 0000000..de25c19 --- /dev/null +++ b/src/main/resources/it/cavallium/primary.fxml @@ -0,0 +1,16 @@ + + + + + + + + + +