feat: migrated ts_plugin_launcher to gradle (#3176)

This commit is contained in:
Lenar Khannanov 2021-08-19 00:02:42 +03:00 committed by GitHub
parent 559656bdc2
commit 424f69c42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 63 deletions

View File

@ -1,7 +1,17 @@
ext.libs = [
junit : "junit:junit:4.13",
annotations: "org.jetbrains:annotations:16.0.1",
javaxJson : "javax.json:javax.json-api:1.1.4",
snakeyaml : "org.yaml:snakeyaml:1.26",
jsr305 : "com.google.code.findbugs:jsr305:3.0.2"
]
ext {
libs = [
junit : "junit:junit:4.13",
annotations : "org.jetbrains:annotations:16.0.1",
javaxJson : "javax.json:javax.json-api:1.1.4",
snakeyaml : "org.yaml:snakeyaml:1.26",
jsr305 : "com.google.code.findbugs:jsr305:3.0.2",
commons_logging: "commons-logging:commons-logging:1.2"
]
ts_plugin_libs = [
httpclient : "org.apache.httpcomponents:httpclient:4.5.12",
httpcore : "org.apache.httpcomponents:httpcore:4.4.13",
httpmime : "org.apache.httpcomponents:httpmime:4.5.12",
launcher_api: fileTree( dir: "lib", include: "TunerStudioPluginAPI.jar" )
]
}

View File

@ -22,4 +22,6 @@ project(':version2header').projectDir = new File('../java_tools/version2header')
include ':enum_to_string'
project(':enum_to_string').projectDir = new File('../java_tools/enum_to_string')
include ':bin2header'
project(':bin2header').projectDir = new File('../java_tools/bin2header')
project(':bin2header').projectDir = new File('../java_tools/bin2header')
include ':ts_plugin_launcher'
project(':ts_plugin_launcher').projectDir = new File('../java_tools/ts_plugin_launcher')

View File

@ -36,7 +36,7 @@
<delete file="${jar_file}"/>
<copy todir="build/classes">
<fileset dir="../ts_plugin_launcher/resources" includes="**/*.png"/>
<fileset dir="../ts_plugin_launcher/src/main/resources" includes="**/*.png"/>
<fileset dir="${console_path}/shared_ui/resources" includes="**/*.png"/>
</copy>

View File

@ -0,0 +1,71 @@
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
defaultTasks 'shadowJar'
apply from: '../../android/dependencies.gradle'
dependencies {
testImplementation libs.junit
implementation libs.annotations
implementation ts_plugin_libs.httpcore
implementation ts_plugin_libs.httpmime
implementation ts_plugin_libs.httpclient
// to automatically exclude transitive dependencies of these projects
shadow project(':autoupdate')
shadow project(':shared_io')
implementation ts_plugin_libs.launcher_api
implementation libs.commons_logging
}
def TODAY = new Date().format('yyyy-MM-dd HH:mm:ss')
def jarName = 'rusefi_ts_plugin_launcher'
def jarDir = 'jar'
def localPath = '.efianalytics/TunerStudio/plugins'
def userHome = System.properties['user.home']
jar {
archiveBaseName = jarName
manifest {
attributes(
'Built-Date': TODAY,
'Signature-Vendor': 'rusEFI LLC',
'ApplicationPlugin': 'com.rusefi.ts_plugin.TsPluginLauncher'
)
}
}
shadowJar {
/*
to exclude suffix '-all'
in resulting archive file name
*/
archiveBaseName = jarName
archiveClassifier = ''
destinationDirectory = file( 'build' + '/' + jarDir )
manifest {
inheritFrom project.tasks.jar.manifest
}
/*
to keep only required
dependencies in resulting jar
*/
dependencies {
exclude(dependency(libs.junit))
exclude(dependency(libs.annotations))
exclude(dependency(ts_plugin_libs.launcher_api))
}
}
// custom task from build.xml
tasks.register('launcher_local_install', Copy) {
dependsOn tasks.shadowJar
from layout.buildDirectory.dir( jarDir + '/' + jarName + '.jar')
into layout.buildDirectory.dir(userHome + '/' + localPath)
}

View File

@ -1,54 +0,0 @@
<project default="jar">
<property name="jar_file_folder" value="build/jar"/>
<property name="jar_file" value="${jar_file_folder}/rusefi_ts_plugin_launcher.jar"/>
<property name="console_path" value="../../java_console"/>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac debug="yes"
destdir="build/classes"
classpath="${console_path}/lib/junit.jar:${console_path}/lib/annotations.jar:lib/TunerStudioPluginAPI.jar:${console_path}/lib/httpclient.jar:${console_path}/lib/httpmime.jar:${console_path}/lib/httpcore.jar"
>
<src path="${console_path}/autoupdate/src"/>
<src path="${console_path}/shared_io/src/main/java"/>
<src path="src/main/java"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar_file_folder}"/>
<delete file="${jar_file}"/>
<copy todir="build/classes">
<fileset dir="resources" includes="**/*.png"/>
</copy>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<jar destfile="${jar_file}" basedir="build/classes">
<manifest>
<attribute name="Built-Date" value="${TODAY}"/>
<attribute name="Signature-Vendor" value="rusEFI LLC"/>
<attribute name="ApplicationPlugin" value="com.rusefi.ts_plugin.TsPluginLauncher"/>
</manifest>
<zipfileset src="../../java_console/lib/httpclient.jar" includes="**/*.class"/>
<zipfileset src="../../java_console/lib/httpcore.jar" includes="**/*.class"/>
<zipfileset src="../../java_console/lib/httpmime.jar" includes="**/*.class"/>
<zipfileset src="lib/commons-logging.jar" includes="**/*.class"/>
</jar>
</target>
<target name="launcher_local_install" depends="jar">
<copy file="${jar_file}" todir="${user.home}/.efianalytics/TunerStudio/plugins"/>
</target>
</project>