Skip to content

Commit 09479e6

Browse files
author
AdamKolodziejczak
committed
Add Adam's modified plugin and study question files for pilot study
1 parent c724451 commit 09479e6

15 files changed

Lines changed: 424 additions & 47 deletions

File tree

Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Stage 1: Cache Gradle dependencies
2-
FROM gradle:8.5-jdk17 AS cache
2+
FROM gradle:latest AS cache
33
RUN mkdir -p /home/gradle/cache_home
4-
ENV GRADLE_USER_HOME=/home/gradle/cache_home
4+
ENV GRADLE_USER_HOME /home/gradle/cache_home
55
COPY build.gradle.* gradle.properties /home/gradle/app/
66
COPY gradle /home/gradle/app/gradle
77
WORKDIR /home/gradle/app
88
RUN gradle clean build -i --stacktrace
99

1010
# Stage 2: Build Application
11-
FROM gradle:8.5-jdk17 AS build
11+
FROM gradle:latest AS build
1212
COPY --from=cache /home/gradle/cache_home /home/gradle/.gradle
1313
COPY . /usr/src/app/
1414
WORKDIR /usr/src/app
@@ -17,9 +17,10 @@ WORKDIR /home/gradle/src
1717
RUN gradle ij-server:buildFatJar --no-daemon
1818

1919
# Stage 3: Create the Runtime Image
20-
FROM amazoncorretto:17 AS runtime
20+
FROM amazoncorretto:11 AS runtime
2121
EXPOSE 8080
22-
RUN mkdir /app
22+
RUN mkdir /app \
23+
# Make sure /data/tt-files directory exists in the runtime image
2324
RUN mkdir -p /data/tt-files && chmod -R 777 /data/tt-files
2425
COPY --from=build /home/gradle/src/ij-server/build/libs/ij-server-all.jar /app/ktor-docker-sample.jar
25-
ENTRYPOINT ["java","-jar","/app/ktor-docker-sample.jar"]
26+
ENTRYPOINT ["java","-jar","/app/ktor-docker-sample.jar"]

docker-compose.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
services:
22
server:
3-
image: koala-server:latest # Create the local image: docker build --platform linux/amd64 -t koala-server .
4-
platform: linux/amd64
3+
image: registry.jetbrains.team/p/tasktracker-3/sharable/tasktracker-server:latest
54
ports:
65
- "8080:8080"
76
environment:
8-
- DB_URL=jdbc:postgresql://host.docker.internal:5432/koala
9-
- DB_USERNAME=
10-
- DB_PASSWORD=
7+
- DB_URL=jdbc:postgresql://host.docker.internal:5432/tasktracker
8+
- DB_USERNAME=adamk4
9+
- DB_PASSWORD=Dzieciaki2

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
22

33
pluginGroup = org.jetBrains.research.tasktracker
4-
pluginName = KOALA
5-
pluginRepositoryUrl = https://github.com/JetBrains-Research/KOALA
4+
pluginName = TaskTracker-3
5+
pluginRepositoryUrl = https://github.com/JetBrains-Research/tasktracker-3
66
# SemVer format -> https://semver.org
77
pluginVersion = 0.1.0
88

ij-plugin/build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ tasks {
101101
}
102102

103103
withType<JavaCompile> {
104-
sourceCompatibility = jdkVersion
105-
targetCompatibility = JavaVersion.VERSION_21.toString()
104+
sourceCompatibility = "21"
105+
targetCompatibility = "21"
106106
}
107107
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
108108
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
@@ -113,3 +113,14 @@ tasks {
113113
}
114114

115115
}
116+
117+
kotlin {
118+
jvmToolchain(21)
119+
}
120+
121+
java {
122+
toolchain {
123+
languageVersion.set(JavaLanguageVersion.of(21))
124+
}
125+
}
126+

ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/tracking/logger/BaseLogger.kt

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jetbrains.research.tasktracker.tracking.logger
22

3+
import com.intellij.openapi.application.ApplicationManager
4+
import com.intellij.openapi.application.runWriteAction
35
import com.intellij.openapi.util.io.FileUtil
46
import com.jetbrains.rd.util.AtomicInteger
57
import org.apache.commons.csv.CSVFormat
@@ -19,56 +21,48 @@ abstract class BaseLogger {
1921

2022
private val logPrinters = mutableListOf<LogPrinter>()
2123
private val atomicInteger = AtomicInteger(0)
22-
private val lock = Any()
2324

2425
protected fun log(dataToPrint: Iterable<*>) {
2526
val logPrinter = getActiveLogPrinter()
26-
// Writing to a plain file via CSVPrinter does not require IDE write action; just ensure thread-safety.
27-
synchronized(lock) {
28-
logPrinter.csvPrinter.printRecord(dataToPrint)
27+
ApplicationManager.getApplication().invokeLater {
28+
runWriteAction { logPrinter.csvPrinter.printRecord(dataToPrint) }
2929
}
3030
}
3131

3232
/**
3333
* Gets the active logPrinter or creates a new one if there was none or the active one was full
3434
*/
35-
private fun getActiveLogPrinter(): LogPrinter = synchronized(lock) {
35+
private fun getActiveLogPrinter(): LogPrinter {
3636
val activePrinter = getLastPrinter()
37-
if (activePrinter.isFull()) {
37+
return if (activePrinter.isFull()) {
3838
addLogPrinter()
3939
} else {
4040
activePrinter
4141
}
4242
}
4343

44-
private fun getLastPrinter(): LogPrinter = synchronized(lock) {
45-
if (logPrinters.isEmpty()) {
46-
addLogPrinter()
47-
} else {
48-
logPrinters.last()
49-
}
44+
private fun getLastPrinter() = if (logPrinters.isEmpty()) {
45+
addLogPrinter()
46+
} else {
47+
logPrinters.last()
5048
}
5149

52-
private fun addLogPrinter(): LogPrinter = synchronized(lock) {
53-
val logFile = createLogFile("${logPrinterFilename}${atomicInteger.getAndIncrement()}.csv")
50+
private fun addLogPrinter(): LogPrinter {
51+
val logFile = createLogFile("$logPrinterFilename${atomicInteger.getAndIncrement()}.csv")
5452
val fileWriter = OutputStreamWriter(FileOutputStream(logFile), StandardCharsets.UTF_8)
5553
val csvPrinter = CSVPrinter(fileWriter, CSVFormat.DEFAULT)
56-
csvPrinter.printRecord(loggedData.headers)
54+
runWriteAction { csvPrinter.printRecord(loggedData.headers) }
5755
logPrinters.add(LogPrinter(csvPrinter, fileWriter, logFile))
58-
logPrinters.last()
56+
return logPrinters.last()
5957
}
6058

61-
private fun createLogFile(fileName: String): File {
62-
val logDir = File(MainTaskTrackerConfig.logFilesFolder)
63-
if (!logDir.exists()) {
64-
logDir.mkdirs()
65-
}
59+
private fun createLogFile(fileName: String): File = runWriteAction {
6660
val logFile = File("${MainTaskTrackerConfig.logFilesFolder}/$fileName")
6761
FileUtil.createIfDoesntExist(logFile)
68-
return logFile
62+
logFile
6963
}
7064

71-
fun getLogFiles(): List<File> = synchronized(lock) {
65+
fun getLogFiles(): List<File> = runWriteAction {
7266
logPrinters.map {
7367
it.csvPrinter.flush()
7468
it.logFile
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Test 1: Basic mixed word
2+
# Input: tour
3+
# Output: .t.r
4+
5+
# Test 2: Mixed case word
6+
# Input: CodeForces
7+
# Output: .c.d.f.r.c.s
8+
9+
# Test 3: All uppercase vowels - empty output
10+
# Input: AEIOU
11+
# Output: (empty)
12+
13+
# Test 4: All lowercase vowels - empty output
14+
# Input: aeiou
15+
# Output: (empty)
16+
17+
# Test 5: All uppercase consonants - lowercased with dots
18+
# Input: BCDFG
19+
# Output: .b.c.d.f.g
20+
21+
# Test 6: All lowercase consonants
22+
# Input: bcdfg
23+
# Output: .b.c.d.f.g
24+
25+
# Test 7: Lowercase y is a vowel - empty output
26+
# Input: y
27+
# Output: (empty)
28+
29+
# Test 8: Both y and Y are vowels - empty output
30+
# Input: yY
31+
# Output: (empty)
32+
33+
# Test 9: Y at start of word is removed as vowel (common mistake)
34+
# Input: Yes
35+
# Output: .s
36+
37+
# Test 10: Y between consonants - Y removed
38+
# Input: zYz
39+
# Output: .z.z
40+
41+
# Test 11: Single consonant
42+
# Input: b
43+
# Output: .b
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Test 1: Two words not separated by WUB - they become one word
2+
# Input: WUBWUBHELLOWORLDWUB
3+
# Output: HELLOWORLD
4+
5+
6+
# Test 1: Example from problem
7+
# Input: WUBWUBIWUBAMWUBWUBX
8+
# Output: I AM X
9+
10+
# Test 2: Leading and trailing WUBs
11+
# Input: WUBHELLOWUBWORLDWUB
12+
# Output: HELLO WORLD
13+
14+
# Test 3: Multiple WUBs only - empty output
15+
# Input: WUBWUBWUB
16+
# Output: (empty)
17+
18+
# Test 4: No WUBs at all - word printed as-is
19+
# Input: HELLO
20+
# Output: HELLO
21+
22+
# Test 5: Two words not separated by WUB - become one word (common mistake)
23+
# Input: WUBWUBHELLOWORLDWUB
24+
# Output: HELLOWORLD
25+
26+
# Test 6: Single word wrapped in WUBs
27+
# Input: WUBHELLOWUB
28+
# Output: HELLO
29+
30+
# Test 7: WUB splits two single letters
31+
# Input: AWUBB
32+
# Output: A B
33+
34+
# Test 8: Multiple single letter words
35+
# Input: WUBAWUBBWUBCWUB
36+
# Output: A B C
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Test 1: Normal short word - no change
2+
# Input: word
3+
# Output: word
4+
5+
# Test 2: Normal long word - abbreviate
6+
# Input: localization
7+
# Output: l10n
8+
9+
# Test 3: Exactly 10 characters - should NOT abbreviate (common off-by-one mistake)
10+
# Input: abcdefghij
11+
# Output: abcdefghij
12+
13+
# Test 4: Exactly 11 characters - should abbreviate (boundary)
14+
# Input: abcdefghijk
15+
# Output: a9k
16+
17+
# Test 5: First and last letter are the same
18+
# Input: abcdefghija
19+
# Output: a9a
20+
21+
# Test 6: All same letter (11 chars)
22+
# Input: aaaaaaaaaaa
23+
# Output: a9a
24+
25+
# Test 7: Very long word
26+
# Input: internationalization
27+
# Output: i18n
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Test 1: Basic - 1 digit divisible by 2
2+
# Input: 1 2
3+
# Output: 2
4+
5+
# Test 2: Basic - 3 digits divisible by 4
6+
# Input: 3 4
7+
# Output: 100
8+
9+
# Test 3: t=1, every number works - smallest n-digit number
10+
# Input: 1 1
11+
# Output: 1
12+
13+
# Test 4: t=1 with 2 digits
14+
# Input: 2 1
15+
# Output: 10
16+
17+
# Test 5: t=1 with 3 digits
18+
# Input: 3 1
19+
# Output: 100
20+
21+
# Test 6: Last single digit (9)
22+
# Input: 1 9
23+
# Output: 9
24+
25+
# Test 7: No single digit divisible by 10 - must print -1 (common mistake to skip -1 case)
26+
# Input: 1 10
27+
# Output: -1
28+
29+
# Test 8: No single digit divisible by 11
30+
# Input: 1 11
31+
# Output: -1
32+
33+
# Test 9: 2-digit number divisible by 10
34+
# Input: 2 10
35+
# Output: 10
36+
37+
# Test 10: 2-digit number, t equals the number itself
38+
# Input: 2 99
39+
# Output: 99
40+
41+
# Test 11: 2-digit prime as t
42+
# Input: 2 97
43+
# Output: 97
44+
45+
# Test 12: t larger than any n-digit number
46+
# Input: 1 97
47+
# Output: -1
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Test 1: Basic safe - alternating
2+
# Input: 010101
3+
# Output: YES
4+
5+
# Test 2: Exactly 7 zeros - dangerous
6+
# Input: 0000000
7+
# Output: NO
8+
9+
# Test 3: Exactly 7 ones - dangerous
10+
# Input: 1111111
11+
# Output: NO
12+
13+
# Test 4: Exactly 6 zeros - safe (off-by-one mistake)
14+
# Input: 000000
15+
# Output: YES
16+
17+
# Test 5: Exactly 6 ones - safe
18+
# Input: 111111
19+
# Output: YES
20+
21+
# Test 6: 8 zeros - dangerous
22+
# Input: 00000000
23+
# Output: NO
24+
25+
# Test 7: Run of 7 at the start
26+
# Input: 11111110
27+
# Output: NO
28+
29+
# Test 8: Run of 7 in the middle
30+
# Input: 011111110
31+
# Output: NO
32+
33+
# Test 9: Run of 7 at the end
34+
# Input: 01111111
35+
# Output: NO
36+
37+
# Test 10: 7 ones present but only 6 zeros - still dangerous
38+
# Input: 00000011111110
39+
# Output: NO
40+
41+
# Test 11: Both 0s and 1s hit 7 in a row
42+
# Input: 000000011111110
43+
# Output: NO
44+
45+
# Test 12: Long alternating string (100 chars) - safe
46+
# Input: 0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
47+
# Output: YES

0 commit comments

Comments
 (0)