Skip to content

Commit

Permalink
Updates (#2)
Browse files Browse the repository at this point in the history
* Update to gradle 8.6

* Update dependencies

* Fix ~/Applications/ resolution

* Fix selectInstallIndex invalid return

* Upgrade generated BUILD_GRADLE_KTS to 1.8.20

* Replace truth by kotest

* Rework CI config
  • Loading branch information
pgreze authored Feb 7, 2024
1 parent 8cc3c9d commit 97338d3
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 112 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,19 @@

name: Build

on: [push, pull_request]
on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
# Cache
- name: Cache Gradle wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/*') }}
restore-keys: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/*') }}
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
# Build
- name: Build
run: ./gradlew build --continue

- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew build --continue
57 changes: 0 additions & 57 deletions .github/workflows/main.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# https://help.github.com/en/actions/language-and-framework-guides/building-and-testing-java-with-gradle
# https://help.github.com/en/actions/language-and-framework-guides/publishing-java-packages-with-gradle

name: Publish

on:
push:
branches:
- main

jobs:
build:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
# https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew --continue build app:installShadowDist # TODO: app:nativeImage

- name: Publish jar
uses: actions/upload-artifact@v1
if: runner.os == 'Linux'
with:
name: aidea-jar
path: app/build/install/app-shadow/lib/aidea-all.jar

# TODO: enable after OSX fix
# - name: Publish Linux binary
# uses: actions/upload-artifact@v1
# if: runner.os == 'Linux'
# with:
# name: aidea-linux
# path: app/build/graal/aidea

# TODO: java.lang.TypeNotPresentException: Type org.graalvm.nativeimage.Platform$MACOS not present
# https://stackoverflow.com/questions/59717111/cannot-generate-native-image-using-graalvm-in-os-x-catalina
# - name: Publish OSX binary
# uses: actions/upload-artifact@v1
# if: runner.os == 'macOS'
# with:
# name: aidea-macos
# path: app/build/graal/aidea
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
application
kotlin("jvm")
id("com.github.johnrengelman.shadow") version "7.1.2"
id("com.palantir.graal") version "0.12.0"
id("com.github.johnrengelman.shadow")
id("com.palantir.graal")
}

application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private fun selectInstallIndex(size: Int): Int? {
return (readlnOrNull() ?: return null) // ctrl+d
.toIntOrNull()
?.takeIf { it - 1 in 0 until size }
?.let { it - 1 }
?: continue
}
}
10 changes: 1 addition & 9 deletions app/src/main/kotlin/com/github/pgreze/aidea/app/OpenMainKts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ fun File.generateMainKtsProject(): File =
}

private const val BUILD_GRADLE_KTS = """plugins {
kotlin("jvm") version "1.7.10"
}
repositories {
mavenCentral { content { includeGroupByRegex("org.jetbrains(|.kotlin)") } }
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
kotlin("jvm") version "1.8.20"
}
"""
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ subprojects {
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("com.google.truth:truth:_")
testImplementation("io.kotest:kotest-assertions-core:_")
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
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
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
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
4 changes: 2 additions & 2 deletions idea/src/main/kotlin/com/github/pgreze/aidea/idea/Idea.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ fun listIdeaInstallations(): Sequence<IdeaInstall> = sequence {
when {
application.extension != "app" -> null
// brew install intellij-idea{,-ce}
application.startsWith("IntelliJ IDEA") ->
application.name.startsWith("IntelliJ IDEA") ->
application.resolveLauncher(IdeaType.IDEA)
// brew install android-studio{,-preview-beta,-preview-canary}
application.startsWith("Android Studio") ->
application.name.startsWith("Android Studio") ->
application.resolveLauncher(IdeaType.ANDROID_STUDIO)
else -> null
}?.let { yield(it) }
Expand Down
5 changes: 2 additions & 3 deletions idea/src/test/kotlin/com/github/pgreze/aidea/idea/IdeaTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.pgreze.aidea.idea

import com.google.common.truth.Truth.assertThat
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test

class IdeaTest {
Expand All @@ -10,7 +10,6 @@ class IdeaTest {
val copyright = "Copyright JetBrains s.r.o., (c) 2000-2022"
val string = " <string>$infoString. $copyright</string>"

assertThat(string.extractInfoString())
.isEqualTo(infoString)
string.extractInfoString() shouldBe infoString
}
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginManagement {
}

plugins {
id("de.fayard.refreshVersions") version "0.50.2"
id("de.fayard.refreshVersions") version "0.60.5"
}

@Suppress("UnstableApiUsage")
Expand Down
18 changes: 11 additions & 7 deletions versions.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#### Dependencies and Plugin versions with their available updates.
#### Generated by `./gradlew refreshVersions` version 0.50.2
#### Generated by `./gradlew refreshVersions` version 0.60.5
####
#### Don't manually edit or split the comments that start with four hashtags (####),
#### they will be overwritten by refreshVersions.
####
#### suppress inspection "SpellCheckingInspection" for whole file
#### suppress inspection "UnusedProperty" for whole file

version.com.github.ajalt.clikt..clikt=3.5.0
plugin.com.github.johnrengelman.shadow=8.1.1

version.com.github.pgreze..kotlin-process=1.4
plugin.com.palantir.graal=0.12.0

version.com.google.truth..truth=1.1.3
version.com.github.ajalt.clikt..clikt=4.2.2

version.junit=5.9.1
version.com.github.pgreze..kotlin-process=1.4.1

version.kotlin=1.7.20
version.junit=5.10.2

version.kotlinx.coroutines=1.6.4
version.kotest=5.8.0

version.kotlin=1.9.22

version.kotlinx.coroutines=1.7.3

0 comments on commit 97338d3

Please sign in to comment.