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

Add support for excluding extra packages #653

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 16 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
tab_width = 4
indent_size = 4
ij_continuation_indent_size = 8

tab_width = 2
indent_size = 2
ij_continuation_indent_size = 4
indent_style = space
trim_trailing_whitespace = true

[*.xml]
indent_style = tab
ij_any_blank_lines_after_imports = 2
ij_markdown_wrap_text_if_long = false

[*.{yml,yaml}]
indent_size = 2
ij_continuation_indent_size = 4

[*.{java,kt}]
ij_java_wrap_long_lines = false
indent_size = 4
ij_continuation_indent_size = 8


[*.{md,mkd,markdown}]
indent_size = 4
ij_continuation_indent_size = 8
trim_trailing_whitespace = false
ij_markdown_wrap_text_if_long = false


[*.xml]
indent_style = tab

38 changes: 16 additions & 22 deletions .github/workflows/strong_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,17 @@ jobs:
with:
submodules: recursive

- name: Setup Java 8
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 8
# https://github.com/actions/setup-java?tab=readme-ov-file#install-multiple-jdks
java-version: |
8
11
17
21
distribution: zulu
# only first java setup need enable cache
cache: maven
- name: Setup Java 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: microsoft
- name: Setup Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: microsoft
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu

- name: Run integration test
run: scripts/integration-test.sh
Expand All @@ -45,7 +34,12 @@ jobs:
run: rm -rf $HOME/.m2/repository/com/alibaba/{transmittable-thread-local,ttl}*

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# https://remarkablemark.org/blog/2017/10/12/check-git-dirty/
- name: Check git dirty
run: |
git status --short
[ -z "$(git status --short)" ]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ JDK Bug: <https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8021205>
logback扩展,集成transmittable-thread-local支持跨线程池的mdc跟踪
- [`oldratlee/log4j2-ttl-thread-context-map` ![](https://img.shields.io/github/stars/oldratlee/log4j2-ttl-thread-context-map.svg?style=social&label=Star)](https://github.com/oldratlee/log4j2-ttl-thread-context-map)
Log4j2 TTL ThreadContextMap, Log4j2 extension integrated TransmittableThreadLocal to MDC
- [`qqxx6661/log-record` ![](https://img.shields.io/github/stars/qqxx6661/log-record.svg?style=social&label=Star)](https://github.com/qqxx6661/log-record)
业务日志记录框架,使用注解优雅记录日志,支持SpEL表达式,自定义上下文,自定义函数,实体类DIFF等特性。
- **中间件/字节码**
- [`ymm-tech/easy-byte-coder` ![](https://img.shields.io/github/stars/ymm-tech/easy-byte-coder.svg?style=social&label=Star)](https://github.com/ymm-tech/easy-byte-coder)
Easy-byte-coder is a non-invasive bytecode injection framework based on JVM
Expand Down
72 changes: 29 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.alibaba.ttl3</groupId>
Expand Down Expand Up @@ -28,8 +28,8 @@
<url>https://github.com/alibaba/transmittable-thread-local</url>
</scm>
<issueManagement>
<url>https://github.com/alibaba/transmittable-thread-local/issues</url>
<system>GitHub Issues</system>
<url>https://github.com/alibaba/transmittable-thread-local/issues</url>
</issueManagement>
<ciManagement>
<system>GitHub Actions</system>
Expand Down Expand Up @@ -79,22 +79,22 @@
https://alibaba.github.io/transmittable-thread-local/apidocs/${project.version}
</javadoc.ttl.base.link>

<spotbugs.annotations.version>4.8.1</spotbugs.annotations.version>
<spotbugs.annotations.version>4.8.4</spotbugs.annotations.version>
<jsr305.version>3.0.2</jsr305.version>
<jetbrains.annotations.version>24.1.0</jetbrains.annotations.version>

<kotlin.version>1.9.21</kotlin.version>
<kotlin.version>1.9.24</kotlin.version>
<kotlin.compiler.jvmTarget>${maven.compiler.source}</kotlin.compiler.jvmTarget>
<kotlin.coroutine.version>1.7.3</kotlin.coroutine.version>
<kotlin.coroutine.version>1.8.0</kotlin.coroutine.version>
<!-- https://kotlin.github.io/dokka/1.7.10/user_guide/maven/usage/ -->
<dokka.version>1.9.10</dokka.version>
<dokka.version>1.9.20</dokka.version>
<dokka.link.jdk.version>8</dokka.link.jdk.version>

<slf4j.version>2.0.7</slf4j.version>

<!-- testing dependencies versions -->
<junit5.version>5.10.1</junit5.version>
<kotest.version>5.8.0</kotest.version>
<junit5.version>5.10.2</junit5.version>
<kotest.version>5.9.0</kotest.version>

<!--
slf4j simple logger configuration for test
Expand Down Expand Up @@ -196,7 +196,7 @@
<!-- https://github.com/raphw/byte-buddy/issues/1264 -->
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-parent</artifactId>
<version>1.14.10</version>
<version>1.14.15</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -255,7 +255,7 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.29.2-GA</version>
<version>3.30.2-GA</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -402,9 +402,6 @@
</execution>
</executions>
</plugin>
<!--
official docs: https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
-->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
Expand All @@ -415,6 +412,7 @@
</goals>
<configuration>
<rules>
<!-- official docs: https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html -->
<requireMavenVersion>
<version>3.3.9</version>
</requireMavenVersion>
Expand All @@ -441,19 +439,19 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.5</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.3</version>
<configuration>
<shadeSourcesContent>true</shadeSourcesContent>
<dependencyReducedPomLocation>
Expand All @@ -463,11 +461,11 @@
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.2</version>
<version>3.6.3</version>
</plugin>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
Expand All @@ -488,19 +486,19 @@
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
Expand All @@ -509,17 +507,17 @@
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>7.0.0</version>
<version>8.0.2</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.1.0</version>
<version>4.8.3.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<version>0.8.12</version>
</plugin>
<plugin>
<!--
Expand All @@ -528,7 +526,7 @@
-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<configuration>
<executable>${java.home}/bin/java</executable>
<classpathScope>test</classpathScope>
Expand All @@ -552,21 +550,10 @@
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
</plugin>
<plugin>
<!--
config example: https://github.com/mojohaus/versions-maven-plugin/issues/157#issuecomment-306041074
-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
<configuration>
<rulesUri>file://${maven.multiModuleProjectDirectory}/src/versions-rules.xml</rulesUri>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>gen-src</id>
Expand Down Expand Up @@ -607,10 +594,10 @@

About package-list vs.element-list
- Can't link to JDK10 in Javadoc comments
https://stackoverflow.com/a/49498219/922688
https://stackoverflow.com/a/49498219/922688
- Missing javadoc/package-list for release 5.1
https://github.com/gradle/gradle/issues/8183
https://github.com/gradle/gradle/commit/5e88351dd456a5252d21f3a7ad25bff1b62a2fd2
https://github.com/gradle/gradle/issues/8183
https://github.com/gradle/gradle/commit/5e88351dd456a5252d21f3a7ad25bff1b62a2fd2


Using the linkoffline Option
Expand All @@ -625,7 +612,6 @@
<plugin>
<!--
https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html

https://docs.oracle.com/en/java/javase/21/javadoc/javadoc-command.html
-->
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down Expand Up @@ -873,7 +859,7 @@
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.7.0</version>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
29 changes: 0 additions & 29 deletions src/versions-rules.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.alibaba.ttl3.agent;

import static com.alibaba.ttl3.agent.transformlet.helper.TtlTransformletHelper.isClassUnderPackage;
import static com.alibaba.ttl3.agent.transformlet.helper.TtlTransformletHelper.isUnnecessaryPackage;

import com.alibaba.ttl3.agent.logging.Logger;
import com.alibaba.ttl3.agent.transformlet.ClassInfo;
import com.alibaba.ttl3.agent.transformlet.TtlTransformlet;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.lang.instrument.ClassFileTransformer;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;

import static com.alibaba.ttl3.agent.transformlet.helper.TtlTransformletHelper.isClassUnderPackage;

/**
* TTL {@link ClassFileTransformer} of Java Agent
*
Expand Down Expand Up @@ -63,6 +63,7 @@ public final byte[] transform(@Nullable final ClassLoader loader, @Nullable fina
final ClassInfo classInfo = new ClassInfo(classFile, classFileBuffer, loader);
if (isClassUnderPackage(classInfo.getClassName(), "com.alibaba.ttl")) return NO_TRANSFORM;
if (isClassUnderPackage(classInfo.getClassName(), "java.lang")) return NO_TRANSFORM;
if (isUnnecessaryPackage(classInfo.getClassName())) return NO_TRANSFORM;

if (logClassTransform)
logger.info("[TtlTransformer] transforming " + classInfo.getClassName()
Expand Down
Loading