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. plugins {
allprojects { // Apply the java-library plugin for API and implementation separation.
apply plugin: 'maven' id 'java-library'
apply plugin: 'idea' id 'maven-publish'
apply plugin: 'eclipse' }
version = '1.0.2'
// Set version of programm
def version = "1.1.0"
group = "com.wind.meditor.ManifestEditorMain"
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 )
}
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"))
}
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'
}
}
}
}
}
} }
defaultTasks('clean','distZip')
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories { repositories {
mavenCentral() mavenCentral()
} }
[compileJava, compileTestJava]*.options.collect {options ->options.encoding = 'UTF-8'}
dependencies { dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// 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'
} }
jar { tasks.named('jar') {
manifest { manifest {
attributes("Implementation-Title": project.name, attributes( 'Implementation-Title': 'ManifestEditor',
"Implementation-Version": project.version, 'Implementation-Version': version,
"Build-Time": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 'Implementation-Group': 'com.wind.meditor.ManifestEditorMain', )
"Build-Number": System.env.BUILD_NUMBER?System.env.BUILD_NUMBER:"-1",
)
}
from (project.parent.projectDir) {
include 'NOTICE.txt'
include 'LICENSE.txt'
into('META-INF')
}
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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 * 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 { public class TypedValue {
/** The value contains no data. */ /** 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 * 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; public static final int DENSITY_DEFAULT = 0;
@ -186,7 +186,7 @@ public class TypedValue {
* which its contents can change. * which its contents can change.
* *
* <p>For example, if a resource has a value defined for the -land resource qualifier, * <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> * </p>
* *
*/ */
@ -279,7 +279,7 @@ public class TypedValue {
/** /**
* Converts a complex data value holding a dimension to its final value * Converts a complex data value holding a dimension to its final value
* as an integer pixel size. This is the same as * 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 * converted to an integer (pixel) value for use as a size. A size
* conversion involves rounding the base value, and ensuring that a * conversion involves rounding the base value, and ensuring that a
* non-zero base value is at least one pixel in size. * 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. * Kept for compatibility just in case although the debugging code has been removed.
*/ */
@Deprecated @Deprecated