From ff68f18ac3f03587d2a654259eab17d1a02863d5 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Mon, 14 Aug 2023 17:58:57 +0200 Subject: [PATCH] Test drone builds. --- .dockerignore | 2 + .drone.yml | 44 ++++++++++++++++++++ README.md | 86 ++++++--------------------------------- build.gradle | 49 +++++++++++----------- docker/Dockerfile.deb-txt | 12 ++++++ docker/Dockerfile.rpm-txt | 14 +++++++ gradle.properties | 1 + 7 files changed, 110 insertions(+), 98 deletions(-) create mode 100644 .dockerignore create mode 100644 .drone.yml create mode 100644 docker/Dockerfile.deb-txt create mode 100644 docker/Dockerfile.rpm-txt create mode 100644 gradle.properties diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..20398ae --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.gradle diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..ebfa697 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,44 @@ +--- +kind: pipeline +name: default +type: docker + +#platform: +# os: linux +# arch: amd64 + + +steps: + + - name: test + image: docker.io/bellsoft/liberica-openjdk-debian:17 + commands: + - ./gradlew --quiet --no-daemon test + + + - name: build-deb + image: docker.io/debian:stable + environment: + AUTH_TOKEN: # Gitea access token ENV variable + from_secret: AUTH_TOKEN # Name of DroneCI secret exposed above + commands: + - apt-get install -y dpkg-dev unzip zip curl + - ./gradlew --quiet --no-daemon build jpackage + - for file in build/jpackage/*.{rpm,deb} ; do curl -s --user "$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done + when: + event: + - tag + + + - name: build-rpm + image: docker.io/almalinux:8 + environment: + AUTH_TOKEN: # Gitea access token ENV variable + from_secret: AUTH_TOKEN # Name of DroneCI secret exposed above + commands: + - dnf -y install unzip zip rpm-build + - ./gradlew --quiet --no-daemon build jpackage + - for file in build/jpackage/*.{rpm,deb} ; do curl -s --user "$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done + when: + event: + - tag diff --git a/README.md b/README.md index 9b3ccc9..69fa77a 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,34 @@ # mDNS Explorer -View all multicastDNS devices. +View all multicastDNS devices on your local network. ## Development Java SDK version 17 (or later) is required. -## Native Images - -The native images are built with GraalVM. -Download the Gluon version of GraalVM from https://github.com/gluonhq/graal/releases/tag/gluon-22.1.0.1-Final and extract it locally. - -Point the GRAALVM_HOME environment variable to the folder: - -```export GRAALVM_HOME="/path/to/gluon-22.1.0.1``` - -With all requirements setup and on a supported platform, the general idea is to run: +Information on how to build and package jftpd: ```shell -./gradlew clean build -./gradlew nativeBuild -Ptarget=android # or -Ptarget=ios -./gradlew nativeLink -Ptarget=android -./gradlew nativePackage -Ptarget=android -./gradlew nativeInstall -Ptarget=android -./gradlew nativeRun -Ptarget=android +./gradlew build jpackage ``` -or, in one go for Android: +### Windows -```shell -./gradlew -Ptarget=android clean build nativeBuild nativeLink nativePackage nativeInstall nativeRun -``` +Download and install +- Microsoft .NET Framework 3.5 +- Wix Toolset 3.11.2 (or later) -or, in one go for iOS: -```shell -./gradlew -Ptarget=ios clean build nativeBuild nativeLink nativePackage nativeInstall nativeRun -``` ### Linux -See https://docs.gluonhq.com/#prerequisites_linux +TODO -For nativeBuild on Linux, install the following dependencies. +docker build . -f docker/Dockerfile.rpm-txt -```shell -sudo apt install libgtk-3-dev libavformat-dev libavutil-dev libavcodec-dev libasound2-dev libpango1.0-dev libxtst-dev build-essential -``` +or -#### Building for Android (on Linux) - -See https://docs.gluonhq.com/#prerequisites_android - -Install Android Studio and use sdkmanager to install the following: - -- Android SDK Platform 31 -- NDK (Side by side) - -Point the ANDROID_NDK variable to the installed NDK directory: - -``` -export ANDROID_NDK="/home/mark/Android/Sdk/ndk/25.2.9519653/" -``` - -Add the platform-tools to you PATH to use 'adb' command: - - -``` -export PATH="$PATH:/home/mark/Android/Sdk/platform-tools/" -``` - -Run the 'adb devices' and 'adb usb' to verify your Android networkService is in development mode and allows connections. +docker build . -f docker/Dockerfile.deb-txt ### MacOS -See https://docs.gluonhq.com/#platforms_macos - -Install the xcode command line tools and an iPhone emulator. - -If you have problems with *xcrun* not being able to find *iphoneos*, try: - -```shell -sudo xcode-select --switch /Applications/Xcode.app -``` - -Download and install homebrew, and install the following: - -```shell -brew install maven -brew install --HEAD libusbmuxd -brew install --HEAD libimobiledevice -``` - -#### iOS (on MacOS) - -See https://docs.gluonhq.com/#prerequisites_ios +TODO diff --git a/build.gradle b/build.gradle index c5adeb8..3ad5d0e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,6 @@ plugins { + id 'java' + id 'groovy' id 'application' id 'org.openjfx.javafxplugin' version '0.0.14' id 'com.google.osdetector' version '1.7.3' @@ -14,19 +16,17 @@ import org.apache.tools.ant.filters.ReplaceTokens repositories { mavenCentral() mavenLocal() - maven { - url 'https://nexus.gluonhq.com/nexus/content/repositories/releases' - } } -version = "0.0.1" -mainClassName = "biz.nellemann.mdexpl.App" -application.mainModule = "biz.nellemann.mdexpl" - tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } +application { + mainModule = 'biz.nellemann.mdexpl' + mainClass = 'biz.nellemann.mdexpl.App' +} + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -106,21 +106,6 @@ gluonfx { }*/ -/* -shadowJar { - //archiveBaseName.set("vtd-poc-app") - //archiveClassifier.set('all') - archiveVersion.set("${System.env.BITBUCKET_BRANCH ?: 'dev' }") -}*/ - -//tasks.build.dependsOn tasks.shadowJar - -tasks.processResources { - filesMatching('**/configuration.properties') { - filter(ReplaceTokens, tokens: [copyright: '2023', version: System.env.BITBUCKET_BUILD_NUMBER ?: 'development' ]) - } -} - jlink { forceMerge 'slf4j' @@ -179,21 +164,37 @@ jlink { ] if (osdetector.release.isLike('debian')) { + // Requires 'dpkg-dev' installed installerType = 'deb' skipInstaller = false installerOptions += [ '--linux-deb-maintainer', 'mark.nellemann@gmail.com' ] - } else if (osdetector.release.isLike('centos')) { + } else if (osdetector.release.isLike('centos') or osdetector.release.isLike('suse')) { + // Requires 'rpm-build' installed installerType = 'rpm' skipInstaller = false installerOptions += [ '--linux-rpm-license-type', 'APACHE-20' ] } - } } } + +/* +shadowJar { + //archiveBaseName.set("vtd-poc-app") + //archiveClassifier.set('all') + archiveVersion.set("${System.env.BITBUCKET_BRANCH ?: 'dev' }") +}*/ + +//tasks.build.dependsOn tasks.shadowJar + +tasks.processResources { + filesMatching('**/configuration.properties') { + filter(ReplaceTokens, tokens: [copyright: '2023', version: System.env.BITBUCKET_BUILD_NUMBER ?: 'development' ]) + } +} diff --git a/docker/Dockerfile.deb-txt b/docker/Dockerfile.deb-txt new file mode 100644 index 0000000..02a4d86 --- /dev/null +++ b/docker/Dockerfile.deb-txt @@ -0,0 +1,12 @@ +FROM docker.io/debian:stable AS build + +RUN apt-get update && apt-get install -y unzip zip curl dpkg-dev +RUN bash -c "curl -s 'https://get.sdkman.io' | bash" +RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.8-zulu" + +COPY ./src /tmp/prj/src +COPY ./gradle /tmp/prj/gradle +COPY [ "gradlew", "build.gradle", "gradle.properties", "settings.gradle", "/tmp/prj/" ] + +WORKDIR /tmp/prj +RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && ./gradlew --no-daemon clean build jpackage" diff --git a/docker/Dockerfile.rpm-txt b/docker/Dockerfile.rpm-txt new file mode 100644 index 0000000..eb9213c --- /dev/null +++ b/docker/Dockerfile.rpm-txt @@ -0,0 +1,14 @@ +FROM docker.io/almalinux:8 AS build + +RUN dnf -y install unzip zip rpm-build +RUN sh -c "curl -s 'https://get.sdkman.io' | bash" +RUN sh -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.8-zulu" + +COPY ./src /tmp/prj/src +COPY ./gradle /tmp/prj/gradle +COPY [ "gradlew", "build.gradle", "gradle.properties", "settings.gradle", "/tmp/prj/" ] + +WORKDIR /tmp/prj +RUN sh -c "source $HOME/.sdkman/bin/sdkman-init.sh && ./gradlew --no-daemon clean build jpackage" + +COPY --from=build build/jpackage/* build/ diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..82348b2 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +version = 0.0.1