Skip to content

Commit 02a8932

Browse files
authored
Merge pull request #20 from hexagonkt/develop
Add current directory to classpath #19
2 parents 375ebf0 + e9bc480 commit 02a8932

11 files changed

Lines changed: 82 additions & 159 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,27 @@ jobs:
1717
steps:
1818
- name: Check Out
1919
uses: actions/checkout@v3
20-
- name: Install UPX (Windows)
21-
if: ${{ matrix.os == 'windows-latest' }}
22-
run: choco install upx
23-
- name: Install UPX (macOS)
24-
if: ${{ matrix.os == 'macos-latest' }}
25-
run: brew install upx
2620
- name: Install Java
2721
uses: graalvm/setup-graalvm@v1
2822
with:
2923
version: latest
3024
java-version: 17
3125
github-token: ${{ secrets.GITHUB_TOKEN }}
32-
components: native-image,llvm
3326
cache: gradle
3427
- name: Run Tests
35-
run: ./gradlew -Pagent test
36-
- name: Run Tests
37-
run: ./gradlew metadataCopy
28+
run: ./gradlew test
3829
- name: Build Native
3930
run: ./gradlew zipNative
4031
- name: Start Native (Windows)
4132
if: ${{ matrix.os == 'windows-latest' }}
4233
run: |
43-
chmod +x build/native/codecv.exe
44-
./build/native/codecv.exe &
34+
chmod +x build/native/nativeCompile/codecv.exe
35+
./build/native/nativeCompile/codecv.exe &
4536
- name: Start Native (Unix)
4637
if: ${{ matrix.os != 'windows-latest' }}
4738
run: |
48-
chmod +x build/native/codecv
49-
./build/native/codecv &
50-
- name: Start Native (Unix)
39+
chmod +x build/native/nativeCompile/codecv
40+
./build/native/nativeCompile/codecv &
41+
- name: Test Native (Unix)
5142
if: ${{ matrix.os != 'windows-latest' }}
5243
run: curl http://localhost:2010/openapi.yml

.github/workflows/upload_native.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,42 +44,33 @@ jobs:
4444
steps:
4545
- name: Check Out
4646
uses: actions/checkout@v3
47-
- name: Install UPX (Windows)
48-
if: ${{ matrix.os == 'windows-latest' }}
49-
run: choco install upx
50-
- name: Install UPX (macOS)
51-
if: ${{ matrix.os == 'macos-latest' }}
52-
run: brew install upx
5347
- name: Install Java
5448
uses: graalvm/setup-graalvm@v1
5549
with:
5650
version: latest
5751
java-version: 17
5852
github-token: ${{ secrets.GITHUB_TOKEN }}
59-
components: native-image,llvm
6053
cache: gradle
6154
- name: Run Tests
62-
run: ./gradlew -Pagent test
63-
- name: Run Tests
64-
run: ./gradlew metadataCopy
55+
run: ./gradlew test
6556
- name: Build Native
6657
run: ./gradlew zipNative
6758
- name: Start Native (Windows)
6859
if: ${{ matrix.os == 'windows-latest' }}
6960
run: |
70-
chmod +x build/native/codecv.exe
71-
./build/native/codecv.exe &
61+
chmod +x build/native/nativeCompile/codecv.exe
62+
./build/native/nativeCompile/codecv.exe &
7263
- name: Start Native (Unix)
7364
if: ${{ matrix.os != 'windows-latest' }}
7465
run: |
75-
chmod +x build/native/codecv
76-
./build/native/codecv &
77-
- name: Start Native (Unix)
66+
chmod +x build/native/nativeCompile/codecv
67+
./build/native/nativeCompile/codecv &
68+
- name: Test Native (Unix)
7869
if: ${{ matrix.os != 'windows-latest' }}
7970
run: curl http://localhost:2010/openapi.yml
8071
- name: Archive production artifacts
8172
uses: actions/upload-artifact@v3
8273
with:
8374
name: CodeCV-${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}
84-
path: build/native/codecv*
75+
path: build/native/nativeCompile/codecv*
8576
retention-days: 1

build.gradle.kts

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,48 @@
11
import org.gradle.api.JavaVersion.*
22
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension
3+
import org.gradle.api.internal.plugins.DefaultTemplateBasedStartScriptGenerator
34
import java.lang.System.getProperty
45

56
plugins {
6-
kotlin("jvm") version("1.8.0")
7-
id("org.graalvm.buildtools.native") version("0.9.19")
7+
kotlin("jvm") version("1.8.20")
8+
id("org.graalvm.buildtools.native") version("0.9.21")
89
}
910

10-
val os = getProperty("os.name").toLowerCase()
11+
val os = getProperty("os.name").lowercase()
1112

12-
val hexagonVersion = "2.4.5"
13-
val hexagonExtraVersion = "2.4.0"
14-
val vertxVersion = "4.3.7"
13+
val hexagonVersion = "2.8.0"
14+
val hexagonExtraVersion = "2.8.0"
15+
val vertxVersion = "4.4.1"
1516

16-
val modules = "java.logging"
17-
val options = "-Xmx32m"
18-
val icon = "$projectDir/logo.png"
1917
val gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/$hexagonVersion/gradle"
2018

19+
ext.set("modules", "java.logging")
20+
ext.set("options", "-Xmx32m")
21+
ext.set("icon", "$projectDir/logo.png")
22+
ext.set("applicationClass", "co.codecv.CvKt")
23+
2124
apply(from = "$gradleScripts/kotlin.gradle")
2225
apply(from = "$gradleScripts/application.gradle")
2326
apply(from = "$gradleScripts/native.gradle")
2427

2528
group = "com.hexagonkt.tools"
26-
version = "0.9.17"
29+
version = "0.9.18"
2730
description = "CVs for programmers"
2831

29-
ext {
30-
set("modules", modules)
31-
set("options", options)
32-
set("icon", icon)
33-
}
34-
3532
if (current() !in setOf(VERSION_16, VERSION_17, VERSION_18, VERSION_19))
3633
error("This build must be run with JDK 16+. Current: ${current()}")
3734

38-
extensions.configure<JavaApplication> {
39-
mainClass.set("co.codecv.CvKt")
40-
}
41-
4235
dependencies {
43-
"implementation"("com.hexagonkt:http_server_jetty:$hexagonVersion")
36+
"implementation"("com.hexagonkt:http_server_netty:$hexagonVersion")
4437
"implementation"("com.hexagonkt:logging_slf4j_jul:$hexagonVersion")
4538
"implementation"("com.hexagonkt:serialization_jackson_json:$hexagonVersion")
4639
"implementation"("com.hexagonkt:serialization_jackson_yaml:$hexagonVersion")
4740
"implementation"("com.hexagonkt:serialization_jackson_toml:$hexagonVersion")
4841
"implementation"("com.hexagonkt:templates_pebble:$hexagonVersion")
42+
"implementation"("com.hexagonkt.extra:helpers:$hexagonExtraVersion")
43+
"implementation"("com.hexagonkt.extra:args:$hexagonExtraVersion")
4944
"implementation"("com.hexagonkt.extra:web:$hexagonExtraVersion")
45+
5046
"implementation"("io.vertx:vertx-json-schema:$vertxVersion")
5147

5248
"testImplementation"("com.hexagonkt:http_client_jetty:$hexagonVersion")
@@ -55,6 +51,24 @@ dependencies {
5551
tasks.named("classes") { dependsOn("addResources") }
5652
tasks.named("build") { dependsOn("installDist") }
5753

54+
tasks.named<CreateStartScripts>("startScripts") {
55+
dependsOn("jacocoTestReport")
56+
57+
listOf(unixStartScriptGenerator, windowsStartScriptGenerator).forEach {
58+
val generator = it as DefaultTemplateBasedStartScriptGenerator
59+
val currentTemplate = generator.template.asString()
60+
val newTemplate = when (it) {
61+
windowsStartScriptGenerator ->
62+
currentTemplate.replace("set CLASSPATH=\$classpath", "set CLASSPATH=\$classpath;.")
63+
unixStartScriptGenerator ->
64+
currentTemplate.replace("CLASSPATH=\$classpath", "CLASSPATH=\$classpath:.")
65+
else ->
66+
error("Unexpected script")
67+
}
68+
generator.template = resources.text.fromString(newTemplate)
69+
}
70+
}
71+
5872
tasks.create<Copy>("addResources") {
5973
from(projectDir)
6074
include("templates/cv.html")
@@ -93,17 +107,7 @@ extensions.configure<GraalVMExtension> {
93107
val monitoring =
94108
if (getProperty("enableMonitoring") == "true") "--enable-monitoring" else null
95109

96-
listOfNotNull(
97-
static,
98-
monitoring,
99-
"--enable-preview",
100-
"--enable-http",
101-
"--enable-https",
102-
"--enable-url-protocols=classpath",
103-
"--initialize-at-build-time=com.hexagonkt.core.ClasspathHandler",
104-
"-R:MaxHeapSize=32m",
105-
)
106-
.forEach(buildArgs::add)
110+
listOfNotNull(static, monitoring).forEach(buildArgs::add)
107111
}
108112
}
109113
}

gradle/wrapper/gradle-wrapper.jar

502 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip
3+
distributionUrl=https://services.gradle.org/distributions/gradle-8.1-all.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

gradlew

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

logo.svg

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)