Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Feature/java11 #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand Down
12 changes: 4 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id("com.android.application") version "7.1.3" apply false
kotlin("android") version "1.6.21" apply false
id("org.sonarqube") version "3.3"
id("com.android.application") version "8.4.0" apply false
kotlin("android") version "1.9.23" apply false
id("org.sonarqube") version "5.0.0.4638"
}

subprojects {
Expand All @@ -11,7 +11,7 @@ subprojects {
sonarqube.isSkipProject = true
} else {
sonarqube.properties {
property("sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/test/jacocoTestReport.xml")
property("sonar.coverage.jacoco.xmlReportPaths", layout.buildDirectory.dir("reports/jacoco/test/jacocoTestReport.xml"))
}
}
}
Expand All @@ -26,8 +26,4 @@ sonarqube {
property("sonar.organization", "g00fy2")
property("sonar.host.url", "https://sonarcloud.io")
}
}

tasks.register<Delete>("clean") {
delete(buildDir)
}
5 changes: 1 addition & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# Use R8 in full mode instead of ProGuard compatibility mode.
android.enableR8.fullMode=true
org.gradle.jvmargs=-Xmx1536m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
11 changes: 6 additions & 5 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ plugins {
}

android {
compileSdk = 32
namespace = "io.github.g00fy2.versioncomparesample"
compileSdk = 34
defaultConfig {
applicationId = "io.github.g00fy2.versioncomparesample"
minSdk = 14
targetSdk = 32
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
Expand All @@ -23,11 +24,11 @@ android {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
8 changes: 4 additions & 4 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.github.g00fy2.versioncomparesample">
xmlns:tools="http://schemas.android.com/tools">

<application
android:icon="@mipmap/ic_launcher"
android:label="Version Compare"
android:theme="@style/AppTheme"
android:allowBackup="false">
android:allowBackup="false"
tools:ignore="DataExtractionRules">
<activity
android:name="io.github.g00fy2.versioncomparesample.MainActivity"
android:exported="true"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity">
tools:ignore="DiscouragedApi,LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
46 changes: 23 additions & 23 deletions versioncompare/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

jacoco {
toolVersion = "0.8.8"
toolVersion = "0.8.12"
}

tasks.test {
Expand All @@ -21,8 +21,8 @@ tasks.test {

tasks.jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
xml.required = true
csv.required = false
}
}

Expand All @@ -31,24 +31,24 @@ repositories {
}

dependencies {
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("org.jetbrains:annotations:24.1.0")

testImplementation("junit:junit:4.13.2")
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.10")
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.16.1")
}

group = "io.github.g00fy2"
version = "1.5.0"
rootProject.version = "1.5.0" // set version for sonarcloud
version = "1.6.0"
rootProject.version = "1.6.0" // set version for sonarcloud

tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from("$buildDir/docs/javadoc")
archiveClassifier = "javadoc"
from(layout.buildDirectory.dir("docs/javadoc"))
dependsOn("javadoc")
}

tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
archiveClassifier = "sources"
from(sourceSets.getByName("main").java.srcDirs)
}

Expand All @@ -65,26 +65,26 @@ publishing {
artifact(tasks.named("javadocJar"))
artifact(tasks.named("sourcesJar"))
pom {
name.set(project.name)
description.set("Lightweight library to compare version strings.")
url.set("https://github.com/G00fY2/version-compare")
name = project.name
description = "Lightweight library to compare version strings."
url = "https://github.com/G00fY2/version-compare"
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
name = "The Apache Software License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id.set("g00fy2")
name.set("Thomas Wirth")
email.set("twirth.development@gmail.com")
id = "g00fy2"
name = "Thomas Wirth"
email = "twirth.development@gmail.com"
}
}
scm {
connection.set("https://github.com/G00fY2/version-compare.git")
developerConnection.set("https://github.com/G00fY2/version-compare.git")
url.set("https://github.com/G00fY2/version-compare")
connection = "https://github.com/G00fY2/version-compare.git"
developerConnection = "https://github.com/G00fY2/version-compare.git"
url = "https://github.com/G00fY2/version-compare"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Version(@Nullable String versionString, boolean throwExceptions) {
* @return the major version, default 0.
*/
public long getMajor() {
return trimmedSubversionNumbers.size() > 0 ? trimmedSubversionNumbers.get(0) : 0L;
return !trimmedSubversionNumbers.isEmpty() ? trimmedSubversionNumbers.get(0) : 0L;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static int compareSubversionNumbers(@NotNull final List<Long> versionNumbersA,
}

static ReleaseType qualifierToReleaseType(@NotNull String suffix) {
if (suffix.length() > 0) {
if (!suffix.isEmpty()) {
suffix = suffix.toLowerCase();
if (suffix.contains(RC_STRING)) return ReleaseType.RC;
if (suffix.contains(BETA_STRING)) return ReleaseType.BETA;
Expand Down Expand Up @@ -99,7 +99,7 @@ private static int indexOfQualifier(@NotNull String suffix, final ReleaseType re
// helper methods
static boolean startsNumeric(@NotNull String str) {
str = str.trim();
return str.length() > 0 && Character.isDigit(str.charAt(0));
return !str.isEmpty() && Character.isDigit(str.charAt(0));
}

static long safeParseLong(@NotNull String numbers) {
Expand Down
4 changes: 4 additions & 0 deletions versioncompare/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module versioncompare {
requires static org.jetbrains.annotations;
exports io.github.g00fy2.versioncompare;
}