Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.gradle
build

.settings
**/.settings
.classpath
.project

.idea
*.iml

/plugin-integration/gradle-ssh-plugin
/bin/
35 changes: 20 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
allprojects {
group = 'org.hidetake'
version = System.getenv('CIRCLE_TAG') ?: 'SNAPSHOT'
group = 'org.hidetake'
version = System.getenv('CIRCLE_TAG') ?: 'SNAPSHOT'

repositories {
jcenter()
}
afterEvaluate {
tasks.withType(Test) {
finalizedBy ':testReport'
testReport.reportOn binaryResultsDirectory
reports.html.required = false
reports.junitXml.destination = file("${rootProject.buildDir}/test-results")
}
}

afterEvaluate {
tasks.withType(Test) {
finalizedBy ':testReport'
testReport.reportOn binResultsDir
reports.html.enabled = false
reports.junitXml.destination = file("${rootProject.buildDir}/test-results")
}
}
plugins.withType(JavaPlugin) {
dependencies {
implementation 'com.github.mwiede:jsch:0.2.5'
implementation 'org.slf4j:slf4j-api:2.0.6'
implementation 'junit:junit:4.11'
implementation 'org.spockframework:spock-core:2.3-groovy-3.0'
}
}
}

task testReport(type: TestReport) {
description 'Generates test report for all projects'
destinationDir = file("$buildDir/reports")
description 'Generates test report for all projects'
destinationDirectory = file("$buildDir/reports")
}
48 changes: 0 additions & 48 deletions cli/build.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions core/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/main/
/test/
39 changes: 6 additions & 33 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
plugins {
id 'groovy'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.8.4'
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.5.6'
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'com.jcraft:jsch:0.1.55'
compile 'com.jcraft:jsch.agentproxy.connector-factory:0.0.9'
compile 'com.jcraft:jsch.agentproxy.jsch:0.0.9'
testRuntimeOnly 'cglib:cglib-nodep:3.2.10'
testRuntimeOnly 'org.objenesis:objenesis:3.0.1'

testCompile('org.spockframework:spock-core:1.2-groovy-2.5') {
exclude group: 'org.codehaus.groovy', module:'groovy-all'
}
testRuntime 'cglib:cglib-nodep:3.2.10'
testRuntime 'org.objenesis:objenesis:3.0.1'

testRuntime 'ch.qos.logback:logback-classic:1.1.2'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.1.2'
}

processResources {
Expand Down Expand Up @@ -84,20 +73,4 @@ publishing {
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER') ?: findProperty('bintrayUser')
key = System.getenv('BINTRAY_KEY') ?: findProperty('bintrayKey')
publications = ['release']
publish = true
pkg {
repo = 'maven'
name = parent.name
licenses = [project.license]
vcsUrl = project.vcsUrl
version {
name = project.version
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait HostAuthentication {
}

@Slf4j
private static class Helper {
static class Helper {
final Session session
final Remote remote

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package org.hidetake.groovy.ssh.connection
import org.hidetake.groovy.ssh.core.Proxy
import org.hidetake.groovy.ssh.core.ProxyType

import static ProxyType.SOCKS

/**
* Basic validation and defaults for proxied connections created by {@link ConnectionManager}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.hidetake.groovy.ssh.connection

import org.hidetake.groovy.ssh.core.Remote

import com.jcraft.jsch.AgentIdentityRepository
import com.jcraft.jsch.IdentityRepository
import com.jcraft.jsch.JSch
import com.jcraft.jsch.SSHAgentConnector
import com.jcraft.jsch.Session
import com.jcraft.jsch.agentproxy.ConnectorFactory
import com.jcraft.jsch.agentproxy.RemoteIdentityRepository

import groovy.util.logging.Slf4j
import org.hidetake.groovy.ssh.core.Remote

@Slf4j
trait UserAuthentication {
Expand All @@ -25,7 +28,9 @@ trait UserAuthentication {
}

if (settings.agent) {
jsch.identityRepository = RemoteIdentityRepositoryLocator.get()
// Use agent authentication using https://github.com/mwiede/jsch/issues/65#issuecomment-913051572
IdentityRepository irepo = new AgentIdentityRepository(new SSHAgentConnector())
jsch.identityRepository = irepo
log.debug("Using SSH agent authentication for $remote")
} else {
jsch.identityRepository = null /* null means the default repository */
Expand All @@ -42,17 +47,4 @@ trait UserAuthentication {
}
}
}

private static class RemoteIdentityRepositoryLocator {
private static instance = null

static get() {
if (instance) {
instance
} else {
instance = new RemoteIdentityRepository(ConnectorFactory.default.createConnector())
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait Container<T> implements Map<String, T> {
* @param closure
* @return item
*/
T create(String name, @DelegatesTo(T) Closure closure) {
T create(String name, Closure closure) {
assert name
assert getContainerElementType() instanceof Class<T>
T namedObject = getContainerElementType().newInstance(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ import org.hidetake.groovy.ssh.session.transfer.FileGet
import org.hidetake.groovy.ssh.session.transfer.FilePut
import org.hidetake.groovy.ssh.session.transfer.SftpRemove

import groovy.util.logging.Slf4j

/**
* A set of extensions to be shipped as default.
*
* @author Hidetake Iwata
*/
trait SessionExtensions implements
Command,
BackgroundCommand,
Script,
Shell,
Sudo,
FileGet,
FilePut,
SftpRemove,
PortForward {
}
@Slf4j
trait SessionExtensions implements Command, BackgroundCommand, Script,
Shell, Sudo, FileGet, FilePut, SftpRemove, PortForward {

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.hidetake.groovy.ssh.session

import groovy.util.logging.Slf4j
import org.hidetake.groovy.ssh.core.Remote
import org.hidetake.groovy.ssh.core.settings.CompositeSettings
import org.hidetake.groovy.ssh.core.settings.GlobalSettings
import org.hidetake.groovy.ssh.core.settings.PerServiceSettings
import org.hidetake.groovy.ssh.operation.Operations
import org.hidetake.groovy.ssh.operation.SftpOperations

import groovy.util.logging.Slf4j

/**
* A handler of {@link org.hidetake.groovy.ssh.core.RunHandler#session(Remote, groovy.lang.Closure)}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import org.hidetake.groovy.ssh.operation.Operations
import org.hidetake.groovy.ssh.session.BadExitStatusException
import org.hidetake.groovy.ssh.session.SessionExtension

import groovy.util.logging.Slf4j

/**
* Provides the blocking command execution.
* Each method blocks until channel is closed.
*
* @author Hidetake Iwata
*/
@Slf4j
trait Command implements SessionExtension {
void execute(HashMap map = [:], String commandLine, Closure callback) {
assert callback, 'callback must be given'
Expand All @@ -36,7 +39,7 @@ trait Command implements SessionExtension {
execute(map, Escape.escape(commandLineArgs))
}

private static class Helper {
static class Helper {
static execute(Operations operations, CommandSettings settings, String commandLine) {
def operation = operations.command(settings, commandLine)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait Script implements Command {
execute(Helper.createSettings(settings, script), Helper.guessInterpreter(script), callback)
}

private static class Helper {
static class Helper {
static HashMap createSettings(HashMap settings, def script) {
if (settings.inputStream) {
throw new IllegalArgumentException("executeScript does not work with inputStream: $settings")
Expand Down
4 changes: 2 additions & 2 deletions docs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'org.asciidoctor.convert' version '1.5.3'
id 'org.asciidoctor.jvm.convert' version '2.4.0'
}

asciidoctor {
sources {
include 'index.adoc'
include 'example-script.adoc'
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.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-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading