Tue Dec 27 16:14:04 2022 UTC ()
Add gng, a tool to run (or create) each project's own Gradle wrapper.

GNG is a script that automatically search your gradlew when you are
inside your Gradle project and execute it. It also contains an official
Gradle wrapper. You can create gradle projects from scratch without
installing Gradle.

This is originally inspired by gdub and gradlew-bootstrap.


(schmonz)
diff -r0 -r1.1 pkgsrc/devel/gng/DESCR
diff -r0 -r1.1 pkgsrc/devel/gng/Makefile
diff -r0 -r1.1 pkgsrc/devel/gng/PLIST
diff -r0 -r1.1 pkgsrc/devel/gng/distinfo
diff -r0 -r1.1 pkgsrc/devel/gng/patches/patch-bin_gng

File Added: pkgsrc/devel/gng/DESCR
GNG is a script that automatically search your gradlew when you are
inside your Gradle project and execute it. It also contains an official
Gradle wrapper. You can create gradle projects from scratch without
installing Gradle.

This is originally inspired by gdub and gradlew-bootstrap.

File Added: pkgsrc/devel/gng/Makefile
# $NetBSD: Makefile,v 1.1 2022/12/27 16:14:03 schmonz Exp $

DISTNAME=		gng-1.0.3
CATEGORIES=		devel
MASTER_SITES=		${MASTER_SITE_GITHUB:=gdubw/}
GITHUB_TAG=		v${PKGVERSION_NOREV}

MAINTAINER=		schmonz@NetBSD.org
HOMEPAGE=		https://gng.dsun.org
COMMENT=		Run (or create) each project's own Gradle wrapper
LICENSE=		apache-2.0

USE_LANGUAGES=		# none
USE_TOOLS+=		bash:run
NO_BUILD=		yes
REPLACE_BASH=		bin/gng
REPLACE_SH=		gradle/gradlew

SUBST_CLASSES+=		paths
SUBST_STAGE.paths=	do-configure
SUBST_FILES.paths=	bin/gng
SUBST_VARS.paths=	PREFIX

INSTALLATION_DIRS=	bin share/${PKGBASE}/gradle/wrapper

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/bin/gng \
		${DESTDIR}${PREFIX}/bin/gng
	${LN} -fs gng ${DESTDIR}${PREFIX}/bin/gw
	${INSTALL_DATA} ${WRKSRC}/lib/common.sh \
		${DESTDIR}${PREFIX}/share/${PKGBASE}
	${INSTALL_DATA} ${WRKSRC}/gradle/README.md \
		${DESTDIR}${PREFIX}/share/${PKGBASE}/gradle
	${INSTALL_DATA} ${WRKSRC}/gradle/gng.cfg \
		${DESTDIR}${PREFIX}/share/${PKGBASE}/gradle
	${INSTALL_PROGRAM} ${WRKSRC}/gradle/gradlew \
		${DESTDIR}${PREFIX}/share/${PKGBASE}/gradle
	${INSTALL_DATA} ${WRKSRC}/gradle/gradlew.bat \
		${DESTDIR}${PREFIX}/share/${PKGBASE}/gradle
	${INSTALL_DATA} ${WRKSRC}/gradle/wrapper/gradle-wrapper.jar \
		${DESTDIR}${PREFIX}/share/${PKGBASE}/gradle/wrapper

.include "../../mk/bsd.pkg.mk"

File Added: pkgsrc/devel/gng/PLIST
@comment $NetBSD: PLIST,v 1.1 2022/12/27 16:14:03 schmonz Exp $
bin/gng
bin/gw
share/gng/common.sh
share/gng/gradle/README.md
share/gng/gradle/gng.cfg
share/gng/gradle/gradlew
share/gng/gradle/gradlew.bat
share/gng/gradle/wrapper/gradle-wrapper.jar

File Added: pkgsrc/devel/gng/distinfo
$NetBSD: distinfo,v 1.1 2022/12/27 16:14:03 schmonz Exp $

BLAKE2s (gng-1.0.3.tar.gz) = fc1c172998c0da64f8817c88dba8f696c05da8a464abb5add6d47eae0e9c617b
SHA512 (gng-1.0.3.tar.gz) = a40be62d8deae070a5c5d342c4d510a78712657414d4dec4016becd7fb23436e6b344faf3917f7c1aa478c06a87ebbdd6541afea2fe8c035f8044f6d15af4855
Size (gng-1.0.3.tar.gz) = 71089 bytes
SHA1 (patch-bin_gng) = b9d5118c826931e1e3f7ecbb798c8cc0593e2939

File Added: pkgsrc/devel/gng/patches/patch-bin_gng
$NetBSD: patch-bin_gng,v 1.1 2022/12/27 16:14:03 schmonz Exp $

Use pkgsrc paths.

--- bin/gng.orig	2021-03-29 06:32:44.000000000 +0000
+++ bin/gng
@@ -1,24 +1,15 @@
 #!/usr/bin/env bash
+
+PREFIX=@PREFIX@
+
 readonly SAVED_OPTS="$(
   shopt -po
   shopt -p
 )"
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
-  TARGET="$(readlink "$SOURCE")"
-  if [[ $TARGET == /* ]]; then
-    SOURCE="$TARGET"
-  else
-    SELF_DIR="$(dirname "$SOURCE")"
-    SOURCE="$SELF_DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-  fi
-done
-SELF_DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
-readonly SELF_DIR
 
 # shellcheck disable=SC1090
-source "${SELF_DIR}/../lib/common.sh" || {
-  echo "Failed to load common.sh in ${SELF_DIR}"
+source "${PREFIX}/share/gng/common.sh" || {
+  echo "Failed to load ${PREFIX}/share/gng/common.sh"
   exit 1
 }
 # DEFAULTS may be overridden by calling environment.
@@ -78,7 +69,7 @@ function __install_gw() {
     info "Installing Gradle Wrapper in ${dir}. (version=${version}, distributionType=${type}, mirrorUrl=${mirrorUrl:-<Not Specified>})"
 
     #Copy the embedded Gradle Wrapper
-    local srcDir="${SELF_DIR}/.."
+    local srcDir="${PREFIX}/share/gng"
     cp -f "${srcDir}/gradle/gng.cfg" "${dir}/gradle/"
     cp -f "${srcDir}/gradle/gradlew" "${dir}/"
     cp -f "${srcDir}/gradle/gradlew.bat" "${dir}/"