Skip to content

Commit

Permalink
refactor: reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
ngyewch committed Jul 23, 2024
1 parent 7c2c538 commit 3dd8e43
Show file tree
Hide file tree
Showing 29 changed files with 441 additions and 50 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/
.gradle/
build/
java/

3 changes: 1 addition & 2 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tools]
task = "3.38.0"
go = "1.22.5"
protoc = "27.2"
act = "0.2.64"
java = "temurin-11.0.24+8"
"go:github.com/psampaz/go-mod-outdated" = "0.9.0"

2 changes: 0 additions & 2 deletions gradle.properties

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore → java/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.gradle/
build/

File renamed without changes.
4 changes: 4 additions & 0 deletions java/.mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
task = "3.38.0"
java = "temurin-11.0.24+8"
go = "1.22.5"
43 changes: 43 additions & 0 deletions java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
`maven-publish`
id("com.autonomousapps.dependency-analysis") version "1.32.0"
id("com.diffplug.spotless") version "6.25.0"
id("com.github.ben-manes.versions") version "0.51.0"
id("com.gradleup.nmcp") version "0.0.9"
id("se.ascp.gradle.gradle-versions-filter") version "0.1.16"
}

subprojects {
apply(plugin = "maven-publish")
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "se.ascp.gradle.gradle-versions-filter")

publishing {
repositories {
maven {
name = "build"
url = uri(rootProject.layout.buildDirectory.dir("repo"))
}
}
}

versionsFilter {
gradleReleaseChannel.set("current")
checkConstraints.set(true)
outPutFormatter.set("json")
}
}

nmcp {
publishAggregation {
username = project.properties["mavenCentralUsername"] as String?
password = project.properties["mavenCentralPassword"] as String?
publicationType = "AUTOMATIC"
}
}

versionsFilter {
gradleReleaseChannel.set("current")
checkConstraints.set(true)
outPutFormatter.set("json")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ gradlePlugin {
implementationClass = "io.github.ngyewch.protoc.plugin.ProtocPlugin"
}
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void apply(Project project) {
outputAscFile.getParentFile().mkdirs();
});
task.getOutputs().file(outputExeFile);
task.commandLine("go", "build", "-o", outputExeFile);
task.commandLine("go", "build", "-o", outputExeFile, "../..");
task.environment("GOOS", buildParameters.getGoos());
task.environment("GOARCH", buildParameters.getGoarch());
});
Expand Down
2 changes: 2 additions & 0 deletions java/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
group=io.github.ngyewch.twirp
version=0.1.1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 8 additions & 22 deletions build.gradle.kts → java/protoc-gen-twirp-java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
plugins {
`java-library`
`maven-publish`
signing
id("com.gradleup.nmcp") version "0.0.9"
id("io.github.ngyewch.protoc.plugin")
id("com.autonomousapps.dependency-analysis") version "1.32.0"
id("com.diffplug.spotless") version "6.25.0"
id("com.github.ben-manes.versions") version "0.51.0"
id("se.ascp.gradle.gradle-versions-filter") version "0.1.16"
}

repositories {
mavenCentral()
}

dependencies {
api(platform("com.google.protobuf:protobuf-bom:4.27.2"))
api(platform("io.helidon:helidon-bom:2.6.7"))

api("com.google.protobuf:protobuf-java")
implementation("com.google.protobuf:protobuf-java-util")
api("io.helidon.common:helidon-common-http")
implementation("io.helidon.common:helidon-common-reactive")
implementation("io.helidon.media:helidon-media-common")
implementation("io.helidon.webclient:helidon-webclient")
api("io.helidon.webserver:helidon-webserver")
//id("com.autonomousapps.dependency-analysis") version "1.32.0"
//id("com.diffplug.spotless") version "6.25.0"
//id("com.github.ben-manes.versions") version "0.51.0"
//id("se.ascp.gradle.gradle-versions-filter") version "0.1.16"
}

publishing {
Expand Down Expand Up @@ -60,23 +42,27 @@ publishing {
}
}
}
/*
repositories {
maven {
name = "build"
url = uri(layout.buildDirectory.dir("repo"))
}
}
*/
}

signing {
useGpgCmd()
sign(publishing.publications["maven"])
}

/*
nmcp {
publishAllPublications {
username = project.properties["mavenCentralUsername"] as String?
password = project.properties["mavenCentralPassword"] as String?
publicationType = "AUTOMATIC"
}
}
*/
8 changes: 8 additions & 0 deletions java/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rootProject.name = "twirp"

rootDir.listFiles()?.filter { f ->
f.isDirectory && (f.name != "buildSrc")
&& (File(f, "build.gradle").isFile || File(f, "build.gradle.kts").isFile)
}?.forEach { f ->
include(f.name)
}
61 changes: 61 additions & 0 deletions java/twirp-bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
`java-platform`
`maven-publish`
signing
}

javaPlatform {
allowDependencies()
}

dependencies {
api(platform("com.google.protobuf:protobuf-bom:4.27.2"))
api(platform("io.helidon:helidon-bom:2.6.7"))

constraints {
api(project(":twirp-common"))
api(project(":twirp-helidon-common"))
api(project(":twirp-helidon-client"))
api(project(":twirp-helidon-server"))
}
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String

from(components["javaPlatform"])

pom {
name = project.name
description = "Twirp BOM."
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
licenses {
license {
name = "MIT License"
url = "https://github.com/ngyewch/protoc-gen-twirp-java/blob/main/LICENSE"
}
}
scm {
connection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
developerConnection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
}
developers {
developer {
id.set("ngyewch")
name.set("Nick Ng")
}
}
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications["maven"])
}
63 changes: 63 additions & 0 deletions java/twirp-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
plugins {
`java-library`
`maven-publish`
signing
id("com.diffplug.spotless")
}

java {
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String

from(components["java"])

pom {
name = project.name
description = "Twirp common."
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
licenses {
license {
name = "MIT License"
url = "https://github.com/ngyewch/protoc-gen-twirp-java/blob/main/LICENSE"
}
}
scm {
connection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
developerConnection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
}
developers {
developer {
id.set("ngyewch")
name.set("Nick Ng")
}
}
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications["maven"])
}

spotless {
java {
googleJavaFormat("1.18.1").reflowLongStrings().skipJavadocFormatting()
formatAnnotations()
targetExclude("build/**")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.github.ngyewch.twirp;

public class Constants {
public static final String PROTOBUF_CONTENT_TYPE = "application/protobuf";
public static final String JSON_CONTENT_TYPE = "application/json";
}
75 changes: 75 additions & 0 deletions java/twirp-helidon-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
plugins {
`java-library`
`maven-publish`
signing
id("com.diffplug.spotless")
}

java {
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
}

dependencies {
api(platform(project(":twirp-bom")))

implementation(project(":twirp-helidon-common"))

api("com.google.protobuf:protobuf-java")
implementation("com.google.protobuf:protobuf-java-util")
api("io.helidon.common:helidon-common-http")
implementation("io.helidon.common:helidon-common-reactive")
implementation("io.helidon.webclient:helidon-webclient")
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String

from(components["java"])

pom {
name = project.name
description = "Twirp Helidon client."
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
licenses {
license {
name = "MIT License"
url = "https://github.com/ngyewch/protoc-gen-twirp-java/blob/main/LICENSE"
}
}
scm {
connection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
developerConnection = "scm:git:git@github.com:ngyewch/protoc-gen-twirp-java.git"
url = "https://github.com/ngyewch/protoc-gen-twirp-java"
}
developers {
developer {
id.set("ngyewch")
name.set("Nick Ng")
}
}
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications["maven"])
}

spotless {
java {
googleJavaFormat("1.18.1").reflowLongStrings().skipJavadocFormatting()
formatAnnotations()
targetExclude("build/**")
}
}
Loading

0 comments on commit 3dd8e43

Please sign in to comment.