Skip to content

Commit

Permalink
[Feature] split transform lib to a special folder
Browse files Browse the repository at this point in the history
  • Loading branch information
liunaijie committed Jul 12, 2024
1 parent 562712c commit 6676e20
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,38 @@ public static Path libDir() {
return Paths.get(getSeaTunnelHome(), "lib");
}

/** transform Dir */
public static Path transformsDir() {
return Paths.get(getSeaTunnelHome(), "transforms");
}

/** return lib jars, which located in 'lib/*' or 'lib/{dir}/*'. */
public static List<Path> getLibJars() {
Path libRootDir = Common.libDir();
Path transformsRootDir = Common.transformsDir();
if (!Files.exists(libRootDir) || !Files.isDirectory(libRootDir)) {
return Collections.emptyList();
}
List<Path> libPaths;
try (Stream<Path> stream = Files.walk(libRootDir, APP_LIB_DIR_DEPTH, FOLLOW_LINKS)) {
return stream.filter(it -> !it.toFile().isDirectory())
.filter(it -> it.getFileName().toString().endsWith(".jar"))
.collect(Collectors.toList());
libPaths =
stream.filter(it -> !it.toFile().isDirectory())
.filter(it -> it.getFileName().toString().endsWith(".jar"))
.collect(Collectors.toList());
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Path> transformPaths;
try (Stream<Path> stream = Files.walk(transformsRootDir, APP_LIB_DIR_DEPTH, FOLLOW_LINKS)) {
transformPaths =
stream.filter(it -> !it.toFile().isDirectory())
.filter(it -> it.getFileName().toString().endsWith(".jar"))
.collect(Collectors.toList());
} catch (IOException e) {
throw new RuntimeException(e);
}
libPaths.addAll(transformPaths);
return libPaths;
}

/** return the jar package configured in env jars */
Expand Down
33 changes: 15 additions & 18 deletions seatunnel-dist/src/main/assembly/assembly-bin-ci.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,25 +167,8 @@
<unpack>false</unpack>
<includes>
<include>org.apache.seatunnel:seatunnel-transforms-v2:jar</include>
<include>org.apache.hadoop:hadoop-aws:jar</include>
<include>com.amazonaws:aws-java-sdk-bundle:jar</include>
<include>org.apache.seatunnel:seatunnel-hadoop3-3.1.4-uber:jar:*:optional</include>
<!--Add hadoop aliyun jar -->
<include>org.apache.hadoop:hadoop-aliyun:jar</include>
<include>com.aliyun.oss:aliyun-sdk-oss:jar</include>
<include>org.jdom:jdom:jar</include>

<!--Add netty buffer jar -->
<include>io.netty:netty-buffer:jar</include>
<include>io.netty:netty-common:jar</include>

<!--Add hive exec jar -->
<include>org.apache.hive:hive-exec:jar</include>
<include>org.apache.hive:hive-service:jar</include>
<include>org.apache.thrift:libfb303:jar</include>
</includes>
<outputFileNameMapping>${artifact.file.name}</outputFileNameMapping>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>/transforms</outputDirectory>
<scope>provided</scope>
</dependencySet>

Expand All @@ -209,6 +192,20 @@
<include>com.amazon.redshift:redshift-jdbc42:jar</include>
<include>net.snowflake.snowflake-jdbc:jar</include>
<include>com.xugudb:xugu-jdbc:jar</include>
<include>org.apache.hadoop:hadoop-aws:jar</include>
<include>com.amazonaws:aws-java-sdk-bundle:jar</include>
<include>org.apache.seatunnel:seatunnel-hadoop3-3.1.4-uber:jar:*:optional</include>
<!--Add hadoop aliyun jar -->
<include>org.apache.hadoop:hadoop-aliyun:jar</include>
<include>com.aliyun.oss:aliyun-sdk-oss:jar</include>
<include>org.jdom:jdom:jar</include>
<!--Add netty buffer jar -->
<include>io.netty:netty-buffer:jar</include>
<include>io.netty:netty-common:jar</include>
<!--Add hive exec jar -->
<include>org.apache.hive:hive-exec:jar</include>
<include>org.apache.hive:hive-service:jar</include>
<include>org.apache.thrift:libfb303:jar</include>
</includes>
<outputFileNameMapping>${artifact.file.name}</outputFileNameMapping>
<outputDirectory>/lib</outputDirectory>
Expand Down
13 changes: 12 additions & 1 deletion seatunnel-dist/src/main/assembly/assembly-bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,24 @@
<scope>provided</scope>
</dependencySet>

<!-- ============ SeaTunnel Transforms V2 Jars And SeaTunnel Hadoop3 Uber Jar============ -->
<!-- ============ SeaTunnel Transforms V2 Jars ============ -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<includes>
<include>org.apache.seatunnel:seatunnel-transforms-v2:jar</include>
</includes>
<outputDirectory>/transforms</outputDirectory>
<scope>provided</scope>
</dependencySet>

<!-- ============ Lib Jars ============ -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<includes>
<include>org.apache.seatunnel:seatunnel-hadoop3-3.1.4-uber:jar:*:optional</include>
</includes>
<outputFileNameMapping>${artifact.file.name}</outputFileNameMapping>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class SeaTunnelTransformPluginDiscovery extends AbstractPluginDiscovery<SeaTunnelTransform> {

public SeaTunnelTransformPluginDiscovery() {
super(Common.libDir());
super(Common.transformsDir());
}

@Override
Expand Down

0 comments on commit 6676e20

Please sign in to comment.