diff --git a/psi-java-bundle-jar/build.gradle.kts b/psi-java-bundle-jar/build.gradle.kts deleted file mode 100644 index 1dc97bf6..00000000 --- a/psi-java-bundle-jar/build.gradle.kts +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2024, TeamDev. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import io.spine.internal.dependency.ErrorProne -import io.spine.internal.dependency.Gson -import io.spine.internal.dependency.Guava -import io.spine.internal.dependency.J2ObjC -import io.spine.internal.dependency.Protobuf -import io.spine.internal.dependency.Spine -import io.spine.internal.gradle.publish.SpinePublishing - -plugins { - module - `maven-publish` - id("com.github.johnrengelman.shadow") -} - -dependencies { - api(project(":psi-java")) -} - -/** The publishing settings from the root project. */ -val spinePublishing = rootProject.the() - -/** The ID of the far JAR artifact. */ -val projectArtifact = spinePublishing.artifactPrefix + "psi-java-bundle" - -project.description = "A fat JAR version of the `spine-psi-java` artifact." - -publishing { - val groupName = project.group.toString() - val versionName = project.version.toString() - - publications { - create("fatJar", MavenPublication::class) { - groupId = groupName - artifactId = projectArtifact - version = versionName - artifact(tasks.shadowJar) - } - } -} - -/** - * Declare dependency explicitly to address the Gradle warning. - */ -val publishFatJarPublicationToMavenLocal: Task by tasks.getting { - dependsOn(tasks.jar) - println("Task `${this.name}` now depends on `${tasks.jar.name}`.") -} - -tasks.publish { - dependsOn(tasks.shadowJar) -} - -tasks.shadowJar { - dependencies { - excludeExternalLibraries() - excludeSpineLibraries() - } - excludeFiles() - setZip64(true) /* The archive has way too many items. So using the Zip64 mode. */ - archiveClassifier.set("") /** To prevent Gradle setting something like `osx-x86_64`. */ - mergeServiceFiles("desc.ref") - mergeServiceFiles("META-INF/services/io.spine.option.OptionsProvider") -} - -/** - * Exclude libraries we use. - * - * PSI may also use these libraries, but we want to force their versions. - */ -private fun DependencyFilter.excludeExternalLibraries() { - ErrorProne.annotations.forEach { - exclude(dependency(it)) - } - exclude(dependency(J2ObjC.annotations)) - exclude(dependency(Guava.lib)) - exclude(dependency(Gson.lib)) - Protobuf.libs.forEach { - exclude(dependency(it)) - } -} - -/** - * Exclude all Spine libraries from the PSI fat JAR. - * - * These libraries will be available as separate dependencies. - */ -private fun DependencyFilter.excludeSpineLibraries() { - exclude(dependency(Spine.base)) - exclude(dependency(Spine.reflect)) - with(Spine.Logging) { - arrayOf( - lib, - libJvm, - platformGenerator, - julBackend, - jvmDefaultPlatform, - middleware - ).forEach { - exclude(dependency(it)) - } - } -} - -/** - * Exclude unwanted directories. - */ -private fun ShadowJar.excludeFiles() { - exclude( - /* - Exclude IntelliJ Platform images and other resources associated with IntelliJ UI. - We do not call the UI, so they won't be used. - */ - "actions/**", - "chooser/**", - "codeStyle/**", - "codeStylePreview/**", - "codeWithMe/**", - "darcula/**", - "debugger/**", - "diff/**", - "duplicates/**", - "expui/**", - "extensions/**", - "fileTemplates/**", - "fileTypes/**", - "general/**", - "graph/**", - "gutter/**", - "hierarchy/**", - "icons/**", - "ide/**", - "idea/**", - "inlayProviders/**", - "inspectionDescriptions/**", - "inspectionReport/**", - "intentionDescriptions/**", - "javadoc/**", - "javaee/**", - "json/**", - "liveTemplates/**", - "mac/**", - "modules/**", - "nodes/**", - "objectBrowser/**", - "plugins/**", - "postfixTemplates/**", - "preferences/**", - "process/**", - "providers/**", - "runConfigurations/**", - "scope/**", - "search/**", - "toolbar/**", - "toolbarDecorator/**", - "toolwindows/**", - "vcs/**", - "webreferences/**", - "welcome/**", - "windows/**", - "xml/**", - - /* - Exclude `https://github.com/JetBrains/pty4j`. - We don't need the terminal. - */ - "resources/com/pti4j/**", - - /* Exclude the IntelliJ fork of - `http://www.sparetimelabs.com/purejavacomm/purejavacomm.php`. - It is the part of the IDEA's terminal implementation. - */ - "purejavacomm/**", - - /* Exclude IDEA project templates. */ - "resources/projectTemplates/**", - - /* - Exclude dynamic libraries. Should the tool users need them, - they would add them explicitly. - */ - "bin/**", - - /* - Exclude Google Protobuf definitions to avoid duplicates. - */ - "google/**", - "src/google/**", - - /** - * Exclude Spine Protobuf definitions to avoid duplications. - */ - "spine/**", - - /** - * Exclude Kotlin runtime because it will be provided. - */ - "kotlin/**", - "kotlinx/**", - - /** - * Exclude native libraries related to debugging. - */ - "win32-x86/**", - "win32-x86-64/**", - - /** - * Exclude the Windows process management (WinP) libraries. - * See: `https://github.com/jenkinsci/winp`. - */ - "winp.dll", - "winp.x64.dll", - ) -} diff --git a/psi-java-bundle-test/build.gradle.kts b/psi-java-bundle-test/build.gradle.kts deleted file mode 100644 index 125e83ad..00000000 --- a/psi-java-bundle-test/build.gradle.kts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2024, TeamDev. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -plugins { - module -} - -/** - * This build runs tests from `psi-java` module using the JAR produced by - * the `psi-java-bundle-jar` module. - * - * This is needed to make sure that the FAT JAR produced by the `psi-java-bundle-jar` module - * satisfies our tests, meaning no important classes or resources were excluded during - * assembling of the JAR. - * - * To achieve the goal, we depend on test classes and the JAR, and then JUnit to - * run the test classes via the `testClassesDir` property of the `Test` task. - */ -@Suppress("PropertyName") -val ABOUT = "" - -val psiJavaProject = project(":psi-java") -val psiJavaBuildDir: DirectoryProperty = psiJavaProject.layout.buildDirectory -val psiTestClasses = files( - psiJavaBuildDir.dir("classes/kotlin/test"), - psiJavaBuildDir.dir("resources/test"), -) - -val psiBundleJarProject = project(":psi-java-bundle-jar") - -dependencies { - val shadowJar = psiBundleJarProject.tasks.getByName("shadowJar") - testImplementation(files(shadowJar)) - testImplementation(psiTestClasses) - - testImplementation(project(":plugin-testlib")) -} - -tasks.test { - testClassesDirs = psiTestClasses - dependsOn(psiJavaProject.tasks.getByName("compileTestKotlin")) - dependsOn(psiJavaProject.tasks.getByName("processTestResources")) - dependsOn(psiBundleJarProject.tasks.getByName("jar")) -}