mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 06:14:45 +01:00
(fix) IntelliJ IDEA support & (actually) Fix removing compiled protos
This commit is contained in:
56
build.gradle
56
build.gradle
@@ -17,6 +17,7 @@ plugins {
|
|||||||
id 'com.google.protobuf' version '0.8.19'
|
id 'com.google.protobuf' version '0.8.19'
|
||||||
|
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
|
id 'idea'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.encoding = "UTF-8"
|
compileJava.options.encoding = "UTF-8"
|
||||||
@@ -25,38 +26,42 @@ compileTestJava.options.encoding = "UTF-8"
|
|||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
|
var shouldGenerateProto = System.getenv("GENERATE_PROTO") == "true"
|
||||||
|
System.out.println(shouldGenerateProto ?
|
||||||
|
"Generating proto files" :
|
||||||
|
"Skipping proto generation")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
protobuf {
|
protobuf {
|
||||||
protoc {
|
protoc {
|
||||||
artifact = 'com.google.protobuf:protoc:3.24.3'
|
artifact = 'com.google.protobuf:protoc:3.24.3'
|
||||||
}
|
}
|
||||||
plugins {
|
|
||||||
quickbuf {
|
|
||||||
artifact = 'us.hebi.quickbuf:protoc-gen-quickbuf:1.3.1'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.getenv("GENERATE_PROTO") == "true") {
|
plugins {
|
||||||
generateProtoTasks {
|
quickbuf {
|
||||||
all().each { task ->
|
artifact = 'us.hebi.quickbuf:protoc-gen-quickbuf:1.3.1'
|
||||||
task.builtins {
|
}
|
||||||
remove java
|
}
|
||||||
}
|
|
||||||
task.plugins {
|
generateProtoTasks {
|
||||||
quickbuf {
|
all().each { task ->
|
||||||
//option 'store_unknown_fields=true'
|
task.builtins {
|
||||||
outputSubDir = ''
|
remove java
|
||||||
}
|
}
|
||||||
|
task.plugins {
|
||||||
|
quickbuf {
|
||||||
|
//option 'store_unknown_fields=true'
|
||||||
|
outputSubDir = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generatedFilesBaseDir = "$projectDir/src/generated/"
|
generatedFilesBaseDir = "$projectDir/src/generated/"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -143,6 +148,15 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
// proto files and generated Java files are automatically added as
|
||||||
|
// source dirs.
|
||||||
|
// If you have additional sources, add them here:
|
||||||
|
sourceDirs += file('/proto/')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eclipse {
|
eclipse {
|
||||||
classpath {
|
classpath {
|
||||||
file.whenMerged { cp ->
|
file.whenMerged { cp ->
|
||||||
@@ -172,7 +186,11 @@ public final class BuildConfig {
|
|||||||
task updateProto {
|
task updateProto {
|
||||||
group 'Build'
|
group 'Build'
|
||||||
description 'Cleans generated proto folder and regenerates protos'
|
description 'Cleans generated proto folder and regenerates protos'
|
||||||
dependsOn 'clean'
|
|
||||||
|
if (shouldGenerateProto) {
|
||||||
|
dependsOn 'clean'
|
||||||
|
}
|
||||||
|
|
||||||
dependsOn 'generateProto'
|
dependsOn 'generateProto'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user