Update to gradle 8.1 with some refactoring

master
Jonas Letzbor 2023-11-12 13:27:12 +01:00
parent 34387a78a0
commit b88a560ddb
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
39 changed files with 133 additions and 69 deletions

View File

@ -1,41 +1,132 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'eclipse'
version = '1.0.2'
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'maven-publish'
}
defaultTasks('clean','distZip')
// Set version of programm
def version = "1.1.0"
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = "com.wind.meditor.ManifestEditorMain"
repositories {
mavenCentral()
sourceCompatibility = 11
targetCompatibility = 11
// Set correct encoding
compileJava.options.encoding = 'UTF-8'
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
// create a single .jar with all dependencies //
task fatJar(type: Jar) {
archiveClassifier = ''
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes( 'Main-Class': 'com.wind.meditor.ManifestEditorMain',
'Implementation-Version': version )
}
[compileJava, compileTestJava]*.options.collect {options ->options.encoding = 'UTF-8'}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
manifest {
attributes( 'Implementation-Title': 'ManifestEditor',
'Implementation-Version': version,
'Implementation-Group': project.group, )
}
archivesBaseName = "ManifestEditor"
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
{
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
destinationDirectory.set(layout.buildDirectory.dir("dist"))
}
jar {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": project.version,
"Build-Time": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Build-Number": System.env.BUILD_NUMBER?System.env.BUILD_NUMBER:"-1",
)
}
from (project.parent.projectDir) {
include 'NOTICE.txt'
include 'LICENSE.txt'
into('META-INF')
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
destinationDirectory.set(layout.buildDirectory.dir("dist"))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
manifest {
attributes( 'Implementation-Title': 'ManifestEditor',
'Implementation-Version': version,
'Implementation-Group': project.group, )
}
archiveClassifier = 'javadoc'
from javadoc.destinationDir
destinationDirectory.set(layout.buildDirectory.dir("dist"))
}
artifacts {
archives sourcesJar
archives javadocJar
archives fatJar
}
// publish to local maven repo //
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'ManifestEditor'
from components.java
pom {
name = 'Manifest Editor'
description = 'A manifest editor for android'
url = 'https://git.rpjosh.de/RPJosh/RPdb'
licenses {
license {
name = 'The GNU AFFERO GENERAL PUBLIC LICENSE, Version 3'
url = 'https://www.gnu.org/licenses/agpl-3.0.html'
}
}
developers {
developer {
id = 'RPJosh'
name = 'RPJosh'
email = 'RPjosh@rpjosh.de'
}
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
// Logging library
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.0-alpha16'
// Rest service
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.9.0'
implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.9.0'
// Configuration file (.ini)
implementation group: 'org.ini4j', name: 'ini4j', version: '0.5.4'
}
tasks.named('jar') {
manifest {
attributes( 'Implementation-Title': 'ManifestEditor',
'Implementation-Version': version,
'Implementation-Group': 'com.wind.meditor.ManifestEditorMain', )
}
}

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-rc-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip

1
lib/.gitignore vendored
View File

@ -1 +0,0 @@
/build

View File

@ -1,31 +0,0 @@
apply plugin: 'java-library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
jar{
baseName = "ManifestEditor"
manifest {
attributes 'Main-Class': 'com.wind.meditor.ManifestEditorMain'
}
//jarjar
from {
(configurations.runtime).collect {
it.isDirectory() ? it : zipTree(it)
}
}
from fileTree(dir:'src/main', includes: ['assets/**'])
//jar
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
}
//
sourceSets.main.resources {
srcDirs = [
"src/main/java",
];
include "**/*.*"
}

5
run.sh 100755
View File

@ -0,0 +1,5 @@
# Build app
./gradlew build
# Run the app (add your options here)
java -jar build/dist/ManifestEditor.jar --help

View File

@ -18,7 +18,7 @@ package com.wind.meditor.utils;
/**
* Container for a dynamically typed data value. Primarily used with
* {@link1 android.content.res.Resources} for holding resource values.
* "android.content.res.Resources" for holding resource values.
*/
public class TypedValue {
/** The value contains no data. */
@ -151,7 +151,7 @@ public class TypedValue {
/**
* If {@link #density} is equal to this value, then the density should be
* treated as the system's default density value: {@link1 DisplayMetrics#DENSITY_DEFAULT}.
* treated as the system's default density value: unknown.
*/
public static final int DENSITY_DEFAULT = 0;
@ -186,7 +186,7 @@ public class TypedValue {
* which its contents can change.
*
* <p>For example, if a resource has a value defined for the -land resource qualifier,
* this field will have the {@link1 android.content.pm.ActivityInfo#CONFIG_ORIENTATION} bit set.
* this field will have the {@link android.content.pm.ActivityInfo#CONFIG_ORIENTATION} bit set.
* </p>
*
*/
@ -279,7 +279,7 @@ public class TypedValue {
/**
* Converts a complex data value holding a dimension to its final value
* as an integer pixel size. This is the same as
* {@link1 #complexToDimension}, except the raw floating point value is
* {@link #complexToDimension}, except the raw floating point value is
* converted to an integer (pixel) value for use as a size. A size
* conversion involves rounding the base value, and ensuring that a
* non-zero base value is at least one pixel in size.
@ -310,7 +310,7 @@ public class TypedValue {
// }
/**
* @hide Was accidentally exposed in API level 1 for debugging purposes.
* Was accidentally exposed in API level 1 for debugging purposes.
* Kept for compatibility just in case although the debugging code has been removed.
*/
@Deprecated