-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gradle support #33
Comments
Integrating an Ant task with Gradle is quite easy and for now I don't plan to implement a Gradle plugin. But if someone wants to write one I'd be happy to merge it. |
I'm not sure a gradle plugin could be much simpler than just calling out to PESigner directly. Here's how I do it: task sign {
doLast {
PESigner signer = new PESigner(INSTALLER_FILE)
signer.setArg('name', 'MyApp')
signer.setArg('url', 'https://myapp.com')
...
signer.sign()
}
} |
is the installer file the actual jsign file? just getting back to this now. thanks for the info. |
INSTALLER_FILE is the file you want to sign. In my case, it's an .exe. Not sure what a jsign file is. |
http://search.maven.org/#artifactdetails%7Cnet.jsign%7Cjsign%7C1.3%7Cjar this file is what i was referencing. |
Gotcha. You add that to your buildscript by putting this at the top of your buildscript: buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "net.jsign:jsign:1.3"
}
}
import net.jsign.PESigner |
I am dealing with a multi project setup when i run that it fails due to that. |
Whoops, sorry. Looks like we actually have a little in-house code. import net.jsign.PESignerCLI;
public class PESigner {
private final File fileToSign;
private final Map<String, String> stringProps = Maps.newHashMap();
public PESigner(File fileToSign) {
this.fileToSign = fileToSign;
}
public void setArg(String key, String value) {
stringProps.put(key, value);
}
public void sign() {
List<String> args = Lists.newArrayList();
for (Map.Entry<String, String> entry : stringProps.entrySet()) {
args.add("--" + entry.getKey());
args.add(entry.getValue());
}
args.add(fileToSign.getAbsolutePath());
PESignerCLI.main(args.toArray(new String[args.size()]));
}
} |
https://gist.github.com/dmodoomsirius/ba96f9c98283bf63fa94bb79acc2801a ^ my build.gradle for the project that has the exe i am trying to sign.
|
If you know how to use import net.jsign.PESignerCLI;
task sign {
doLast {
args = ['--arg', 'argValue', 'C:\PathToFileToSign']
PESignerCLI.main(args.toArray(new String[args.size()]));
}
} |
I don't atm. I am looking into it right now. |
This looks fairly complex, and I don't think a build script is the right place to write code, it's sad that Gradle encourages this. Using the Ant task should be easier:
|
Now I have can't read private key even tho I converted a PuttyGEN Key into a pvk using this tool. not sure what I am doing wrong. |
Edit: moved issue to another issue. #34 |
I added a native Gradle plugin, please give it a try. Here is a usage example:
I plan to upload the plugin to the Gradle Plugin Portal once the next version is released. The usage will then be easier :
|
ohh thank you. I will sure to give this a try when i get home. |
Have you thought about making a plugin for gradle to use jsign without haivng to rework the ant task to work with gradle?
The text was updated successfully, but these errors were encountered: