Skip to content

Commit

Permalink
拥抱jdk17;升级版本 1.3.0;
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1t3p1g committed Jan 17, 2024
1 parent 6674270 commit 6bfcbb9
Show file tree
Hide file tree
Showing 32 changed files with 291 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ cql.txt
env/data
env/import
.DS_Store
jre_libs
17 changes: 11 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.7'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
}

group = 'tabby'
version = '1.2.0.RELEASE'
sourceCompatibility = '1.8'
version = '1.3.0'

java {
sourceCompatibility = '17'
}

configurations {
compileOnly {
Expand All @@ -31,9 +34,11 @@ dependencies {
implementation 'org.soot-oss:soot:4.4.1'
// implementation 'ca.mcgill.sable:soot:4.0.0'

implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.tomcat:tomcat-jasper:9.0.56'

// jsp plugin dependencies
implementation 'org.apache.tomcat:tomcat-jasper:10.1.18'
implementation 'org.apache.ant:ant:1.10.12'

compileOnly 'org.slf4j:slf4j-api'
Expand Down
3 changes: 2 additions & 1 deletion config/settings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ tabby.output.directory = ./output/dev
tabby.debug.details = false

# jdk settings
tabby.build.isJRE9Module = false
tabby.build.javaHome = /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
tabby.build.isJDKProcess = false
tabby.build.withAllJDK = false
tabby.build.excludeJDK = false
tabby.build.isJDKOnly = false

# dealing fatjar
Expand Down
4 changes: 3 additions & 1 deletion doc/Tabby 配置文件介绍.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ tabby.build.isNeedToCreateIgnoreList = false
#### 配置 jdk 依赖是否参与分析
```properties
# jdk settings
tabby.build.isJRE9Module = false # 指代下述javaHome版本是否 >= 9
tabby.build.javaHome = /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
tabby.build.isJDKProcess = false # 分析过程是否加入基础的2个jdk依赖
tabby.build.withAllJDK = false # 分析过程是否加入全量的jdk依赖
tabby.build.excludeJDK = false # 分析过程是否剔除当前运行环境的jdk依赖,此时target目录需要提供需要分析的jdk依赖
tabby.build.isJDKOnly = false # 分析过程是否仅分析jdk依赖,不会去分析target目录下的文件
```
如果 javaHome 所指向的路径是 jdk >= 9, 第一次生成jre_libs目录会花一点时间,请耐心等待。

#### 配置分析目标

Expand Down
Binary file removed env/tabby-path-finder-1.0.jar
Binary file not shown.
Binary file added env/tabby-path-finder-1.1.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
if [ $1 = 'build' ]
then
echo "start to run tabby"
java -Xmx16g -jar build/libs/tabby.jar
elif [ $1 = 'load' ]
then
Expand Down
32 changes: 31 additions & 1 deletion src/main/java/tabby/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import sun.misc.Signal;
import tabby.common.utils.FileUtils;
import tabby.config.GlobalConfiguration;
import tabby.core.Analyser;
import tabby.common.utils.FileUtils;

@Slf4j
@SpringBootApplication
Expand All @@ -30,6 +32,21 @@ public static void main(String[] args) {
SpringApplication.run(App.class, args).close();
}

public void setJavaHome(){
// set java home
if(GlobalConfiguration.TARGET_JAVA_HOME == null){
String javaHome = System.getProperty("java.home");
if(javaHome == null){
javaHome = System.getenv("JAVA_HOME");
}
if(javaHome != null){
GlobalConfiguration.TARGET_JAVA_HOME = javaHome;
}
}

log.info("Analysis target java.home: " + GlobalConfiguration.TARGET_JAVA_HOME);
}

public void setLogDebugLevel(){
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
if(GlobalConfiguration.DEBUG) {
Expand All @@ -42,12 +59,25 @@ CommandLineRunner run(){
return args -> {
try{
GlobalConfiguration.initConfig();
setJavaHome();
setLogDebugLevel();
Signal.handle(new Signal("INT"), // SIGINT
signal -> {
log.error("Force Stop by control+c");
stopThreads(GlobalConfiguration.tabbyCollectorExecutor);
System.exit(0);
});
analyser.run();
}catch (IllegalArgumentException e){
log.error(e.getMessage() + ", Please check your settings.properties file.");
}
log.info("Done. Bye!");
};
}

public static void stopThreads(ThreadPoolTaskExecutor executor){
if(executor != null && executor.getActiveCount() > 0){
executor.shutdown();
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/tabby/analysis/data/FileLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.apache.commons.lang3.RandomStringUtils;
import tabby.config.GlobalConfiguration;
import tabby.common.utils.FileUtils;
import tabby.plugin.JspCompilePlugin;
import tabby.plugin.jsp.JspCompilePlugin;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.reflect.TypeToken;
import tabby.config.GlobalConfiguration;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.reflect.TypeToken;
import tabby.config.GlobalConfiguration;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.reflect.TypeToken;
import tabby.config.GlobalConfiguration;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.reflect.TypeToken;
import tabby.config.GlobalConfiguration;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.reflect.TypeToken;
import tabby.config.GlobalConfiguration;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import tabby.common.bean.ref.MethodReference;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

/**
* @author wh1t3P1g
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/tabby/common/bean/edge/Alias.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import tabby.common.bean.ref.MethodReference;
import tabby.common.utils.HashingUtils;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;

/**
* @author wh1t3P1g
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tabby/common/bean/edge/Call.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tabby.common.bean.ref.MethodReference;
import tabby.common.utils.HashingUtils;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.*;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tabby/common/bean/edge/Extend.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import tabby.common.bean.ref.ClassReference;
import tabby.common.utils.HashingUtils;

import javax.persistence.*;
import jakarta.persistence.*;

/**
* @author wh1t3P1g
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tabby/common/bean/edge/Has.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tabby.common.bean.ref.MethodReference;
import tabby.common.utils.HashingUtils;

import javax.persistence.*;
import jakarta.persistence.*;

/**
* @author wh1t3P1g
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/tabby/common/bean/edge/Interfaces.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import tabby.common.bean.ref.ClassReference;
import tabby.common.utils.HashingUtils;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;

/**
* @author wh1t3P1g
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tabby/common/bean/ref/ClassReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import tabby.common.bean.converter.List2JsonStringConverter;
import tabby.common.bean.converter.Map2JsonStringForAnnotationsConverter;

import javax.persistence.*;
import jakarta.persistence.*;
import java.nio.charset.StandardCharsets;
import java.util.*;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tabby/common/bean/ref/MethodReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import tabby.common.bean.edge.Call;
import tabby.common.utils.SemanticUtils;

import javax.persistence.*;
import jakarta.persistence.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
Loading

0 comments on commit 6bfcbb9

Please sign in to comment.