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

Mf fixes #144

Merged
merged 4 commits into from
Jun 30, 2023
Merged
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
5 changes: 0 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew build
- name: Run unit tests
Expand Down
28 changes: 15 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
val kotlinVersion = "1.4.32"
val kotlinVersion = "1.8.20"

repositories {
mavenCentral()
Expand All @@ -13,13 +13,12 @@ buildscript {
}

plugins {
id("me.filippov.gradle.jvm.wrapper") version "0.9.3"
id("org.jetbrains.intellij") version "1.6.0"
id("me.filippov.gradle.jvm.wrapper") version "0.14.0"
id("org.jetbrains.intellij") version "1.13.3"
}

dependencies {
implementation(kotlin("test"))
implementation("org.junit.jupiter:junit-jupiter:5.8.2")
}

apply(plugin = "kotlin")
Expand All @@ -34,25 +33,28 @@ val buildNumber: String by rootProject.extra
version = buildNumber

intellij {
version.set("2020.3")
version.set("2022.2")
pluginName.set("ideolog")
tasks {
withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
updateSinceUntilBuild.set(true)
sinceBuild.set("222.3345")
untilBuild.set("")
}
runIde {
systemProperty("idea.is.internal", "true")
}
test {
useJUnitPlatform()
}
}

}

tasks.withType<KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += "-Xnew-inference"
kotlinOptions.jvmTarget = "11"
tasks {
withType<KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += "-Xnew-inference"
kotlinOptions.jvmTarget = "17"
}

wrapper {
gradleVersion = "8.1.1"
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# suppress inspection "UnusedProperty" for whole file
buildNumber=203.0.30.0
org.gradle.jvmargs=-Xmx4g
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.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
63 changes: 43 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,43 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# GRADLE JVM WRAPPER START MARKER
BUILD_DIR=$APP_HOME/build

# GRADLE JVM WRAPPER START MARKER
BUILD_DIR="${HOME}/.local/share/gradle-jvm"
JVM_ARCH=$(uname -m)
JVM_TEMP_FILE=$BUILD_DIR/gradle-jvm-temp.tar.gz
if [ "$darwin" = "true" ]; then
JVM_TEMP_FILE=$BUILD_DIR/jvm-macosx-x64.tar.gz
JVM_URL=https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/amazon-corretto-11.0.4.11.1-macosx-x64.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/gradle-jvm/amazon-corretto-11.0.4.11.1-macosx-x64-cc08dc
case $JVM_ARCH in
x86_64)
JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-x64_bin.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-x64_bin-1bcf03
;;
arm64)
JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_macos-aarch64_bin.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_macos-aarch64_bin-297fa2
;;
*)
die "Unknown architecture $JVM_ARCH"
;;
esac
elif [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
JVM_TEMP_FILE=$BUILD_DIR/jvm-windows-x64.zip
JVM_URL=https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/amazon-corretto-11.0.4.11.1-windows-x64.zip
JVM_TARGET_DIR=$BUILD_DIR/amazon-corretto-11.0.4.11.1-windows-x64-9b61dd
JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip
JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_windows-x64_bin-d6ede5
else
JVM_TEMP_FILE=$BUILD_DIR/jvm-linux-x64.tar.gz
JVM_URL=https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/amazon-corretto-11.0.4.11.1-linux-x64.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/gradle-jvm/amazon-corretto-11.0.4.11.1-linux-x64-a8fc5f
JVM_ARCH=$(linux$(getconf LONG_BIT) uname -m)
case $JVM_ARCH in
x86_64)
JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-x64_bin.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-x64_bin-9324ae
;;
aarch64)
JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_linux-aarch64_bin.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/jdk-17.0.3.1_linux-aarch64_bin-319da6
;;
*)
die "Unknown architecture $JVM_ARCH"
;;
esac
fi

set -e
Expand All @@ -105,30 +127,30 @@ if [ -e "$JVM_TARGET_DIR/.flag" ] && [ -n "$(ls "$JVM_TARGET_DIR")" ] && [ "x$(c
# Everything is up-to-date in $JVM_TARGET_DIR, do nothing
true
else
warn "Downloading $JVM_URL to $JVM_TEMP_FILE"
echo "Downloading $JVM_URL to $JVM_TEMP_FILE"

rm -f "$JVM_TEMP_FILE"
mkdir -p "$BUILD_DIR"
if command -v curl >/dev/null 2>&1; then
if [ -t 1 ]; then CURL_PROGRESS="--progress-bar"; else CURL_PROGRESS="--silent --show-error"; fi
# shellcheck disable=SC2086
curl $CURL_PROGRESS --output "${JVM_TEMP_FILE}" "$JVM_URL"
curl $CURL_PROGRESS -L --output "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
elif command -v wget >/dev/null 2>&1; then
if [ -t 1 ]; then WGET_PROGRESS=""; else WGET_PROGRESS="-nv"; fi
wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL"
wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
else
die "ERROR: Please install wget or curl"
fi

warn "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR"
echo "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR"
rm -rf "$JVM_TARGET_DIR"
mkdir -p "$JVM_TARGET_DIR"

if [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR"
else
tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR"
fi
case "$JVM_URL" in
*".zip") unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR" ;;
*) tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR" ;;
esac

rm -f "$JVM_TEMP_FILE"

echo "$JVM_URL" >"$JVM_TARGET_DIR/.flag"
Expand Down Expand Up @@ -199,6 +221,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
60 changes: 32 additions & 28 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,27 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem GRADLE JVM WRAPPER START MARKER

setlocal
set BUILD_DIR=%LOCALAPPDATA%\gradle-jvm
set JVM_TARGET_DIR=%BUILD_DIR%\jdk-17.0.3.1_windows-x64_bin-d6ede5\

set JVM_URL=https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.zip

set BUILD_DIR=%APP_HOME%build\
set JVM_TARGET_DIR=%BUILD_DIR%gradle-jvm\amazon-corretto-11.0.4.11.1-windows-x64-9b61dd\
set IS_TAR_GZ=0
set JVM_TEMP_FILE=gradle-jvm.zip

set JVM_TEMP_FILE=jvm-windows-x64.zip
set JVM_URL=https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/amazon-corretto-11.0.4.11.1-windows-x64.zip
if /I "%JVM_URL:~-7%"==".tar.gz" (
set IS_TAR_GZ=1
set JVM_TEMP_FILE=gradle-jvm.tar.gz
)

set POWERSHELL=%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

Expand All @@ -53,30 +62,39 @@ if "%CURRENT_FLAG%" == "%JVM_URL%" goto continueWithJvm

:downloadAndExtractJvm

CD "%BUILD_DIR%"
PUSHD "%BUILD_DIR%"
if errorlevel 1 goto fail

echo Downloading %JVM_URL% to %BUILD_DIR%%JVM_TEMP_FILE%
echo Downloading %JVM_URL% to %BUILD_DIR%\%JVM_TEMP_FILE%
if exist "%JVM_TEMP_FILE%" DEL /F "%JVM_TEMP_FILE%"
"%POWERSHELL%" -nologo -noprofile -Command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; (New-Object Net.WebClient).DownloadFile('%JVM_URL%', '%JVM_TEMP_FILE%')"
if errorlevel 1 goto fail

POPD

RMDIR /S /Q "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail

MKDIR "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail

CD "%JVM_TARGET_DIR%"
PUSHD "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail

echo Extracting %BUILD_DIR%%JVM_TEMP_FILE% to %JVM_TARGET_DIR%
"%POWERSHELL%" -nologo -noprofile -command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('..\\..\\%JVM_TEMP_FILE%', '.');"
echo Extracting %BUILD_DIR%\%JVM_TEMP_FILE% to %JVM_TARGET_DIR%

if "%IS_TAR_GZ%"=="1" (
tar xf "..\\%JVM_TEMP_FILE%"
) else (
"%POWERSHELL%" -nologo -noprofile -command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('..\\%JVM_TEMP_FILE%', '.');"
)
if errorlevel 1 goto fail

DEL /F "..\..\%JVM_TEMP_FILE%"
DEL /F "..\%JVM_TEMP_FILE%"
if errorlevel 1 goto fail

POPD

echo %JVM_URL%>"%JVM_TARGET_DIR%.flag"
if errorlevel 1 goto fail

Expand All @@ -98,7 +116,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

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

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -112,7 +130,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -122,28 +140,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,47 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Key
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.ui.EditorNotificationPanel
import com.intellij.ui.EditorNotificationProvider
import com.intellij.ui.EditorNotifications
import java.util.function.Function
import javax.swing.JComponent

class LogFileFormatNotificationProvider : EditorNotifications.Provider<EditorNotificationPanel>(), DumbAware {
class LogFileFormatNotificationProvider : EditorNotificationProvider, DumbAware {
companion object {
private val KEY = Key.create<EditorNotificationPanel>("log.file.format.editor.notification")
private val HIDDEN_KEY = Key.create<Any>("log.file.format.editor.notification.hidden")
private const val DONT_SHOW_AGAIN_KEY = "log.file.format.editor.notification.disabled"

fun update(file: VirtualFile, project: Project) = EditorNotifications.getInstance(project).updateNotifications(file)
}

override fun getKey(): Key<EditorNotificationPanel> = KEY
override fun collectNotificationData(project: Project, file: VirtualFile): Function<in FileEditor, out JComponent?> {
return Function {
if (it !is LogFileEditor) return@Function null
val editor = (it as TextEditor).editor

override fun createNotificationPanel(file: VirtualFile, fileEditor: FileEditor, project: Project): EditorNotificationPanel? {
if (fileEditor !is LogFileEditor) return null
val editor = (fileEditor as TextEditor).editor
val propertiesComponent = PropertiesComponent.getInstance()
if (editor.document.ideologContext.detectLogFileFormat().myRegexLogParser != null || propertiesComponent.getBoolean(DONT_SHOW_AGAIN_KEY) || editor.getUserData(HIDDEN_KEY) != null)
return@Function null

val propertiesComponent = PropertiesComponent.getInstance()
if (editor.document.ideologContext.detectLogFileFormat().myRegexLogParser != null || propertiesComponent.getBoolean(DONT_SHOW_AGAIN_KEY) || editor.getUserData(HIDDEN_KEY) != null)
return null
val panel = EditorNotificationPanel().apply {
createActionLabel("Configure log formats") {
ShowSettingsUtil.getInstance().editConfigurable(project, LogHighlightingConfigurable())

val panel = EditorNotificationPanel().apply {
createActionLabel("Configure log formats") {
ShowSettingsUtil.getInstance().editConfigurable(project, LogHighlightingConfigurable())
update(file, project)
}
createActionLabel("Hide this notification") {
editor.putUserData(HIDDEN_KEY, HIDDEN_KEY)

update(file, project)
}
createActionLabel("Hide this notification") {
editor.putUserData(HIDDEN_KEY, HIDDEN_KEY)
update(file, project)
}
createActionLabel("Don't show again") {
propertiesComponent.setValue(DONT_SHOW_AGAIN_KEY, true)

update(file, project)
update(file, project)
}
}
createActionLabel("Don't show again") {
propertiesComponent.setValue(DONT_SHOW_AGAIN_KEY, true)

update(file, project)
}
return@Function panel.text("Log format not recognized")
}

return panel.text("Log format not recognized")
}
}
Loading