Skip to content

Commit

Permalink
[BUILD] Extract dependency export from core into seperate bundle
Browse files Browse the repository at this point in the history
by creating a new bundle called "saros.libratory" which serves as a
dependency-container and replaces the previously used Core-bundle ("saros.core")
in this role.

This was done to reduce unnecessary coupling between the Core- and the Eclipse-bundle
caused by the Core-bundle's dependency exports.
Now the Core-bundle serves exclusively as a central library for a Saros-
implementation without also serving as a dependency container.
Since other packages (Intellij, Server,..) also used the Core's dependencies
those now get it's dependencies from the new Libratory-bundle too.

The following bundle-dependency-relations have been identified and get exported
by the Libratory-bundle:
(scheme: [bundle(s)]: * dependency of that bundles)
[core, eclipse, stf, sever, intellij]:
  * log4j-1.2-api-2.13.3.jar
  * log4j-api-2.13.3.jar
  * log4j-core-2.13.3.jar
  * picocontainer-2.11.2-patched_relocated.jar
[core, eclipse]:
  * weupnp.jar
  * smackx-3.4.1.jar
[core, eclipse, stf, sever]:
  * smack-3.4.1.jar (Patches for the "smack"-bundle have also been moved from core to
    (libratory)

Also the "xpp3"-bundle has been moved to libratory which prevents the following error:
"java.lang.LinkageError: loader constraint violation: loader [...] previously
initiated loading for a different type with name "org/xmlpull/v1/XmlPullParser"
The error is triggered by the fact that both the "smack"- and the "xpp3"-bundles contain
the library "org.xmlpull" while "xpp3" was previously still contained in the core-bundle.
That seemed to cause the error since both bundles tried to load the same library.
If both packages (smack, xpp3) are contained in the same bundle (which is now the
libratory- and was previously the core-bundle) then it does not seem to cause a problem
which is the reason for moving xpp3.
The error is explained further in the following two sources:
* http://frankkieviet.blogspot.com/2009/03/javalanglinkageerror-loader-constraint.html
* https://stackoverflow.com/questions/18127431/spring-java-lang-linkageerror-loader-constraint-violation-loader-previously-in/18315346#18315346
  • Loading branch information
Eik0fresh authored and FKHals committed Feb 3, 2021
1 parent 2b64170 commit a22d557
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 76 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,29 @@ buildSrc/.gradle
/core/lib
/stf/lib
/stf.test/lib
/libratory/lib
/eclipse/build
/core/build
/server/build
/intellij/build
/stf/build
/stf.test/build
/libratory/build
/eclipse/.classpath
/core/.classpath
/server/.classpath
/intellij/.classpath
/stf/.classpath
/stf.test/.classpath
/libratory/.classpath
/eclipse/.project
/core/.project
/server/.project
/intellij/.project
/stf/.project
/stf.test/.project
/libratory/.project

.DS_Store
/.gradle/
/build/
Expand Down
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ tasks {
register("generateLibAll") {
dependsOn(
"cleanGenerateLibAll",
":saros.libratory:generateLib",
":saros.core:generateLib",
":saros.eclipse:generateLib",
":saros.stf:generateLib",
Expand All @@ -190,6 +191,7 @@ tasks {

register("cleanGenerateLibAll") {
doLast {
project(":saros.libratory").file("lib").deleteRecursively()
project(":saros.eclipse").file("lib").deleteRecursively()
project(":saros.core").file("lib").deleteRecursively()
project(":saros.stf").file("lib").deleteRecursively()
Expand Down Expand Up @@ -233,11 +235,13 @@ tasks {
dependsOn(
":saros.core:test",
":saros.eclipse:test",
":saros.eclipse:jar")
":saros.eclipse:jar",
":saros.libratory:jar")

group = "Build"
description = "Builds and tests all modules required by Saros for Eclipse"

from(project(":saros.libratory").tasks.findByName("jar"))
from(project(":saros.core").tasks.findByName("jar"))
from(project(":saros.eclipse").tasks.findByName("jar"))
into("build/distribution/eclipse")
Expand Down
55 changes: 2 additions & 53 deletions core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Bundle-Name: Saros Core
Bundle-SymbolicName: saros.core
Bundle-Version: 0.2.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: saros.libratory
Export-Package: com.thoughtworks.xstream,
com.thoughtworks.xstream.annotations,
com.thoughtworks.xstream.converters,
Expand Down Expand Up @@ -94,64 +95,12 @@ Export-Package: com.thoughtworks.xstream,
org.apache.commons.lang3,
org.apache.commons.lang3.exception,
org.apache.commons.lang3.time,
org.apache.commons.lang3.tuple,
org.apache.log4j,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.spi,
org.apache.logging.log4j,
org.apache.logging.log4j.core,
org.apache.logging.log4j.core.appender,
org.apache.logging.log4j.core.config,
org.apache.logging.log4j.status,
org.apache.logging.log4j.core.lookup,
org.bitlet.weupnp,
org.jivesoftware.smack,
org.jivesoftware.smack.debugger,
org.jivesoftware.smack.filter,
org.jivesoftware.smack.packet,
org.jivesoftware.smack.provider,
org.jivesoftware.smack.proxy,
org.jivesoftware.smack.util,
org.jivesoftware.smackx,
org.jivesoftware.smackx.bytestreams,
org.jivesoftware.smackx.bytestreams.ibb,
org.jivesoftware.smackx.bytestreams.socks5,
org.jivesoftware.smackx.filetransfer,
org.jivesoftware.smackx.muc,
org.jivesoftware.smackx.packet,
org.jivesoftware.smackx.search,
saros.repackaged.picocontainer,
saros.repackaged.picocontainer.adapters,
saros.repackaged.picocontainer.annotations,
saros.repackaged.picocontainer.behaviors,
saros.repackaged.picocontainer.classname,
saros.repackaged.picocontainer.composers,
saros.repackaged.picocontainer.containers,
saros.repackaged.picocontainer.converters,
saros.repackaged.picocontainer.injectors,
saros.repackaged.picocontainer.lifecycle,
saros.repackaged.picocontainer.monitors,
saros.repackaged.picocontainer.parameters,
saros.repackaged.picocontainer.paranamer,
saros.repackaged.picocontainer.references,
saros.repackaged.picocontainer.security,
saros.repackaged.picocontainer.visitors,
org.xmlpull.mxp1,
org.xmlpull.v1
org.apache.commons.lang3.tuple
Bundle-ClassPath: .,
lib/smack-3.4.1.jar,
lib/log4j-core-2.13.3.jar,
lib/log4j-api-2.13.3.jar,
lib/log4j-1.2-api-2.13.3.jar,
lib/smackx-3.4.1.jar,
lib/commons-codec-1.3.jar,
lib/commons-io-2.0.1.jar,
lib/commons-lang3-3.8.1.jar,
lib/xstream-1.4.10.jar,
lib/xpp3-1.1.4c.jar,
lib/picocontainer-2.11.2-patched_relocated.jar,
lib/weupnp.jar,
lib/libidn-1.15.jar,
log4j2.component.properties
Bundle-Vendor: Saros Project
18 changes: 4 additions & 14 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,27 @@ configurations {

sarosEclipse {
manifest = file("META-INF/MANIFEST.MF")
excludeManifestDependencies = listOf("saros.libratory")
isCreateBundleJar = true
isAddPdeNature = true
pluginVersionQualifier = versionQualifier
}

dependencies {
implementation(project(":saros.libratory"))

releaseDep("commons-codec:commons-codec:1.3")
releaseDep("commons-io:commons-io:2.0.1")
releaseDep("org.apache.commons:commons-lang3:3.8.1")

releaseDep("javax.jmdns:jmdns:3.4.1")
releaseDep("xpp3:xpp3:1.1.4c")
releaseDep("com.thoughtworks.xstream:xstream:1.4.10")
releaseDep("org.gnu.inet:libidn:1.15")

releaseDep(log4j2ApiVersion)
releaseDep(log4j2CoreVersion)
releaseDep(log4j2BridgeVersion)

// TODO: use real release. This version is a customized SNAPSHOT
releaseDep(files("libs/weupnp.jar"))
// Workaround until we updated to a newer smack version
releaseDep(files("libs/smack-3.4.1.jar"))
releaseDep(files("libs/smackx-3.4.1.jar"))
// Workaround until we can publish and use (without a user token) the repackaged jar in GitHub Packages
releaseDep(rootProject.files("libs/picocontainer-2.11.2-patched_relocated.jar"))
}

sourceSets {
main {
java.srcDirs("src", "patches")
java.srcDirs("src")
resources.srcDirs("resources")
}
test {
Expand Down
3 changes: 1 addition & 2 deletions core/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source.. = src/,\
patches/
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
Expand Down
3 changes: 2 additions & 1 deletion eclipse/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.security,
org.junit;resolution:=optional,
org.eclipse.jdt.launching;resolution:=optional,
saros.core
saros.core,
saros.libratory
Bundle-ActivationPolicy: lazy
Export-Package: saros;
uses:="org.eclipse.core.runtime,
Expand Down
7 changes: 5 additions & 2 deletions eclipse/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ configurations {

sarosEclipse {
manifest = file("META-INF/MANIFEST.MF")
excludeManifestDependencies = listOf("saros.core", "org.junit", "org.eclipse.gef")
excludeManifestDependencies = listOf("saros.libratory", "saros.core", "org.junit", "org.eclipse.gef")
isAddPdeNature = true
isCreateBundleJar = true
isAddDependencies = true
Expand All @@ -39,12 +39,14 @@ sourceSets {
}

dependencies {
implementation(project(":saros.libratory"))
implementation(project(":saros.core"))
// This is a workaround for https://github.com/saros-project/saros/issues/1086
implementation("org.eclipse.platform:org.eclipse.urischeme:1.1.0")
// This is a workaround for https://github.com/saros-project/saros/issues/1114
implementation("org.eclipse.platform:org.eclipse.ui.ide:3.17.200")
implementation("org.eclipse.platform:org.eclipse.ui.workbench:3.120.0")
testImplementation(project(path = ":saros.libratory", configuration = "testing"))
testImplementation(project(path = ":saros.core", configuration = "testing"))
}

Expand Down Expand Up @@ -113,7 +115,7 @@ tasks {
* |- site.xml
*/
val updateSitePreparation by registering(Copy::class) {
dependsOn(":saros.core:jar", ":saros.eclipse:jar")
dependsOn(":saros.core:jar", ":saros.libratory:jar", ":saros.eclipse:jar")

into(updateSiteDirPath)
into("features") {
Expand All @@ -122,6 +124,7 @@ tasks {
into("plugins") {
from(project.tasks.findByName("jar"))
from(project(":saros.core").tasks.findByName("jar"))
from(project(":saros.libratory").tasks.findByName("jar"))
}
from("update/site.xml")
}
Expand Down
7 changes: 7 additions & 0 deletions eclipse/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,11 @@ Public License instead of this License.
version="0.2.0"
unpack="false"/>

<plugin
id="saros.libratory"
download-size="0"
install-size="0"
version="1.0.0"
unpack="false"/>

</feature>
2 changes: 2 additions & 0 deletions intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ configurations {
}

dependencies {
implementation(project(":saros.libratory", configuration = "plain"))
compile(project(path = ":saros.core", configuration = "plain"))

compile("org.easytesting:fest-assert:1.2")
compile("org.easytesting:fest-reflect:1.2")
compile("org.easytesting:fest-swing:1.2.1")
compile("org.easytesting:fest-util:1.1.3")

testImplementation(project(path = ":saros.libratory", configuration = "testing"))
testCompile(project(path = ":saros.core", configuration = "testing"))
}

Expand Down
64 changes: 64 additions & 0 deletions libratory/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Saros Libratory
Bundle-SymbolicName: saros.libratory
Bundle-Version: 1.0.0
Automatic-Module-Name: libratory
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.apache.log4j,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.spi,
org.apache.logging.log4j,
org.apache.logging.log4j.core,
org.apache.logging.log4j.core.appender,
org.apache.logging.log4j.core.config,
org.apache.logging.log4j.status,
org.apache.logging.log4j.core.lookup,
org.bitlet.weupnp,
org.jivesoftware.smack,
org.jivesoftware.smack.debugger,
org.jivesoftware.smack.filter,
org.jivesoftware.smack.packet,
org.jivesoftware.smack.provider,
org.jivesoftware.smack.proxy,
org.jivesoftware.smack.util,
org.jivesoftware.smackx,
org.jivesoftware.smackx.bytestreams,
org.jivesoftware.smackx.bytestreams.ibb,
org.jivesoftware.smackx.bytestreams.socks5,
org.jivesoftware.smackx.entitycaps,
org.jivesoftware.smackx.entitycaps.packet,
org.jivesoftware.smackx.filetransfer,
org.jivesoftware.smackx.muc,
org.jivesoftware.smackx.packet,
org.jivesoftware.smackx.search,
saros.repackaged.picocontainer,
saros.repackaged.picocontainer.adapters,
saros.repackaged.picocontainer.annotations,
saros.repackaged.picocontainer.behaviors,
saros.repackaged.picocontainer.classname,
saros.repackaged.picocontainer.composers,
saros.repackaged.picocontainer.containers,
saros.repackaged.picocontainer.converters,
saros.repackaged.picocontainer.injectors,
saros.repackaged.picocontainer.lifecycle,
saros.repackaged.picocontainer.monitors,
saros.repackaged.picocontainer.parameters,
saros.repackaged.picocontainer.paranamer,
saros.repackaged.picocontainer.references,
saros.repackaged.picocontainer.security,
saros.repackaged.picocontainer.visitors,
org.xmlpull.mxp1,
org.xmlpull.v1
Bundle-ClassPath: .,
lib/smack-3.4.1.jar,
lib/log4j-core-2.13.3.jar,
lib/log4j-api-2.13.3.jar,
lib/log4j-1.2-api-2.13.3.jar,
lib/smackx-3.4.1.jar,
lib/xpp3-1.1.4c.jar,
lib/picocontainer-2.11.2-patched_relocated.jar,
lib/weupnp.jar
Bundle-Vendor: Saros Project

Loading

0 comments on commit a22d557

Please sign in to comment.