Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacibrunning/embeddedtools
Additions to the model-based DSL for deploying Java and Native projects to remote targets
https://github.com/jacibrunning/embeddedtools
deploy embedded gradle java native remote target tools
Last synced: 3 months ago
JSON representation
Additions to the model-based DSL for deploying Java and Native projects to remote targets
- Host: GitHub
- URL: https://github.com/jacibrunning/embeddedtools
- Owner: JaciBrunning
- License: mit
- Created: 2017-08-22T15:30:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-31T03:04:30.000Z (about 4 years ago)
- Last Synced: 2024-10-11T03:12:42.854Z (4 months ago)
- Topics: deploy, embedded, gradle, java, native, remote, target, tools
- Language: Groovy
- Homepage:
- Size: 655 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
EmbeddedTools
====
Compile and Deploy for Embedded Targets in both Java and C++.EmbeddedTools adds compiler and library rules to make writing native software easier.
For all projects, you can define deployment targets and artifacts. The deploy process works over SSH/SFTP and
is extremely quick.Commands:
`gradlew deploy` will deploy all artifacts
`gradlew deploy` will deploy only the specified artifact to the specified targetProperties:
`gradlew deploy -Pdeploy-dirty` will skip the cache check and force redeployment of all files
`gradlew deploy -Pdeploy-dry` will do a 'dry run' (will not connect or deploy to target, instead only printing to console)## Installing plugin
Include the following in your `build.gradle`
```gradle
plugins {
id "jaci.gradle.EmbeddedTools" version ""
}
```See [https://plugins.gradle.org/plugin/jaci.gradle.EmbeddedTools](https://plugins.gradle.org/plugin/jaci.gradle.EmbeddedTools) for the latest version
## Spec
```gradle
import jaci.gradle.toolchains.*
import jaci.gradle.nativedeps.*// DSL (all properties optional unless stated as required)
deploy {
targets {
target('myTarget') {
directory = '/home/myuser' // The root directory to start deploying to. Default: user home
maxChannels = 1 // The number of channels to open on the target (how many files / commands to run at the same time). Default: 1
timeout = 3 // Timeout to use when connecting to target. Default: 3 (seconds)
failOnMissing = true // Should the build fail if the target can't be found? Default: truelocations {
ssh {
address = "mytarget.local" // Required. The address to try
user = 'myuser' // Required. The user to login as
password = '' // The password for the user. Default: blank (empty) string
ipv6 = false // Are IPv6 addresses permitted? Default: false
}
}
}
}artifacts {
// COMMON PROPERTIES FOR ALL ARTIFACTS //
all {
directory = 'mydir' // Subdirectory to use. Relative to target directory
targets << 'myTarget' // Targets to deploy toonlyIf = { execute('echo Hi').result == 'Hi' } // Check closure for artifact. Will not deploy if evaluates to false
predeploy << { execute 'echo Pre' } // After onlyIf, but before deploy logic
postdeploy << { execute 'echo Post' } // After this artifact's deploy logicdisabled = true // Disable this artifact. Default: false.
dependsOn('someTask') // Make this artifact depend on a task
}
// END COMMON //fileArtifact('myFileArtifact') {
file = file('myFile') // Set the file to deploy. Required.
filename = 'myFile.dat' // Set the filename to deploy to. Default: same name as file
}// FileCollectionArtifact is a flat collection of files - directory structure is not preserved
fileCollectionArtifact('myFileCollectionArtifact') {
files = fileTree(dir: 'myDir') // Required. Set the filecollection (e.g. filetree, files, etc) to deploy
}// FileTreeArtifact is like a FileCollectionArtifact, but the directory structure is preserved
fileTreeArtifact('myFileTreeArtifact') {
files = fileTree(dir: 'mydir') // Required. Set the fileTree (e.g. filetree, ziptree) to deploy
}commandArtifact('myCommandArtifact') {
command = 'echo Hello' // The command to run. Required.
// Output will be stored in 'result' after execution
}// JavaArtifact inherits from FileArtifact
javaArtifact('myJavaArtifact') {
jar = 'jar' // The jar (or Jar task) to deploy. Default: 'jar'
// Note: This artifact will automatically depend on the jar build task
}// NativeArtifact inherits from FileArtifact
nativeArtifact('myNativeArtifact') {
component = 'my_program' // Required. The name of the native component (model.components {}) to deploy.
targetPlatform = 'desktop' // The name of the native platform (model.platforms {}) to deploy.// Note: This artifact will automatically depend on the native component link task
}// NativeLibraryArtifact inherits from FileCollectionArtifact
nativeLibraryArtifact('myNativeLibraryArtifact') {
library = 'mylib' // Required. Name of library (model.libraries {}) to deploy.
targetPlatform = 'desktop' // The name of the native platform (model.platforms {}) to deploy.
flavor = 'myFlavor' // The name of the flavor (model.flavors {}) to deploy.
buildType = 'myBuildType' // The name of the buildType (model.buildTypes {}) to deploy.
}
}
}model {
libraries {
// COMMON PROPERTIES FOR ALL LIBRARIES //
all {
libraryName = 'myactuallib' // The name to give this library in useLibrary and when referencing from other places.
targetPlatform = 'desktop' // The name of the native platform (model.platforms {}) this lib is built for
targetPlatforms = ['desktop1', 'desktop2'] // Same as targetPlatform, but for multiple platforms.
flavor = 'myFlavor' // The name of the flavor (model.flavors {}) this lib is for
buildType = 'myBuildType' // The name of the buildType (model.buildTypes {}) this lib is for
}
// END COMMONmylib(NativeLib) {
headerDirs << 'include' // Directories for headers
sourceDirs << 'sources' // Directories for sources
staticMatchers << '**/*.a' // Static Libraries to be linked at compile time
sharedMatchers << '**/*.so' // Shared Libraries to be linked at compile time
dynamicMatchers << '**/*.so' // Libraries that aren't linked, but still needed at runtime.
systemLibs << 'm' // System libs to load with -l (provided by toolchain)maven = "some.maven.package:mylib:1.0.0@zip" // Load from maven. Must be a zip or zip-compatible (like a jar)
file = project.file("mylib.zip") // Load from filesystem instead. Can be given a zip or a directory.
}// You can create a collection of libraries using CombinedNativeLib
myComboLib(CombinedNativeLib) {
libs << 'myactuallib' << 'someotherlib'
}
}components {
my_program(NativeExecutableSpec) {
embeddedTools.useLibrary(it, "myComboLib")
}
}
}
```