Skip to content

Commit 120aaab

Browse files
committed
Make this work against Gradle 7.1.1 in a good way, including the use of extensions, not conventions (it is now prettier in kts).
1 parent fff5050 commit 120aaab

File tree

9 files changed

+508
-427
lines changed

9 files changed

+508
-427
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

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

build.gradle.kts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (c) 2016.
3+
*
4+
* This file is part of kotlinsql.
5+
*
6+
* This file is licenced to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You should have received a copy of the license with the source distribution.
9+
* Alternatively, you may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*/
20+
21+
22+
plugins {
23+
`java-gradle-plugin`
24+
kotlin("jvm") version embeddedKotlinVersion
25+
`maven-publish`
26+
id("com.gradle.plugin-publish") version "0.14.0"
27+
}
28+
29+
version = "0.5.12"
30+
group = "net.devrieze"
31+
32+
base {
33+
archivesName.set("gradlecodegen")
34+
}
35+
36+
kotlin {
37+
target {
38+
compilations.all {
39+
kotlinOptions {
40+
apiVersion = "1.5"
41+
languageVersion = "1.5"
42+
jvmTarget = "1.8"
43+
}
44+
}
45+
}
46+
}
47+
48+
publishing {
49+
repositories {
50+
mavenLocal()
51+
}
52+
}
53+
54+
pluginBundle {
55+
website = "https://github.com/pdvrieze/gradle-codegen.git"
56+
vcsUrl = "https://github.com/pdvrieze/gradle-codegen.git"
57+
tags = listOf("generate", "codegen", "code-generation")
58+
}
59+
60+
gradlePlugin {
61+
plugins {
62+
register("gradlecodegen") {
63+
id = "net.devrieze.gradlecodegen"
64+
displayName = "Code generation plugin for gradle"
65+
description =
66+
"A plugin to aid with codeGeneration without using buildSrc. It provides an additional generate section to sourceSets. In this section individual files to be generated can be specified. Each sourceset has an accompanying ...generator sourceSet where the actual generator source can live. See https://github.com/pdvrieze/gradle-codegen for documentation"
67+
implementationClass = "net.devrieze.gradlecodegen.CodegenPlugin"
68+
}
69+
}
70+
}
71+
72+
val kotlin_version: String = embeddedKotlinVersion
73+
74+
dependencies {
75+
implementation(gradleApi())
76+
}
77+
78+
repositories {
79+
mavenLocal()
80+
mavenCentral()
81+
}

src/main/resources/META-INF/gradle-plugins/net.devrieze.gradlecodegen.properties renamed to gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
2-
# Copyright (c) 2016.
2+
# Copyright (c) 2021.
33
#
4-
# This file is part of kotlinsql.
4+
# This file is part of gradle-codegen.
55
#
66
# This file is licenced to you under the Apache License, Version 2.0 (the
77
# "License"); you may not use this file except in compliance
@@ -18,4 +18,4 @@
1818
# under the License.
1919
#
2020

21-
implementation-class=net.devrieze.gradlecodegen.CodegenPlugin
21+
kotlin_version = 1.5.21

settings.gradle

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
pluginManagement {
2+
repositories {
3+
mavenLocal()
4+
gradlePluginPortal()
5+
mavenCentral()
6+
}
7+
resolutionStrategy {
8+
eachPlugin {
9+
switch (requested.id.id) {
10+
case "net.devrieze.gradlecodegen":
11+
def ver = requested.version!=null ? requested.version : codegen_version
12+
useVersion(ver)
13+
break;
14+
case "org.jetbrains.kotlin.android":
15+
case "org.jetbrains.kotlin.jvm":
16+
case "kotlin-android-extensions" :
17+
case "org.jetbrains.kotlin.multiplatform":
18+
def ver = requested.version!=null ? requested.version : kotlin_version
19+
useVersion(ver)
20+
break
21+
case "org.jetbrains.dokka" :
22+
case "org.jetbrains.dokka-android" :
23+
def ver = requested.version!=null ? requested.version : dokkaVersion
24+
useVersion(ver)
25+
break
26+
case "org.jetbrains.kotlinx.binary-compatibility-validator" :
27+
def ver = requested.version!=null ? requested.version : validatorVersion
28+
useModule("org.jetbrains.kotlinx:binary-compatibility-validator:$ver")
29+
break
30+
case "kotlinx-serialization":
31+
def version = (requested.version == null || requested.version.length() == 0) ? kotlin_version : requested.version
32+
useModule("org.jetbrains.kotlin:kotlin-serialization:$version")
33+
break
34+
}
35+
}
36+
}
37+
38+
}
39+
40+
rootProject.name="gradle-codegen"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2021.
3+
*
4+
* This file is part of gradle-codegen.
5+
*
6+
* This file is licenced to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You should have received a copy of the license with the source distribution.
9+
* Alternatively, you may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*/
20+
21+
package net.devrieze.gradlecodegen
22+
23+
import org.gradle.api.file.FileCollection
24+
import java.io.Serializable
25+
26+
class GenerateDirSpec(): Serializable {
27+
var input: Any? = null
28+
var generator: String? = null
29+
var classpath: FileCollection? = null
30+
var outputDir: String? = null
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2021.
3+
*
4+
* This file is part of gradle-codegen.
5+
*
6+
* This file is licenced to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You should have received a copy of the license with the source distribution.
9+
* Alternatively, you may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*/
20+
21+
package net.devrieze.gradlecodegen
22+
23+
import org.gradle.api.file.FileCollection
24+
import java.io.Serializable
25+
26+
class GenerateSpec(val name: String): Serializable {
27+
var output: String? = null
28+
var generator: String? = null
29+
var classpath: FileCollection? = null
30+
var input: Any? = null
31+
}

0 commit comments

Comments
 (0)