Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
buildscript { | ||
repositories { | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "com.gradle.publish:plugin-publish-plugin:0.9.7" | ||
} | ||
} | ||
|
||
apply plugin: "java" | ||
apply plugin: "com.gradle.plugin-publish" | ||
|
||
repositories { | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
compile gradleApi() | ||
compile 'net.jsign:jsign-core:1.4-SNAPSHOT' | ||
} | ||
|
||
pluginBundle { | ||
website = 'https://ebourg.github.io/jsign/' | ||
vcsUrl = 'https://github.com/ebourg/jsign' | ||
|
||
description = 'Code signing for Windows executables' | ||
|
||
plugins { | ||
jsignPlugin { | ||
id = 'net.jsign' | ||
displayName = 'Gradle Jsign plugin' | ||
tags = ['signing'] | ||
version = '1.4-SNAPSHOT' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
buildscript { | ||
repositories { | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
classpath 'net.jsign:jsign-gradle-plugin:1.4-SNAPSHOT' | ||
} | ||
} | ||
|
||
apply plugin: 'net.jsign' | ||
|
||
task sign << { | ||
signexe(file : 'application.exe', | ||
name : 'My Application', | ||
url : 'http://www.example.com', | ||
keystore : 'keystore.p12', | ||
alias : 'test', | ||
storepass : 'secret', | ||
tsaurl : 'http://timestamp.comodoca.com/authenticode') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>net.jsign</groupId> | ||
<artifactId>jsign-gradle-plugin</artifactId> | ||
<parent> | ||
<groupId>net.jsign</groupId> | ||
<artifactId>jsign-parent</artifactId> | ||
<version>1.4-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<name>Jsign - Code signing for Windows executables (Gradle Plugin)</name> | ||
<version>1.4-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<inceptionYear>2017</inceptionYear> | ||
|
||
<description> | ||
Pure Java implementation of Microsoft Authenticode for signing Windows executable files | ||
</description> | ||
<url>http://ebourg.github.com/jsign</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>The Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
|
||
<repositories> | ||
<repository> | ||
<id>gradle-repository</id> | ||
<url>http://repo.gradle.org/gradle/libs-releases-local</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<properties> | ||
<gradle.version>3.4</gradle.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.jsign</groupId> | ||
<artifactId>jsign-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.codehaus.groovy</groupId> | ||
<artifactId>groovy-all</artifactId> | ||
<version>2.4.7</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.gradle</groupId> | ||
<artifactId>gradle-core</artifactId> | ||
<version>${gradle.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
55 changes: 55 additions & 0 deletions
55
jsign-gradle-plugin/src/main/java/net/jsign/GradleConsole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright 2017 Emmanuel Bourg | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.jsign; | ||
|
||
import org.gradle.api.logging.LogLevel; | ||
import org.gradle.api.logging.Logger; | ||
|
||
/** | ||
* Console implementation for Gradle. | ||
* | ||
* @author Emmanuel Bourg | ||
* @since 1.4 | ||
*/ | ||
public class GradleConsole implements Console { | ||
|
||
private final Logger log; | ||
|
||
public GradleConsole(Logger log) { | ||
this.log = log; | ||
} | ||
|
||
@Override | ||
public void debug(String message) { | ||
log.debug(message); | ||
} | ||
|
||
@Override | ||
public void info(String message) { | ||
log.info(message); | ||
} | ||
|
||
@Override | ||
public void warn(String message) { | ||
warn(message, null); | ||
} | ||
|
||
@Override | ||
public void warn(String message, Throwable t) { | ||
log.log(LogLevel.WARN, message, t); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
jsign-gradle-plugin/src/main/java/net/jsign/PESignerGradlePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright 2017 Emmanuel Bourg | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.jsign; | ||
|
||
import java.io.File; | ||
import java.util.Map; | ||
|
||
import groovy.lang.Closure; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
|
||
/** | ||
* Gradle plugin registering the signexe extension method with the project. | ||
* | ||
* @author Emmanuel Bourg | ||
* @since 1.4 | ||
*/ | ||
public class PESignerGradlePlugin implements Plugin<Project> { | ||
|
||
@Override | ||
public void apply(final Project project) { | ||
project.getExtensions().add("signexe", new Closure(null) { | ||
public void doCall(Map<String, String> params) throws SignerException { | ||
String file = params.get("file"); | ||
params.remove("file"); | ||
|
||
PESignerHelper helper = new PESignerHelper(new GradleConsole(project.getLogger()), "property"); | ||
for (Map.Entry<String, String> param : params.entrySet()) { | ||
helper.param(param.getKey(), param.getValue()); | ||
} | ||
helper.sign(new File(file)); | ||
} | ||
}); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
jsign-gradle-plugin/src/main/resources/META-INF/gradle-plugins/net.jsign.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
implementation-class=net.jsign.PESignerGradlePlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters