Skip to content

Commit

Permalink
Merge pull request #10 from willarmiros/release-2
Browse files Browse the repository at this point in the history
Prepares release 0.10.0
  • Loading branch information
willarmiros authored Aug 27, 2020
2 parents c6e793d + c89ee7b commit 00d3c27
Show file tree
Hide file tree
Showing 235 changed files with 13,230 additions and 2,106 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Change Log

## Version 0.10.0 - 08/25/2020

* Added SQL interception package [PR #10](https://github.com/awslabs/disco/pull/10)
* Added AWS interception package [PR #10](https://github.com/awslabs/disco/pull/10)
* Added instrumentation preprocess package [PR #10](https://github.com/awslabs/disco/pull/10)
* Added Bill of Materials [PR #10](https://github.com/awslabs/disco/pull/10)
* Added installable `Package` class for collections of installables [PR #10](https://github.com/awslabs/disco/pull/10)
* Added concurrency support for `ScheduledThreadPoolExecutor` [PR #10](https://github.com/awslabs/disco/pull/10)
* Added Service downstream cancellation events [PR #10](https://github.com/awslabs/disco/pull/10)
* Added `HeaderReplaceable` interface for event classes [PR #10](https://github.com/awslabs/disco/pull/10)
* Added `removeMetadata` method for Transaction Context [PR #10](https://github.com/awslabs/disco/pull/10)
* Added support in core package for preprocess build tool [PR #10](https://github.com/awslabs/disco/pull/10)
* Fixed deprecated reflective access in `ForkJoinTask` tests [PR #10](https://github.com/awslabs/disco/pull/10)
* Fixed null pointer issues in `HttpResponseEvent` and `TransactionContext` [PR #10](https://github.com/awslabs/disco/pull/10)
* Fixed `ExecutorService` to use re-entrancy check [PR #10](https://github.com/awslabs/disco/pull/10)
* Fixed flaky TX tests [PR #10](https://github.com/awslabs/disco/pull/10)
* Ensure transaction context is propagated for nested executor submissions [PR #10](https://github.com/awslabs/disco/pull/10)
* Deprecated `MethodHandleWrapper` class [PR #10](https://github.com/awslabs/disco/pull/10)
* Upgraded ByteBuddy to 1.10.14 and ASM to 8.0.1 [PR #10](https://github.com/awslabs/disco/pull/10)
* Upgraded to Gradle 6.6 [PR #10](https://github.com/awslabs/disco/pull/10)

## Version 0.9.1 - 12/2/2019

* Initial commit of DiSCo Toolkit
47 changes: 28 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,36 +170,43 @@ Unfortunately this can mean that they *sometimes* fail and require restarting. W

### Including Disco as a dependency in your product

Until we publish to Maven, you can run ``./gradlew publishToMavenLocal``, and consume from your local Maven cache
in your Maven or Gradle builds with e.g:

<br/>
Disco is available in Maven Central. A Bill of Materials (BOM) package is vended to make depending on multiple
Disco packages easier.

#### Using Maven coordinates
```xml
<dependency>
<groupId>software.amazon.disco</groupId>
<artifactId>disco-java-agent-api</artifactId>
<version>0.9.1</version>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.disco</groupId>
<artifactId>disco-toolkit-bom</artifactId>
<version>0.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.disco</groupId>
<artifactId>disco-java-agent-api</artifactId>
</dependency>
<!-- Other Disco dependencies -->
</dependencies>
```

#### Using Gradle's default DSL
```groovy
repositories {
mavenLocal()
}
compile 'software.amazon.disco:disco-java-agent-api:0.9.1'
implementation platform('software.amazon.disco:disco-toolkit-bom:0.10.0')
implementation 'software.amazon.disco:disco-java-agent-api'
// Other disco dependencies
```

#### Using Gradle's Kotlin DSL
```kotlin
repositories {
mavenLocal()
}

compile("software.amazon.disco", "disco-java-agent-api", "0.9.1")
implementation(platform("software.amazon.disco:disco-toolkit-bom:0.10.0"))
implementation("software.amazon.disco:disco-java-agent-api")
// Other disco dependencies
```

### Troubleshooting
Expand Down Expand Up @@ -228,6 +235,8 @@ a few layers and families of projects in here:
1. Canonical Pluggable agent, capable of plugin discovery, in disco-java-agent/disco-java-agent
1. A facility to 'Inject' a Disco Agent into managed runtimes like AWS Lambda
1. A Plugin to support Servlets and Apache HTTP clients, in disco-java-agent-web-plugin
1. A Plugin to support SQL connections & queries using JDBC, in disco-java-agent-sql-plugin
1. A Plugin to support requests made with the AWS SDK for Java, in disco-java-agent-aws-plugin
1. Example code in anything with '-example' in the project name.
1. Tests in anything with '-test' in the project name.

Expand Down
206 changes: 133 additions & 73 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,122 +18,148 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
//common features available to the entire project
//TODO specify the versions of ByteBuddy and ASM in here, since they are used in a few places.
plugins {
id("com.github.johnrengelman.shadow") version "5.1.0" apply false
java
`maven-publish`
}

//This is not a subproject that contains code, nor produces any artifacts. Disable the jar task
//to prevent a useless empty jar file being produced as a build side effect.
tasks {
named<Jar>("jar") {
setEnabled(false)
}
id("com.github.johnrengelman.shadow") version "5.2.0" apply false
}

subprojects {
apply<JavaPlugin>()

version = "0.9.1"
version = "0.10.0"

repositories {
mavenCentral()
}

dependencies {
testCompile("org.mockito", "mockito-core", "1.+")
}

configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}

tasks {
pluginManager.withPlugin("com.github.johnrengelman.shadow") {
// Set up creation of shaded Jars
pluginManager.withPlugin("com.github.johnrengelman.shadow") {
tasks {
named<ShadowJar>("shadowJar") {

//suppress the "-all" suffix on the jar name, simply replace the default built jar instead (disco-java-agent-web-plugin-x.y.z.jar)
archiveClassifier.set(null as String?)

//Must relocate both of these inner dependencies of the Disco agent, to avoid conflicts in your customer's application
relocate("org.objectweb.asm", "software.amazon.disco.agent.jar.asm")
relocate("net.bytebuddy", "software.amazon.disco.agent.jar.bytebuddy")
}

//once gradle has made its default jar, follow up by producing the shadow/uber jar
assemble {
named<DefaultTask>("assemble") {
dependsOn(named<ShadowJar>("shadowJar"))
}
named<ShadowJar>("shadowJar") {
dependsOn(jar)
dependsOn(named<Jar>("jar"))
}
}
}

plugins.withId("java-library") {
dependencies {
add("testImplementation", "junit:junit:4.12")
add("testImplementation", "org.mockito:mockito-core:3.+")
}

configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}

// This block only applies to plugin modules, as determined by the existence of a "-plugin" suffix
if (project.name.endsWith("-plugin")) {
// Remove "-plugin" suffix to get corresponding library name
val libraryName = ":" + project.name.subSequence(0, project.name.length - 7)
val ver = project.version

// Configure dependencies common to plugins
dependencies {
add("runtimeOnly", project(libraryName)) {
// By setting the isTransitive flag false, we take only what is described by the above project, and not
// its entire closure of transitive dependencies (i.e. all of Core, all of Bytebuddy, etc)
// this makes our generated Jar minimal, containing only our source files, and our manifest. All those
// other dependencies are expected to be in the base agent, which loads this plugin.
isTransitive = false
}

// Test target is integ tests for Disco plugins. Some classes in the integ tests also self-test via
// little unit tests during testrun.
add("testImplementation", project(":disco-java-agent:disco-java-agent-api"))
add("testImplementation", "org.mockito:mockito-core:1.+")
}

// Configure integ tests, which need a loaded agent, and the loaded plugin
tasks.named<Test>("test") {
// explicitly remove the runtime classpath from the tests since they are integ tests, and may not access the
// dependency we acquired in order to build the plugin, namely the library jar for this plugin which makes reference
// to byte buddy classes which have NOT been relocated by a shadowJar rule. Discovering those unrelocated classes
// would not be possible in a real client installation, and would cause plugin loading to fail.
classpath = classpath.minus(configurations.named<Configuration>("runtimeClasspath").get())

//load the agent for the tests, and have it discover the plugin
jvmArgs("-javaagent:../../disco-java-agent/disco-java-agent/build/libs/disco-java-agent-$ver.jar=pluginPath=./build/libs:extraverbose")

//we do not take any normal compile/runtime dependency on this, but it must be built first since the above jvmArg
//refers to its built artifact.
dependsOn(":disco-java-agent:disco-java-agent:build")
dependsOn("$libraryName:${project.name}:assemble")
}
}
}

//we publish everything except example subprojects to maven. Projects which desire to be published to maven express the intent
//via a property called simply 'maven' in their gradle.properties file (if it exists at all).
//Each package to be published still needs a small amount of boilerplate to express whether is is a 'normal'
//library which expresses its dependencies, or a shadowed library which includes and hides them. For a normal one
//e.g. Core or Web, that boilerplate may look like:
// configure<PublishingExtension> {
// publications {
// named<MavenPublication>("maven") {
// from(components["java"])
// }
// }
// }
//
// whereas a shadowed artifact would be declared along the lines of:
//
// configure<PublishingExtension> {
// publications {
// named<MavenPublication>("maven") {
// artifact(tasks.jar.get())
// }
// }
// }
//
//which declares the jar and the jar alone as the artifact, suppressing the default behaviour of gathering dependency info
//
//TODO: find a way to express this just once in the block below, probably by inspecting the existence or absence
//of the shadow plugin, or the ShadowJar task. So far attempts to consolidate this logic have not succeeded, hence
//the current need for the above boilerplate.
//by using the "maven-publish" plugin.
//
//TODO: apply some continuous integration rules to publish to Maven automatically when e.g. version number increases
//
//Publication to local Maven is simply "./gradlew publishToMavenLocal"
if (hasProperty("maven")) {
apply(plugin = "maven-publish")
plugins.withId("maven-publish") {
plugins.apply("signing")

plugins.withId("java-library") {
//create a task to publish our sources
tasks.register<Jar>("sourcesJar") {
from(project.the<SourceSetContainer>()["main"].allJava)
archiveClassifier.set("sources")
}

//create a task to publish our sources
tasks.register<Jar>("sourcesJar") {
from(sourceSets.main.get().allJava)
archiveClassifier.set("sources")
//create a task to publish javadoc
tasks.register<Jar>("javadocJar") {
from(tasks.named<Javadoc>("javadoc"))
archiveClassifier.set("javadoc")
}
}

//create a task to publish javadoc
tasks.register<Jar>("javadocJar") {
from(tasks.javadoc)
archiveClassifier.set("javadoc")
// Disable publishing a bunch of unnecessary Gradle metadata files
tasks.withType<GenerateModuleMetadata> {
enabled = false
}

//defer maven publish until the assemble task has finished, giving time for shadowJar to complete, if it is present
tasks.withType<AbstractPublishToMaven> {
dependsOn(tasks.assemble)
dependsOn(tasks.named<DefaultTask>("assemble"))
}

//all our maven publications have similar characteristics, declare as much as possible here at the top level
configure<PublishingExtension> {
repositories {
maven {
}
}
publications {
create<MavenPublication>("maven") {
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])

groupId = "software.amazon.disco"
// Define what artifact to publish depending on what plugin is present
// If shadow is present, we should publish the shaded JAR
// Otherwise, publish the standard JAR from compilation
plugins.withId("java-library") {
if (plugins.hasPlugin("com.github.johnrengelman.shadow")) {
artifact(tasks.named<Jar>("jar").get())
} else {
from(components["java"])
}

artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
}

// For publishing the BOM
plugins.withId("java-platform") {
from(components["javaPlatform"])
}

groupId = rootProject.name

pom {
name.set(groupId + ":" + artifactId)
Expand All @@ -151,6 +177,26 @@ subprojects {
name.set("Paul Connell")
email.set("[email protected]")
}
developer {
id.set("armiros")
name.set("William Armiros")
email.set("[email protected]")
}
developer {
id.set("ssirip")
name.set("Sai Siripurapu")
email.set("[email protected]")
}
developer {
id.set("liuhongb")
name.set("Hongbo Liu")
email.set("[email protected]")
}
developer {
id.set("besmithe")
name.set("Ben Smithers")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/awslabs/disco.git")
Expand All @@ -160,7 +206,21 @@ subprojects {
}
}
}

repositories {
maven {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = "${findProperty("disco.sonatype.username")}"
password = "${findProperty("disco.sonatype.password")}"
}
}
}
}

configure<SigningExtension> {
useGpgCmd()
sign(the<PublishingExtension>().publications["maven"])
}
}
}

Loading

0 comments on commit 00d3c27

Please sign in to comment.