jd-gui: 1.5.0 build from source

This commit is contained in:
blshkv 2019-05-19 18:27:00 +08:00
parent 8999f4db5f
commit 85ac317a34
No known key found for this signature in database
GPG key ID: 273E3E90D1A6294F
4 changed files with 264 additions and 0 deletions

2
dev-util/jd-gui/Manifest Normal file
View file

@ -0,0 +1,2 @@
DIST jd-gui-1.5.0-gradle-dependencies.tar.gz 13493761 BLAKE2B 924901ca6b445e3cca00be0856b0884fa15c812dd301a46781bc29b114026b1fac3a23face2b8a54c4e0a5d74e5e92af655f7f70636adf5df985632809c534ca SHA512 e9b3998a312c432a34f9a62ccc56acc16f9fe8ef372313f8603797079f27cc5863f6fbb4f981b25da545eb5a74efa29a680fd63bb9253372cff4a2f6416bd11d
DIST v1.5.0.zip 558290 BLAKE2B 98385ac2e82e59efd9cd8ffc20dd14b740573a8b4f5596f2ccf9e930b0881a34c36a21c4c397e87b7839fe4feb24aa1022a2820627e8d085796d11c60a064a58 SHA512 3cf254b673a339ca0cdb23bf5f8ff87c7b530b5a4c1729e61fc1f9dee19b442a01f43f30a3bc4590d46d76e5a74a5eac4aab013c3a21edf72b73c8853f861aef

View file

@ -0,0 +1,197 @@
buildscript {
repositories {
if ('allow' == System.properties['build.network_access']) {
mavenCentral()
jcenter()
} else {
maven {
url "S_DIR/dependencies"
}
}
}
dependencies {
classpath 'com.netflix.nebula:gradle-ospackage-plugin:5.3.0' // RPM & DEB support
classpath 'edu.sc.seis.gradle:launch4j:2.4.4'
classpath 'net.sf.proguard:proguard-gradle:6.1.0'
}
}
apply plugin: 'java'
apply plugin: 'distribution'
apply plugin: 'edu.sc.seis.launch4j'
apply plugin: 'nebula.ospackage'
// Common configuration //
rootProject.version='1.5.0'
rootProject.ext.set('jdCoreVersion', '1.0.1')
targetCompatibility = '1.8'
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
tasks.withType(JavaCompile) {
sourceCompatibility = targetCompatibility = '1.8'
options.compilerArgs << '-Xlint:deprecation'
options.compilerArgs << '-Xlint:unchecked'
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
maven {
url 'https://raw.github.com/java-decompiler/mvn-repo/master'
}
}
configurations {
provided
compile.extendsFrom provided
}
}
// 'cleanIdea' task extension //
cleanIdea.doFirst {
delete project.name + '.iws'
delete 'out'
followSymlinks = true
}
// All in one JAR file //
subprojects.each { subproject ->
evaluationDependsOn(subproject.path)
}
jar {
dependsOn subprojects.tasks['jar']
// Add SPI directory
def tmpSpiDir = file('build/tmp/spi')
from tmpSpiDir
// Add dependencies
def deps = []
subprojects.each { subproject ->
from subproject.sourceSets.main.output.classesDirs
from subproject.sourceSets.main.output.resourcesDir
deps += subproject.configurations.runtime - subproject.configurations.provided
}
subprojects.each { subproject ->
deps -= subproject.jar.archivePath
}
deps = deps.unique().collect { it.isDirectory() ? it : zipTree(it) }
from deps
manifest {
attributes 'Main-Class': 'org.jd.gui.App',
'SplashScreen-Image': 'org/jd/gui/images/jd_icon_128.png',
'JD-GUI-Version': project.version,
'JD-Core-Version': project.jdCoreVersion
}
exclude 'META-INF/licenses/**', 'META-INF/maven/**', 'META-INF/INDEX.LIST'
exclude '**/ErrorStrip_*.properties', '**/RSyntaxTextArea_*.properties', '**/RTextArea_*.properties'
exclude '**/FocusableTip_*.properties', '**/RSyntaxTextArea_License.txt'
duplicatesStrategy DuplicatesStrategy.EXCLUDE
doFirst {
// Create SPI directory
tmpSpiDir.deleteDir()
def tmpSpiServicesDir = file(tmpSpiDir.path + '/META-INF/services')
tmpSpiServicesDir.mkdirs()
// Copy and merge SPI config files
subprojects.each { subproject ->
def servicesDir = file(subproject.sourceSets.main.output.resourcesDir.path + '/META-INF/services')
if (servicesDir.exists()) {
servicesDir.eachFile { serviceFile ->
def target = file(tmpSpiServicesDir.path + '/' + serviceFile.name)
target << serviceFile.text
}
}
}
}
}
// Minify JAR file //
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: 'jar') {
configuration 'src/proguard/resources/proguard.config.txt'
injars jar.archivePath
outjars 'build/libs/' + project.name + '-' + project.version + '-min.jar'
libraryjars System.getProperty('java.home') + '/lib/rt.jar'
}
// Java executable wrapper for Windows //
launch4j {
createExe.dependsOn 'proguard'
version = textVersion = project.version
fileDescription = productName = 'JD-GUI'
errTitle 'JD-GUI Windows Wrapper'
copyright 'JD-GUI (C) 2008-2019 Emmanuel Dupuy'
icon projectDir.path + '/src/launch4j/resources/images/jd-gui.ico'
jar projectDir.path + '/' + proguard.outJarFiles[0]
bundledJrePath = '%JAVA_HOME%'
}
// Packages for Linux //
ospackage {
buildDeb.dependsOn 'proguard'
buildRpm.dependsOn 'proguard'
license = file('LICENSE')
maintainer 'Emmanuel Dupuy <emmanue1@users.noreply.github.com>'
os LINUX
packageDescription 'JD-GUI, a standalone graphical utility that displays Java sources from CLASS files'
packageGroup 'java'
packageName project.name
release '0'
summary 'A Java Decompiler'
url 'https://github.com/java-decompiler/jd-gui'
into '/opt/' + project.name
from (proguard.outJarFiles[0]) {
fileMode 0755
}
from ('src/linux/resources/') {
fileMode 0755
}
from 'LICENSE', 'NOTICE', 'README.md'
postInstall 'cd /opt/' + project.name + '; ln -s ./' + file(proguard.outJarFiles[0]).name + ' ./jd-gui.jar; xdg-icon-resource install --size 128 --novendor ./jd_icon_128.png jd-gui; xdg-desktop-menu install ./*.desktop'
preUninstall 'cd /opt/' + project.name + '; rm -f ./jd-gui.jar; rm -fr ./ext; xdg-desktop-menu uninstall ./*.desktop'
}
// Distributions for OSX and Windows //
distributions {
osx.contents {
into('JD-GUI.app/Contents') {
from('src/osx/resources') {
include 'Info.plist'
expand VERSION: project.version,
JAR: file(proguard.outJarFiles[0]).name
}
}
into('JD-GUI.app/Contents/MacOS') {
from('src/osx/resources') {
include 'universalJavaApplicationStub.sh'
fileMode 0755
}
}
into('JD-GUI.app/Contents/Resources/Java') {
from proguard.outJarFiles[0]
}
from 'LICENSE', 'NOTICE', 'README.md'
}
windows.contents {
from 'build/launch4j/jd-gui.exe'
from 'LICENSE', 'NOTICE', 'README.md'
}
installWindowsDist.dependsOn createExe
windowsDistTar.dependsOn createExe
windowsDistZip.dependsOn createExe
installOsxDist.dependsOn 'proguard'
osxDistTar.dependsOn 'proguard'
osxDistZip.dependsOn 'proguard'
}
build.finalizedBy buildDeb
build.finalizedBy buildRpm

View file

@ -0,0 +1,12 @@
allprojects {
repositories {
if ('allow' == System.properties['build.network_access']) {
mavenCentral()
jcenter()
} else {
maven {
url "S_DIR/dependencies"
}
}
}
}

View file

@ -0,0 +1,53 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit desktop
DESCRIPTION="A standalone Java Decompiler GUI"
HOMEPAGE="http://jd.benow.ca/"
SRC_URI="https://github.com/java-decompiler/jd-gui/archive/v${PV}.zip
https://dev.pentoo.ch/~blshkv/distfiles/jd-gui-${PV}-gradle-dependencies.tar.gz"
# run: pentoo/scripts/gradle_dependencies.py from "${S}" directory to generate dependencies
# tar cvzf ./${P}-gradle-dependencies.tar.gz -C /var/tmp/portage/dev-util/${P}/work ${P}/dependencies/
#FIXME: gradle convert to publishToMavenLocal and mavenLocal()
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
RDEPEND="virtual/jre"
DEPEND="${RDEPEND}
>=virtual/jdk-11
dev-java/gradle-bin:5.2.1
!dev-util/jd-gui-bin"
src_prepare() {
mkdir -p ".gradle/init.d"
cp "${FILESDIR}"/repos.gradle .gradle/init.d || die "cp failed"
sed -i "s|S_DIR|${S}|g" .gradle/init.d/repos.gradle || die "sed failed"
cp "${FILESDIR}"/build.gradle .
sed -i "s|S_DIR|${S}|g" build.gradle || die "sed failed"
eapply_user
}
src_compile() {
GRADLE="gradle-5.2.1 --gradle-user-home .gradle --console rich --no-daemon"
GRADLE="${GRADLE} --offline"
${GRADLE} jar -x check -x test || die
}
src_install() {
insinto /usr/share/"${PN}"
doins "build/libs/${P}.jar"
doicon ./src/linux/resources/jd_icon_128.png
domenu ./src/linux/resources/jd-gui.desktop
echo -e "#!/bin/sh\njava -jar /usr/share/${PN}/${P}.jar >/dev/null 2>&1 &\n" > "${PN}"
dobin "${PN}"
}