瀏覽代碼

Set versions on plugins properly.

This makes the plugins include their version in the output file
name, and when used as a dependency.

Also create a dist-versioned directory which accumulates versioned
plugins.
pull/130/head
Chris Smith 9 年之前
父節點
當前提交
e52b618278
共有 2 個文件被更改,包括 14 次插入8 次删除
  1. 1
    0
      .gitignore
  2. 13
    8
      build.gradle

+ 1
- 0
.gitignore 查看文件

1
 /build
1
 /build
2
 */build
2
 */build
3
 /dist
3
 /dist
4
+/dist-versioned
4
 /lib
5
 /lib
5
 *.iml
6
 *.iml
6
 /.gradle
7
 /.gradle

+ 13
- 8
build.gradle 查看文件

1
 // DMDirc plugins build script
1
 // DMDirc plugins build script
2
 subprojects {
2
 subprojects {
3
+    def jgit = new org.mdonoughe.JGitDescribeTask()
4
+    jgit.dir = new File(projectDir.parent, '.git')
5
+    jgit.subDir = projectDir
6
+    project.version = jgit.getDescription() + '-SNAPSHOT'
7
+
3
     apply plugin: 'java'
8
     apply plugin: 'java'
4
     apply plugin: 'findbugs'
9
     apply plugin: 'findbugs'
5
     apply plugin: 'pmd'
10
     apply plugin: 'pmd'
63
     }
68
     }
64
 
69
 
65
     task updatePluginConfig(dependsOn: copyPluginConfig) << {
70
     task updatePluginConfig(dependsOn: copyPluginConfig) << {
66
-        def gitDir = new File(projectDir.parent, '.git')
67
-
68
-        def jgit = new org.mdonoughe.JGitDescribeTask()
69
-        jgit.dir = gitDir
70
-        jgit.subDir = projectDir
71
-
72
-        ext.version = jgit.getDescription()
73
         def targetFile = new File(buildDir, 'plugin.config')
71
         def targetFile = new File(buildDir, 'plugin.config')
74
-        targetFile << "\n\nversion:\n  number=${version}"
72
+        targetFile << "\n\nversion:\n  number=${project.version}"
75
 
73
 
76
         targetFile << "\n\nbuildenv:\n"
74
         targetFile << "\n\nbuildenv:\n"
77
         def compileConfiguration = project.configurations.getByName("compile")
75
         def compileConfiguration = project.configurations.getByName("compile")
117
             into "../dist/"
115
             into "../dist/"
118
             rename ".*", "${project.name}.jar"
116
             rename ".*", "${project.name}.jar"
119
         }
117
         }
118
+
119
+        copy {
120
+            from jar.archivePath
121
+            into "../dist-versioned/"
122
+            rename ".*", "${project.name}-${project.version}.jar"
123
+        }
120
     }
124
     }
121
     jar.outputs.file "../dist/${project.name}.jar"
125
     jar.outputs.file "../dist/${project.name}.jar"
126
+    jar.outputs.file "../dist-versioned/${project.name}-${project.version}.jar"
122
 
127
 
123
     jar.dependsOn updatePluginConfig
128
     jar.dependsOn updatePluginConfig
124
 }
129
 }

Loading…
取消
儲存