-
Notifications
You must be signed in to change notification settings - Fork 67
Split signature-generator and Gradle plugin into separate projects #124
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
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8abc330
Annotate file paths with `@Language("file-reference")` (#126)
aSemy 3bec20a
Update to Gradle 8 (#122)
aSemy 8803529
Update to Gradle 8
aSemy 070b323
initial convention plugins
aSemy 5a18844
comment out AGP
aSemy a3c33d5
update libs.versions.toml
aSemy 84857fb
fixes after rebase
aSemy ee05a88
apply BCV, create API dump
aSemy 223b410
commit API dump
aSemy 0d4c5b0
split signature-generator and Gradle plugin into two separate subproj…
aSemy e11432a
Merge branch 'feat/apply_bcv' into feat/split_projects
aSemy d934ebe
split the .api file
aSemy d99463e
move api dumps
aSemy 3c61170
update api dump files
aSemy 3d15e8c
update comments
aSemy 201b2d0
use typesafe project-accessor
aSemy 2ba179a
update comment for gradle-kotlin-dsl-plugins dependency
aSemy bef42e0
Initial Gradle convention plugins (#123)
aSemy 20c5f21
Merge branch 'bcv-gradle-rework' into feat/apply_bcv
aSemy 6e44e7b
Merge branch 'feat/apply_bcv' into feat/split_projects
aSemy 14bd77c
Apply BCV, commit API dump (#131)
aSemy 62abbcf
Merge branch 'bcv-gradle-rework' into feat/split_projects
aSemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,72 @@ | ||
| # Project exclude paths | ||
| /.gradle/ | ||
| /build/ | ||
| /buildSrc/.gradle/ | ||
| /buildSrc/build/ | ||
| /sample-project/build/ | ||
| /.idea/ | ||
| ### Kotlin/JVM ### | ||
| *.class | ||
| *.log | ||
|
|
||
| hs_err_pid* | ||
| replay_pid* | ||
| *.hprof | ||
|
|
||
| *.jar | ||
| *.war | ||
| *.nar | ||
| *.ear | ||
| *.zip | ||
| *.tar.gz | ||
| *.rar | ||
|
|
||
|
|
||
| ### IntelliJ ### | ||
| .idea | ||
|
|
||
|
|
||
| ### Eclipse ### | ||
| .metadata | ||
| bin/ | ||
| tmp/ | ||
| *.tmp | ||
| *.bak | ||
| *.swp | ||
| *~.nib | ||
| .settings/ | ||
| .loadpath | ||
| .recommenders | ||
| .classpath | ||
|
|
||
| .apt_generated/ | ||
| .apt_generated_test/ | ||
| .project | ||
|
|
||
|
|
||
| ### Linux ### | ||
| *~ | ||
| .fuse_hidden* | ||
| .Trash-* | ||
| .nfs* | ||
|
|
||
|
|
||
| ### Windows ### | ||
| [Dd]esktop.ini | ||
| $RECYCLE.BIN/ | ||
| *.lnk | ||
|
|
||
|
|
||
| ### macOS ### | ||
| .DS_Store | ||
| ._* | ||
|
|
||
|
|
||
| # Icon must end with two \r | ||
| Icon | ||
|
|
||
|
|
||
| ########################### | ||
|
|
||
| ### Gradle ### | ||
| .gradle | ||
| build/ | ||
|
|
||
|
|
||
| # Put unignores last so they don't get accidentally re-ignored | ||
| !gradle/wrapper/gradle-wrapper.jar | ||
| !gradle/wrapper/gradle-wrapper.properties | ||
| !/.idea/copyright |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,168 +1,9 @@ | ||
| import com.gradle.publish.* | ||
| import kotlinx.validation.build.* | ||
| import org.jetbrains.kotlin.gradle.tasks.* | ||
|
|
||
| plugins { | ||
| kotlin("jvm") | ||
| `java-gradle-plugin` | ||
| id("com.gradle.plugin-publish") apply false | ||
| signing | ||
| `maven-publish` | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
| google() | ||
| } | ||
|
|
||
| sourceSets { | ||
| test { | ||
| java.srcDir("src/test/kotlin") | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| create("functionalTest") { | ||
| withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) { | ||
| } | ||
| compileClasspath += sourceSets.main.get().output + configurations.testRuntimeClasspath | ||
| runtimeClasspath += output + compileClasspath | ||
| } | ||
| } | ||
|
|
||
| tasks.register<Test>("functionalTest") { | ||
| testClassesDirs = sourceSets["functionalTest"].output.classesDirs | ||
| classpath = sourceSets["functionalTest"].runtimeClasspath | ||
| } | ||
| tasks.check { dependsOn(tasks["functionalTest"]) } | ||
|
|
||
| // While gradle testkit supports injection of the plugin classpath it doesn't allow using dependency notation | ||
| // to determine the actual runtime classpath for the plugin. It uses isolation, so plugins applied by the build | ||
| // script are not visible in the plugin classloader. This means optional dependencies (dependent on applied plugins - | ||
| // for example kotlin multiplatform) are not visible even if they are in regular gradle use. This hack will allow | ||
| // extending the classpath. It is based upon: https://docs.gradle.org/6.0/userguide/test_kit.html#sub:test-kit-classpath-injection | ||
|
|
||
| // Create a configuration to register the dependencies against | ||
| val testPluginRuntimeConfiguration = configurations.register("testPluginRuntime") | ||
|
|
||
| // The task that will create a file that stores the classpath needed for the plugin to have additional runtime dependencies | ||
| // This file is then used in to tell TestKit which classpath to use. | ||
| val createClasspathManifest = tasks.register("createClasspathManifest") { | ||
| val outputDir = buildDir.resolve("cpManifests") | ||
| inputs.files(testPluginRuntimeConfiguration) | ||
| .withPropertyName("runtimeClasspath") | ||
| .withNormalizer(ClasspathNormalizer::class) | ||
|
|
||
| outputs.dir(outputDir) | ||
| .withPropertyName("outputDir") | ||
|
|
||
| doLast { | ||
| outputDir.mkdirs() | ||
| file(outputDir.resolve("plugin-classpath.txt")).writeText(testPluginRuntimeConfiguration.get().joinToString("\n")) | ||
| } | ||
| } | ||
|
|
||
| val kotlinVersion: String by project | ||
| val androidGradlePluginVersion: String = "7.2.2" | ||
|
|
||
| configurations.implementation { | ||
| exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib") | ||
| exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7") | ||
| exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8") | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(gradleApi()) | ||
| implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.0") | ||
| implementation("org.ow2.asm:asm:9.2") | ||
| implementation("org.ow2.asm:asm-tree:9.2") | ||
| implementation("com.googlecode.java-diff-utils:diffutils:1.3.0") | ||
| compileOnly("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.8.10") | ||
| // compileOnly("com.android.tools.build:gradle:${androidGradlePluginVersion}") | ||
|
|
||
| // The test needs the full kotlin multiplatform plugin loaded as it has no visibility of previously loaded plugins, | ||
| // unlike the regular way gradle loads plugins. | ||
| add(testPluginRuntimeConfiguration.name, "org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:$kotlinVersion") | ||
| add(testPluginRuntimeConfiguration.name, "com.android.tools.build:gradle:${androidGradlePluginVersion}") | ||
|
|
||
| testImplementation(kotlin("test-junit")) | ||
| "functionalTestImplementation"(files(createClasspathManifest)) | ||
|
|
||
| "functionalTestImplementation"("org.assertj:assertj-core:3.18.1") | ||
| "functionalTestImplementation"(gradleTestKit()) | ||
| "functionalTestImplementation"(kotlin("test-junit")) | ||
| } | ||
|
|
||
| tasks.compileKotlin { | ||
| kotlinOptions.apply { | ||
| allWarningsAsErrors = true | ||
|
|
||
| languageVersion = "1.4" | ||
| apiVersion = "1.4" | ||
| jvmTarget = "1.8" | ||
|
|
||
| // Suppressing "w: Language version 1.4 is deprecated and its support will be removed" message | ||
| // because LV=1.4 in practice is mandatory as it is a default language version in Gradle 7.0+ for users' kts scripts. | ||
| freeCompilerArgs += "-Xsuppress-version-warnings" | ||
| } | ||
| } | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| } | ||
|
|
||
| tasks { | ||
| compileTestKotlin { | ||
| kotlinOptions { | ||
| languageVersion = "1.6" | ||
| } | ||
| } | ||
| test { | ||
| systemProperty("overwrite.output", System.getProperty("overwrite.output", "false")) | ||
| systemProperty("testCasesClassesDirs", sourceSets.test.get().output.classesDirs.asPath) | ||
| jvmArgs("-ea") | ||
| } | ||
| } | ||
|
|
||
| properties["DeployVersion"]?.let { version = it } | ||
|
|
||
| publishing { | ||
| publications { | ||
| create<MavenPublication>("maven") { | ||
| from(components["java"]) | ||
| mavenCentralMetadata() | ||
| mavenCentralArtifacts(project, project.sourceSets.main.get().allSource) | ||
| } | ||
|
|
||
| mavenRepositoryPublishing(project) | ||
| mavenCentralMetadata() | ||
| } | ||
|
|
||
| publications.withType(MavenPublication::class).all { | ||
| signPublicationIfKeyPresent(this) | ||
| } | ||
| kotlinx.validation.build.conventions.base | ||
| id("org.jetbrains.kotlinx.binary-compatibility-validator") | ||
| } | ||
|
|
||
| apply(plugin = "org.gradle.java-gradle-plugin") | ||
| apply(plugin = "com.gradle.plugin-publish") | ||
|
|
||
| extensions.getByType(PluginBundleExtension::class).apply { | ||
| website = "https://github.com/Kotlin/binary-compatibility-validator" | ||
| vcsUrl = "https://github.com/Kotlin/binary-compatibility-validator" | ||
| tags = listOf("kotlin", "api-management", "binary-compatibility") | ||
| } | ||
|
|
||
| gradlePlugin { | ||
| testSourceSets(sourceSets["functionalTest"]) | ||
|
|
||
| plugins { | ||
| create("binary-compatibility-validator") { | ||
| id = "org.jetbrains.kotlinx.binary-compatibility-validator" | ||
| implementationClass = "kotlinx.validation.BinaryCompatibilityValidatorPlugin" | ||
| displayName = "Binary compatibility validator" | ||
| description = "Produces binary API dumps and compares them in order to verify that binary API is preserved" | ||
| } | ||
| } | ||
| group = "org.jetbrains.kotlinx" | ||
| providers.gradleProperty("DeployVersion").orNull?.let { | ||
| version = it | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Copyright 2016-2023 JetBrains s.r.o. | ||
| * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
| */ | ||
| import org.gradle.api.initialization.resolve.RepositoriesMode.PREFER_SETTINGS | ||
|
|
||
| rootProject.name = "buildSrc" | ||
|
|
||
| pluginManagement { | ||
| repositories { | ||
| gradlePluginPortal() | ||
| mavenCentral() | ||
| } | ||
| } | ||
|
|
||
| @Suppress("UnstableApiUsage") | ||
| dependencyResolutionManagement { | ||
|
|
||
| repositoriesMode.set(PREFER_SETTINGS) | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
| } | ||
|
|
||
| versionCatalogs { | ||
| create("libs") { | ||
| from(files("../gradle/libs.versions.toml")) | ||
| } | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I know you like removing the unnecessary src/main dirs, but in this case I thought it was extra configuration that didn't really bring much. Given how Gradle can be quite fragile, and how IntelliJ has tenuous support of buildSrc as it is, I thought it was better remove anything not strictly necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It brings a flat folder structure that we would like to embrace everywhere and get rid of the legacy nested format. Dogfooding and reporting all the problems in the process in an important part here.
I'm okay with this change and can tweak it later after all the merges though