Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish Kotlin migration #1012

Merged
merged 103 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
984c5a6
Set up Kotlin 2.0.21
Goooler Nov 5, 2024
69a13a6
Indicate Kotlin sourceSet into Groovy's
Goooler Nov 5, 2024
ef3e6d5
Convert LegacyShadowPlugin
Goooler Sep 19, 2024
6df054b
Revert "Indicate Kotlin sourceSet into Groovy's"
Goooler Nov 5, 2024
28cf15a
A new module for Kotlin sources
Goooler Nov 5, 2024
67354a2
Convert ShadowExtension
Goooler Nov 5, 2024
5914ab7
Convert KnowsTask
Goooler Nov 5, 2024
e146807
Convert DependencyFilter
Goooler Nov 5, 2024
9119173
Convert ZipCompressor
Goooler Nov 5, 2024
c279051
Convert JavaJarExec
Goooler Nov 5, 2024
4a9f041
Make JavaJarExec.jarFile as RegularFileProperty and fix the tests
Goooler Nov 6, 2024
efcc0cd
Convert CacheableRelocator
Goooler Nov 6, 2024
e85a9fa
Convert ShadowStats
Goooler Nov 6, 2024
a4514d9
Convert RelocatePathContext
Goooler Nov 6, 2024
23c2c65
Convert RelocateClassContext
Goooler Nov 6, 2024
0d55a48
Convert Relocator
Goooler Nov 6, 2024
ebce1aa
Convert InheritManifest
Goooler Nov 6, 2024
e1a831e
Convert SimpleRelocator
Goooler Nov 6, 2024
2e86d64
Rename TransformerContext.is
Goooler Nov 7, 2024
6a5da6a
Convert TransformerContext
Goooler Nov 7, 2024
4609753
Remove redundant types
Goooler Nov 7, 2024
c036c39
Convert Transformer
Goooler Nov 7, 2024
6e7d141
Declare -Xjvm-default=all
Goooler Nov 7, 2024
28ebf6f
Convert CacheableTransformer
Goooler Nov 7, 2024
018708b
Add NoOpTransformer
Goooler Nov 7, 2024
ae29e91
Convert ApacheLicenseResourceTransformer
Goooler Nov 7, 2024
184753a
Remove redundant ctors
Goooler Nov 7, 2024
9691b92
Convert DontIncludeResourceTransformer
Goooler Nov 7, 2024
3024765
Convert IncludeResourceTransformer
Goooler Nov 7, 2024
daca1ea
Convert AppendingTransformer
Goooler Nov 7, 2024
99ef1e7
Convert DefaultInheritManifest
Goooler Nov 7, 2024
3c31bd1
Replace Closure with Action in InheritManifest
Goooler Nov 7, 2024
b12bec0
Convert CleanProperties
Goooler Nov 7, 2024
ffb1104
Convert DefaultZipCompressor
Goooler Nov 7, 2024
b5c2450
Merge util classes
Goooler Nov 7, 2024
db30ea3
Convert AbstractDependencyFilter
Goooler Nov 7, 2024
a3d7b4d
Convert DefaultDependencyFilter
Goooler Nov 7, 2024
74e6e6b
Convert MinimizeDependencyFilter
Goooler Nov 7, 2024
c9af800
Convert UnusedTracker
Goooler Nov 7, 2024
6b66c36
Convert ManifestResourceTransformer
Goooler Nov 7, 2024
6b18a09
Convert XmlAppendingTransformer
Goooler Nov 7, 2024
f375dc7
Convert ManifestAppenderTransformer
Goooler Nov 7, 2024
15eb704
Convert ApacheNoticeResourceTransformer
Goooler Nov 8, 2024
a376198
Convert ComponentsXmlResourceTransformer
Goooler Nov 8, 2024
cdbc084
Convert GroovyExtensionModuleTransformer
Goooler Nov 8, 2024
590466a
Convert Log4j2PluginsCacheFileTransformer
Goooler Nov 8, 2024
6e7066b
Convert ShadowBasePlugin
Goooler Nov 8, 2024
041cc69
Unify SHADOW_NAME
Goooler Nov 8, 2024
3ba500c
Convert PropertiesFileTransformer
Goooler Nov 8, 2024
d1ae91f
Compile only shadow-gradle-plugin
Goooler Nov 9, 2024
29e53a7
Convert ShadowSpec
Goooler Nov 9, 2024
a9f2dc1
Convert RelocatorRemapper
Goooler Nov 9, 2024
b8fd7f8
Merge remote-tracking branch 'origin/main' into migrate-to-kotlin
Goooler Nov 9, 2024
d709c39
Convert ShadowPlugin
Goooler Nov 9, 2024
c1edf56
Convert ShadowJavaPlugin
Goooler Nov 9, 2024
8245228
Convert Utils
Goooler Nov 9, 2024
b6b5dbb
Convert ServiceFileTransformer
Goooler Nov 10, 2024
b17020d
Use delegations
Goooler Nov 10, 2024
4d00ba4
Remove type param from InheritManifest
Goooler Nov 10, 2024
ef24c89
Convert ShadowJar
Goooler Nov 10, 2024
589dc3d
Clean up ShadowApplicationPlugin
Goooler Nov 11, 2024
ae51233
Merge remote-tracking branch 'origin/main' into migrate-to-kotlin
Goooler Nov 14, 2024
35b4dc7
Tweak GradleRunner
Goooler Nov 11, 2024
e4efa35
Clean up ShadowApplicationPlugin a bit more
Goooler Nov 14, 2024
b774c74
Remove indent_size override rule
Goooler Nov 14, 2024
2d907e2
Trim indents
Goooler Nov 14, 2024
766ce07
Tweak JavaJarExec
Goooler Nov 14, 2024
6dca3b1
Convert ShadowApplicationPlugin
Goooler Nov 11, 2024
a896e7e
Fix CopySpec usages and CC issues in ShadowApplicationPlugin
Goooler Nov 14, 2024
fffbf3f
Defer Shadow Distribution creating
Goooler Nov 14, 2024
8df354b
Eliminate TODO in ShadowCopyAction
Goooler Nov 14, 2024
5e912fe
Convert ShadowCopyAction
Goooler Nov 14, 2024
0fa9e08
Eliminate api project
Goooler Nov 14, 2024
1408097
Remove license headers
Goooler Nov 14, 2024
47a9539
Disable indent_size and explicitApi to reduce the diffs
Goooler Nov 14, 2024
48f1f52
Revert "Disable indent_size and explicitApi to reduce the diffs"
Goooler Nov 14, 2024
9ba37eb
Tweak ShadowCopyAction
Goooler Nov 16, 2024
454d5be
Fix getParent
Goooler Nov 16, 2024
916d914
Revert JavaJarExec.jarFile type
Goooler Nov 16, 2024
fe87d8d
Revert "Revert JavaJarExec.jarFile type"
Goooler Nov 16, 2024
f80fe6c
Mark abstract classes
Goooler Nov 16, 2024
1fbaabb
Mark internal classes
Goooler Nov 16, 2024
dfb21e2
Mark open modifiers
Goooler Nov 16, 2024
11c567c
Mark public and open modifiers
Goooler Nov 16, 2024
c42bbb0
Trim blank lines
Goooler Nov 16, 2024
aac7914
Tweak ShadowStats
Goooler Nov 17, 2024
86e57b0
Cleanups
Goooler Nov 17, 2024
60e8b05
Mark TransformerContext.inputStream non-null
Goooler Nov 17, 2024
a2a3d15
Tweak deployment tasks for Kotlin doc
Goooler Nov 17, 2024
172b762
Remove extra java-gradle-plugin
Goooler Nov 17, 2024
7b134ee
Tweak ShadowCopyAction
Goooler Nov 18, 2024
6079bb6
Fix RelativeArchivePath
Goooler Nov 18, 2024
39c311c
Note the change
Goooler Nov 18, 2024
270419a
Simplify configureRelocation
Goooler Nov 18, 2024
46c7782
Eliminate MutableCollection usages
Goooler Nov 18, 2024
6d7ccca
Remove DefaultInheritManifest.writeTo(Writer)
Goooler Nov 18, 2024
617656f
Inline AppendingTransformer._data
Goooler Nov 19, 2024
88f7b5b
Tweak XmlAppendingTransformer
Goooler Nov 19, 2024
dd75039
Tweak ManifestAppenderTransformer
Goooler Nov 19, 2024
a9860bc
Simplify Log4j2PluginsCacheFileTransformer
Goooler Nov 20, 2024
2498384
Simplify ComponentsXmlResourceTransformer
Goooler Nov 20, 2024
7bdc4ab
Merge remote-tracking branch 'origin/main' into migrate-to-kotlin
Goooler Nov 20, 2024
672f73a
Fix merge
Goooler Nov 20, 2024
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
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{groovy,java}]
indent_size = 4

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = true
Expand Down
48 changes: 0 additions & 48 deletions api/build.gradle.kts

This file was deleted.

1 change: 1 addition & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repositories {
dependencies {
implementation("com.gradle.publish:plugin-publish-plugin:1.3.0")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.30.0")
implementation("org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin:1.9.20")
implementation("org.ajoberstar.git-publish:gradle-git-publish:4.2.2")
implementation("com.github.node-gradle:gradle-node-plugin:7.1.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gitPublish {
contents {
from("build/site")
into("api") {
from(tasks.named("groovydoc"))
from(tasks.named("dokkaHtml"))
}
filter<ReplaceTokens>(
"tokens" to mapOf(
Expand All @@ -33,5 +33,5 @@ val yarnBuild = tasks.named("yarn_build") {
}

tasks.gitPublishCopy {
dependsOn(yarnBuild, tasks.named("groovydoc"))
dependsOn(yarnBuild, tasks.named("dokkaHtml"))
}
11 changes: 1 addition & 10 deletions build-logic/src/main/kotlin/shadow.convention.publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.gradle.plugin-publish")
id("com.vanniktech.maven.publish")
id("org.jetbrains.dokka")
}

version = providers.gradleProperty("VERSION_NAME").get()
Expand Down Expand Up @@ -36,16 +37,6 @@ tasks.publishPlugins {
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/21283")
}

tasks.withType<Javadoc>().configureEach {
(options as? StandardJavadocDocletOptions)?.let {
it.links(
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://docs.groovy-lang.org/2.4.7/html/gapi/",
)
it.addStringOption("Xdoclint:none", "-quiet")
}
}

configurations {
listOf(
apiElements,
Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
kotlin("jvm") version "2.0.21"
groovy
`java-gradle-plugin`
groovy // Required for Spock tests.
id("shadow.convention.publish")
id("shadow.convention.deploy")
id("com.diffplug.spotless") version "7.0.0.BETA4"
Expand All @@ -16,6 +15,7 @@ java {
}

kotlin {
explicitApi()
compilerOptions {
// https://docs.gradle.org/current/userguide/compatibility.html#kotlin
apiVersion = KotlinVersion.KOTLIN_1_8
Expand All @@ -27,6 +27,9 @@ kotlin {
}

spotless {
kotlin {
ktlint()
}
kotlinGradle {
ktlint()
target("**/*.kts")
Expand All @@ -35,9 +38,6 @@ spotless {
}

dependencies {
compileOnly(localGroovy())
implementation(projects.api)

implementation("org.jdom:jdom2:2.0.6.1")
implementation("org.ow2.asm:asm-commons:9.7.1")
implementation("commons-io:commons-io:2.18.0")
Expand Down
3 changes: 0 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ dependencyResolutionManagement {
rootProject.name = "shadow"

enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

include(":api")
4 changes: 4 additions & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

## [Unreleased]

**Changed**

- **BREAKING CHANGE:** Rewrite this plugin in Kotlin. ([#1012](https://github.com/GradleUp/shadow/pull/1012))

**Removed**

- **BREAKING CHANGE:** Remove Develocity integration. ([#1013](https://github.com/GradleUp/shadow/pull/1013))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class ShadowPluginSpec extends PluginSpecification {
when:
run(['shadowJar']) {
it.withGradleVersion(version)
it.withDebug(true)
it.withTestKitDir(getTestKitDir())
}

then:
Expand All @@ -108,8 +106,6 @@ class ShadowPluginSpec extends PluginSpecification {
expect:
runWithFailure(['shadowJar']) {
it.withGradleVersion('7.0')
it.withDebug(true)
it.withTestKitDir(getTestKitDir())
}
}

Expand Down Expand Up @@ -387,7 +383,7 @@ class ShadowPluginSpec extends PluginSpecification {
package client;
import junit.framework.TestCase;
public class Client extends TestCase {
public static void main(String[] args) {}
public static void main(String[] args) {}
}
""".stripIndent()

Expand Down Expand Up @@ -1029,7 +1025,7 @@ class ShadowPluginSpec extends PluginSpecification {
version = '1.0'
repositories { maven { url "${repo.uri}" } }
dependencies { api project(':api') }

shadowJar.minimize()
""".stripIndent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ abstract class PluginSpecification extends Specification {
.withProjectDir(dir.toFile())
.forwardOutput()
.withPluginClasspath()
.withTestKitDir(testKitDir)
}

GradleRunner runner(Collection<String> tasks) {
Expand Down Expand Up @@ -177,7 +178,7 @@ abstract class PluginSpecification extends Specification {
return new File(this.class.classLoader.getResource(name).toURI())
}

static File getTestKitDir() {
protected static File getTestKitDir() {
def gradleUserHome = System.getenv("GRADLE_USER_HOME")
if (!gradleUserHome) {
gradleUserHome = new File(System.getProperty("user.home"), ".gradle").absolutePath
Expand Down