Skip to content

Commit

Permalink
implement
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jun 5, 2024
1 parent 164cb6b commit 7d701fc
Show file tree
Hide file tree
Showing 21 changed files with 940 additions and 61 deletions.
8 changes: 8 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 74 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,92 @@
plugins {
kotlin("jvm") version "1.9.23"
kotlin("jvm") version "1.9.22"
`java-gradle-plugin`
`maven-publish`
}

group = "xyz.wagyourtail.unimined"
group = "xyz.wagyourtail.unimined.expect-platform"
version = "1.0-SNAPSHOT"

base {
archivesName.set("expect-platform")
}

val annotations by sourceSets.creating {}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
}

val asmVersion: String by project.properties

dependencies {
implementation(gradleApi())
implementation("org.ow2.asm:asm:${asmVersion}")

testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.jar {

manifest {
attributes(
"Manifest-Version" to "1.0",
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
)
}
}

val annotationJar = tasks.register<Jar>("annotationJar") {
archiveClassifier.set("annotations")
from(annotations.output)

manifest {
attributes(
"Manifest-Version" to "1.0",
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
)
}
}

kotlin {
jvmToolchain(8)
}
}

gradlePlugin {
plugins {
create("simplePlugin") {
id = "xyz.wagyourtail.unimined.expect-platform"
implementationClass = "xyz.wagyourtail.unimined.expect.ExpectPlatformPlugin"
}
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = "xyz.wagyourtail.unimined.expect-platform"
artifactId = "expect-platform"
version = project.version.toString()

from(components["java"])

artifact(annotationJar) {
classifier = "annotations"
}
}
}
}
108 changes: 108 additions & 0 deletions expect-platform-test/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import xyz.wagyourtail.unimined.expect.task.ExpectPlatformFiles
import xyz.wagyourtail.unimined.expect.task.ExpectPlatformJar

buildscript {
repositories {
mavenCentral()
flatDir {
dirs("../build/libs")
}
}
dependencies {
classpath "xyz.wagyourtail.unimined.expect-platform:expect-platform:1.0-SNAPSHOT"
classpath "org.ow2.asm:asm:9.7"
}
}

plugins {
id 'java'
// id 'xyz.wagyourtail.unimined.expect-platform'
}

apply plugin: 'xyz.wagyourtail.unimined.expect-platform'


sourceSets {
a {
compileClasspath += sourceSets.main.output
}
b {
compileClasspath += sourceSets.main.output
}
c {
compileClasspath += sourceSets.main.output
}
}

repositories {
flatDir {
dirs "../build/libs"
}
}

dependencies {
implementation(expectPlatform.annotationsDep)
}

tasks.create("aExpectPlatform", ExpectPlatformFiles) {
platformName = "a"
inputCollection = sourceSets.main.output
}

tasks.create("bExpectPlatform", ExpectPlatformFiles) {
platformName = "b"
inputCollection = sourceSets.main.output
}

tasks.create("cExpectPlatform", ExpectPlatformFiles) {
platformName = "c"
inputCollection = sourceSets.main.output
}

tasks.register('runA', JavaExec) {
dependsOn(tasks.aExpectPlatform)
classpath = sourceSets.a.runtimeClasspath + tasks.aExpectPlatform.outputCollection
mainClass = 'xyz.wagyourtail.ept.Main'
group = 'ept'

System.out.println("classpath: " + classpath.files)
}

tasks.register('runB', JavaExec) {
dependsOn(tasks.bExpectPlatform)
classpath = sourceSets.b.runtimeClasspath + tasks.bExpectPlatform.outputCollection
mainClass = 'xyz.wagyourtail.ept.Main'
group = 'ept'
}

tasks.register('runC', JavaExec) {
dependsOn(tasks.cExpectPlatform)
classpath = sourceSets.c.runtimeClasspath + tasks.cExpectPlatform.outputCollection
mainClass = 'xyz.wagyourtail.ept.Main'
group = 'ept'
}

tasks.register('jarA', ExpectPlatformJar) {
platformName = "a"
inputFiles = sourceSets.main.output
from sourceSets.a.output
archiveFileName = "a.jar"
}

tasks.register('jarB', ExpectPlatformJar) {
platformName = "b"
inputFiles = sourceSets.main.output
from sourceSets.b.output
archiveFileName = "b.jar"
}

tasks.register('jarC', ExpectPlatformJar) {
platformName = "c"
inputFiles = sourceSets.main.output
from sourceSets.c.output
archiveFileName = "c.jar"
}

assemble.dependsOn(tasks.jarA)
assemble.dependsOn(tasks.jarB)
assemble.dependsOn(tasks.jarC)
Binary file not shown.
7 changes: 7 additions & 0 deletions expect-platform-test/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 7d701fc

Please sign in to comment.