Skip to content

Commit

Permalink
Merge pull request #17 from saschpe/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
saschpe authored Mar 23, 2024
2 parents 0c4a2ea + 6e0dd60 commit abac9f2
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 65 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# noinspection EditorConfigKeyCorrectness
[*.{kt,kts}]
ktlint_code_style = intellij_idea
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
ktlint_standard_no-wildcard-imports = disabled
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Run Spotless
run: ./gradlew spotlessCheck

build:
runs-on: macos-12
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Build with Gradle
run: ./gradlew build
- name: Archive build artifacts
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: kase64_build
path: |
Expand All @@ -40,7 +41,7 @@ jobs:
publish:
needs: build
runs-on: macos-12
runs-on: macos-14
if: github.ref == 'refs/heads/main'
environment: Sonatype
env:
Expand All @@ -51,12 +52,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Download build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: kase64_build
- name: Publish to Sonatype (Maven Central)
Expand Down
15 changes: 11 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.diffplug.spotless") version "6.21.0"
id("com.github.ben-manes.versions") version "0.48.0"
id("com.diffplug.spotless") version "6.25.0"
id("com.github.ben-manes.versions") version "0.51.0"
}

spotless {
Expand All @@ -10,9 +10,16 @@ spotless {
}
kotlin {
target("**/*.kt")
ktlint()
ktlint("1.2.1").setEditorConfigPath(".editorconfig")
}
kotlinGradle {
ktlint()
ktlint("1.2.1").setEditorConfigPath(".editorconfig")
}
}

tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
fun isStable(version: String) = Regex("^[0-9,.v-]+(-r)?$").matches(version)
!isStable(candidate.version) && isStable(currentVersion)
}
}
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
26 changes: 10 additions & 16 deletions kase64/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
plugins {
kotlin("multiplatform") version "1.9.10"
id("com.android.library") version "8.1.0-rc01"
kotlin("multiplatform")
id("com.android.library")
`maven-publish`
signing
}

kotlin {
androidTarget { publishAllLibraryVariants() }
ios()
iosArm64()
iosSimulatorArm64()
js {
nodejs()
compilations.all {
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = "umd"
}
}
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
js { nodejs() }
jvm()
linuxX64()
macosArm64()
macosX64()
mingwX64() // Win-what ?!?
tvosArm64()
watchosArm64()

applyDefaultHierarchyTemplate()

sourceSets["commonTest"].dependencies {
implementation(kotlin("test"))
}
sourceSets["iosSimulatorArm64Main"].dependsOn(sourceSets["iosMain"])
sourceSets["iosSimulatorArm64Test"].dependsOn(sourceSets["iosTest"])
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
Expand All @@ -37,11 +31,11 @@ android {
namespace = "saschpe.kase64"

defaultConfig {
compileSdk = 33
compileSdk = 34
minSdk = 17
}

testCoverage.jacocoVersion = "0.8.10"
testCoverage.jacocoVersion = "0.8.11"
}

group = "de.peilicke.sascha"
Expand Down Expand Up @@ -97,4 +91,4 @@ signing {
else -> useInMemoryPgpKeys(sonatypeGpgKey, sonatypeGpgKeyPassword)
}
sign(publishing.publications)
}
}
36 changes: 17 additions & 19 deletions scripts/inc.functions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env sh
#
# Collection of shared functions
#
Expand All @@ -8,35 +8,33 @@ RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function approve() {
echo -e "${GREEN}$@${NC}"
approve() {
printf "${GREEN}%s${NC}\n" "$*"
}

function warn() {
echo -e "${YELLOW}$@${NC}"
warn() {
printf "${YELLOW}%s${NC}\n" "$*"
}

function die() {
echo -e "${RED}$@${NC}"
die() {
printf "${RED}%s${NC}\n" "$*"
exit 1
}

function safe() {
safe() {
"$@"
local status=$?
if [[ ${status} -ne 0 ]]; then
die "\nBUILD FAILED\nAfter invoking \"$@\"\n" >&2
_status=$?
if [ ${_status} -ne 0 ]; then
die "\nBUILD FAILED\nAfter invoking \"$*\"\n" >&2
fi
return ${status}
return ${_status}
}

function sed2() {
sed -i'.bak' "$1" ${@:2}
for file in "${@:2}"; do
sed2() {
cmd="${1}"
shift
sed -i'.bak' "${cmd}" "${@}"
for file in "${@}"; do
rm "${file}.bak"
done
}

function get_version_name() {
echo $(grep "version = " $1 | xargs | cut -d"=" -f2)
}
4 changes: 4 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ function version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"
}

get_version_name() {
grep "version = " "$1" | cut -d"=" -f2 | xargs
}

# Checks
if [[ $# -ne 1 ]]; then
usage
Expand Down
9 changes: 8 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ pluginManagement {
gradlePluginPortal()
google()
}

plugins {
kotlin("multiplatform") version "1.9.23"
id("com.android.library") version "8.2.2"
`maven-publish`
signing
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
google()
Expand Down

0 comments on commit abac9f2

Please sign in to comment.