class FancySignPlugin implements Plugin<Project> {
  @Override void apply(Project project) {
    if (!project.plugins.hasPlugin(AppPlugin)) {
      throw new IllegalStateException('The "com.example.fancysign"
plugin requires the "com.android.application" plugin.')
    }

    project.android.applicationVariants.all { variant ->
      if (!BuilderConstants.RELEASE.equals(variant.buildType.name)) {
        return // Skip non-release builds.
      }

      def packageTask = variant.packageApplication
      def outputFile = packageTask.outputFile as File

      // Create the release-specific task for FancySign.
      def fancySignTask = project.tasks.create('fancySignRelease',
FancySignTask)

      // Set the task's input file as the package task's output.
      fancySignTask.unsignedApk = outputFile

      // Create the task's output file.
      def apkName = "${project.archivesBaseName}-${variant.baseName}.apk"
      fancySignTask.signedApk = new File(outputFile.parentFile, apkName)

      // Set up task dependencies.
      fancySignTask.dependsOn packageTask
    }
  }
}

​

On Tue, Sep 23, 2014 at 11:27 AM, Tomáš Procházka <[email protected]
> wrote:

> Thanks, I will try it. But some more detailed example would be useful ;-)
>
> Dne pondělí, 22. září 2014 15:29:21 UTC+2 Jake Wharton napsal(a):
>>
>> We do this.
>>
>> If you don't give it a signing config it won't sign the release build.
>> Then you can add a task which depends on packageRelease and on which
>> assembleRelease depends.
>>
>> On Mon, Sep 22, 2014 at 6:09 AM, Tomáš Procházka <[email protected]>
>> wrote:
>>
>>> It is possible to override sign process for release build?
>>> I need do it remote, because developers has not private key.
>>> I need to send unsigned APK to the remote server which will provide
>>> signed APK in the reply.
>>> It should by possible by Groovy but I don't know how to override sign
>>> task provided by android plugin.
>>> Did anybody already do something like this?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to