You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jar.gradle 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
  6. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  7. * permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
  10. * Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  14. * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. */
  17. task createVersionConfig {
  18. inputs.dir 'src'
  19. inputs.dir 'res'
  20. outputs.file new File(buildDir, 'version.config')
  21. dependsOn classes
  22. doLast {
  23. def targetFile = new File(buildDir, 'version.config')
  24. targetFile.text = ''
  25. targetFile << "keysections:\n identity\n version\n updater\n bundledplugins_versions\n\n"
  26. targetFile << "identity:\n name=DMDirc version information\n globaldefault=true\n order=95000\n\n"
  27. targetFile << "version:\n version=${version}\n\n"
  28. targetFile << "updater:\n channel=${updaterChannel}\n\n"
  29. targetFile << "buildenv:\n"
  30. def compileConfiguration = project.configurations.getByName("compile")
  31. def resolvedConfiguration = compileConfiguration.resolvedConfiguration
  32. def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
  33. resolvedArtifacts.each { dp ->
  34. def version = dp.moduleVersion.id
  35. targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
  36. }
  37. }
  38. }
  39. jar {
  40. outputs.file "dist/DMDirc.jar"
  41. dependsOn createVersionConfig
  42. exclude 'com/dmdirc/version.config'
  43. from("$buildDir/version.config") {
  44. into 'com/dmdirc/'
  45. }
  46. from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
  47. exclude 'META-INF/*'
  48. exclude 'META-INF/maven/**'
  49. }
  50. manifest {
  51. attributes 'Main-Class': 'com.dmdirc.Main'
  52. attributes 'Bundle-Vendor': 'DMDirc Developers'
  53. attributes 'Bundle-Copyright': 'Copyright (c) DMDirc Developers 2006-2017'
  54. attributes 'Bundle-License': 'https://opensource.org/licenses/MIT'
  55. attributes 'Bundle-Activator': 'com.dmdirc.ClientActivator'
  56. attributes 'Import-Package': 'org.osgi.framework,javax.swing,javax.swing.text,javax.swing.text.html'
  57. }
  58. doLast {
  59. copy {
  60. from jar.archivePath
  61. into "dist/"
  62. rename ".*", "DMDirc.jar"
  63. }
  64. }
  65. }