Skip to content
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
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- "**"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build and test
run: ./gradlew build
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish

on:
release:
types:
- published
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Publish to GitHub Packages
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: ./gradlew publish
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Ignore Kotlin plugin data
.kotlin
107 changes: 107 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.jvm.tasks.Jar

plugins {
`java-library`
`maven-publish`
}

repositories {
mavenCentral()
}

val javacExports = listOf(
"jdk.compiler/com.sun.tools.javac.api",
"jdk.compiler/com.sun.tools.javac.code",
"jdk.compiler/com.sun.tools.javac.tree",
"jdk.compiler/com.sun.tools.javac.util",
)

val java8Compiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}

dependencies {
compileOnly(files(java8Compiler.map { it.metadata.installationPath.file("lib/tools.jar") }))
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
}

tasks.named<JavaCompile>("compileJava") {
javaCompiler = java8Compiler
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.named<JavaCompile>("compileTestJava") {
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
jvmArgs(javacExports.map { export -> "--add-exports=$export=ALL-UNNAMED" })
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}

tasks.named<Jar>("jar") {
manifest {
attributes["Automatic-Module-Name"] = "net.ikvm.javarefplugin"
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifactId = rootProject.name
pom {
name = "java-ref-plugin"
description = project.description.toString()
url = "https://github.com/ikvmnet/java-ref-plugin"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "ikvmnet"
name = "IKVM"
}
}
scm {
connection = "scm:git:https://github.com/ikvmnet/java-ref-plugin.git"
developerConnection = "scm:git:ssh://git@github.com/ikvmnet/java-ref-plugin.git"
url = "https://github.com/ikvmnet/java-ref-plugin"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
val repositoryPath = providers.environmentVariable("GITHUB_REPOSITORY")
.orElse("ikvmnet/java-ref-plugin")
url = uri("https://maven.pkg.github.com/${repositoryPath.get()}")
credentials {
username = providers.gradleProperty("githubUsername")
.orElse(providers.environmentVariable("GITHUB_ACTOR"))
.orNull
password = providers.gradleProperty("githubToken")
.orElse(providers.environmentVariable("GITHUB_TOKEN"))
.orNull
}
}
}
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
org.gradle.configuration-cache=true
group=net.ikvm
version=0.1.0-SNAPSHOT
description=Javac plugin that rewrites concrete method bodies into NoSuchMethodError throws for reference-only API artifacts.
5 changes: 5 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[versions]
junit-jupiter = "6.0.1"

[libraries]
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
9 changes: 9 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading