huangxiao há 2 semanas atrás
pai
commit
49756fb5ab

+ 13 - 0
ci-cd/bin/linux/javacBuild.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+. ./env.sh
+# 配置文件路径
+export config=$1
+# 执行的规则
+export china=$2
+
+echo Build
+$javaHome/bin/javac -Xlint:deprecation -d $target -encoding UTF-8 $project/tool/tool-ci-cd/src/main/java/JavaSourceCompiler.java $project/tool/tool-ci-cd/src/main/java/Build.java
+
+echo Run
+$javaHome/bin/java -Dfile.encoding=UTF-8 -cp $target Build

+ 10 - 0
ci-cd/bin/linux/jshellBuild.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+. ./env.sh
+# 配置文件路径
+export config=$1
+# 执行的规则
+export china=$2
+
+echo Run
+$javaHome/bin/jshell -s < ../Build.jsh

+ 5 - 0
ci-cd/bin/linux/mavenDownloadJar.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+. ./env.sh
+
+$javaHome/bin/java -Dfile.encoding=UTF-8 -Dmaven.multiModuleProjectDirectory=. -Dmaven.repo.local=$maven -Dmaven.home=$mavenHome -Dclassworlds.conf="${mavenHome}/bin/m2.conf" -cp "${mavenHome}/boot/*" org.codehaus.classworlds.Launcher -s $settings dependency:get -DgroupId=$1 -DartifactId=$2 -Dversion=$3

+ 23 - 0
ci-cd/bin/windows/envCheck.bat

@@ -0,0 +1,23 @@
+@echo off
+:: 环境变量检查
+
+:: 设置CMD窗口为UTF-8
+chcp 65001 > nul
+
+:: Java Home
+if not defined javaHome (
+    echo 错误: javaHome环境变量未设置
+    exit /b 1
+)
+
+:: Mave Home
+if not defined mavenHome (
+    echo 错误: mavenHome环境变量未设置
+    exit /b 1
+)
+
+:: Maven Settings
+if not defined settings (
+    echo 错误: settings境变量未设置
+    exit /b 1
+)

+ 4 - 0
ci-cd/bin/windows/maven.bat

@@ -0,0 +1,4 @@
+@echo off
+call %~dp0envCheck.bat || exit /b %errorlevel%
+
+%javaHome%/bin/java -Dfile.encoding=UTF-8 -Dmaven.multiModuleProjectDirectory=. -Dmaven.home=%mavenHome%  -Dclassworlds.conf=%mavenHome%/bin/m2.conf -cp %mavenHome%/boot/* org.codehaus.classworlds.Launcher -s %settings% %*

+ 6 - 0
ci-cd/bin/windows/mavenCompileAndExecJava.bat

@@ -0,0 +1,6 @@
+@echo off
+
+echo ----- Build -----
+call %~dp0maven -q -f %1 -DskipTests=true compile
+call %~dp0mavenExecJava %*
+call %~dp0maven -q -f %1 -DskipTests=true clean

+ 3 - 0
ci-cd/bin/windows/mavenDownloadJar.bat

@@ -0,0 +1,3 @@
+@echo off
+
+call %~dp0maven -q dependency:get -DgroupId=%1 -DartifactId=%2 -Dversion=%3

+ 5 - 0
ci-cd/bin/windows/mavenExecJava.bat

@@ -0,0 +1,5 @@
+@echo off
+
+echo ----- Start -----
+call %~dp0maven -q -f %1 -DskipTests=true exec:java -Dexec.mainClass="%2" -Dexec.args="%3 %4 %5 %6 %7 %8 %9"
+echo ----- End   -----

+ 15 - 0
ci-cd/build/env_dev/Deploy.bat

@@ -0,0 +1,15 @@
+@echo off
+
+call %~dp0env.bat
+
+:: 项目主POM文件
+set POM_XML=%CI_CD_PATH%..\pom.xml
+
+echo ----- Clean  -----
+call %CI_CD_PATH%bin\windows\maven -q -f %POM_XML% -DskipTests=true clean
+
+echo ----- Deploy -----
+call %CI_CD_PATH%bin\windows\maven -f %POM_XML% deploy -pl service-user-client -am
+
+echo ----- Clean  -----
+call %CI_CD_PATH%bin\windows\maven -q -f %POM_XML% -DskipTests=true clean

+ 21 - 0
ci-cd/build/env_dev/InstallAndPackage.bat

@@ -0,0 +1,21 @@
+@echo off
+
+call %~dp0env.bat
+
+:: 项目主POM文件
+set POM_XML=%CI_CD_PATH%..\pom.xml
+
+echo ----- Clean   -----
+call %CI_CD_PATH%bin\windows\maven -q -f %POM_XML% -DskipTests=true clean
+
+echo ----- Install -----
+call %CI_CD_PATH%bin\windows\maven -f %POM_XML% install -pl service-user-client -am
+
+echo ----- Package -----
+call %CI_CD_PATH%bin\windows\maven -f %POM_XML% package
+
+echo ----- Copy    -----
+copy /Y %CI_CD_PATH%..\start\target\*.jar .\
+
+echo ----- Clean   -----
+call %CI_CD_PATH%bin\windows\maven -q -f %POM_XML% -DskipTests=true clean

+ 16 - 0
ci-cd/build/env_dev/env.bat

@@ -0,0 +1,16 @@
+@echo off
+
+:: Java Home
+set javaHome=D:/Professional/jdk/graalvm-jdk-17.0.9+11.1
+
+:: Mave Home
+set mavenHome=D:/Professional/maven/apache-maven-3.8.4
+
+:: Maven Settings
+set settings=%~dp0settings.xml
+
+:: 当前路径
+set "THIS_BAT_PATH=%~dp0"
+
+:: CI-CD的路径
+set CI_CD_PATH=%~dp0..\..\

+ 36 - 0
ci-cd/build/env_dev/settings.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+    <localRepository>D:\Professional\maven\maven-repository</localRepository>
+
+    <servers>
+        <server>
+            <id>nexus-releases</id>
+            <username>admin</username>
+            <password>d4f81333-b3f9-4407-8ec1-e073ff4ab99aa</password>
+        </server>
+        <server>
+            <id>nexus-snapshots</id>
+            <username>admin</username>
+            <password>d4f81333-b3f9-4407-8ec1-e073ff4ab99aa</password>
+        </server>
+    </servers>
+
+    <mirrors>
+        <mirror>
+            <id>alimaven</id>
+            <name>aliyun maven</name>
+            <url>https://maven.aliyun.com/repository/public</url>
+            <mirrorOf>central</mirrorOf>
+        </mirror>
+        <mirror>
+            <id>nexus</id>
+            <name>nexus maven</name>
+            <url>https://nexus.jfcmei.com/repository/maven-public/</url>
+            <mirrorOf>central</mirrorOf>
+        </mirror>
+    </mirrors>
+
+</settings>