-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
166 lines (139 loc) · 4.9 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.novoda:bintray-release:0.9.1'
}
}
// First, apply the publishing plugin
plugins {
id "com.gradle.plugin-publish" version "0.12.0"
id "java-gradle-plugin"
// Apply other plugins here, e.g. the kotlin plugin for a plugin written in Kotlin
// or the groovy plugin if the plugin uses Groovy
}
apply plugin: 'groovy'
apply plugin: 'maven'
//应用发布使用的插件
apply plugin: 'com.novoda.bintray-release'
def myVersion = "1.0.3"
//添加发布相关的配置
publish {
userOrg = 'tangxiaolu' //用户名
repoName = 'maven' //仓库名,默认为maven
groupId = 'com.txl.EasySmallWidth'//代码库路径
artifactId = 'easySmallWidth'//项目名称
publishVersion = myVersion//版本号
desc = 'android SmallWidth 屏幕适配插件'//项目描述
website = 'https://github.com/xiaolutang/easySmallWidth'//项目对应网站
}
dependencies {
compile gradleApi()
compile localGroovy()
}
allprojects {
repositories {
jcenter()
}
}
compileGroovy {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.encoding = "UTF-8"
}
subprojects {
tasks.withType(Javadoc).all { enabled = false }
}
def getProperty(String filename, String propName) {
def propsFile = rootProject.file(filename)
if (propsFile.exists()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
if (props[propName] != null) {
return props[propName]
} else {
print("No such property " + propName + " in file " + filename)
}
} else {
print(filename + " does not exist!")
}
}
//publish to local directory
def versionName = myVersion
group "com.txl.plugin"
version versionName
uploadArchives{ //当前项目可以发布到本地文件夹中
repositories {
mavenDeployer {
repository(url: uri('./repo')) //定义本地maven仓库的地址
}
}
}
// 读取bintay账户信息
Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
properties.load(inputStream)
inputStream.close()
// If your plugin has any external java dependencies, Gradle will attempt to
// download them from JCenter for anyone using the plugins DSL
// so you should probably use JCenter for dependency resolution in your own
// project.
repositories {
jcenter()
}
// Use java-gradle-plugin to generate plugin descriptors and specify plugin ids
gradlePlugin {
plugins {
easySmallWidthPlugin {
id = 'com.txl.easySmallWidth'
implementationClass = 'com.txl.plugin.BuildAdaptionPlugin'
}
}
}
pluginBundle {
// These settings are set for the whole plugin bundle
website = 'https://github.com/xiaolutang/easySmallWidth'
vcsUrl = 'https://github.com/xiaolutang/easySmallWidth'
// tags and description can be set for the whole bundle here, but can also
// be set / overridden in the config for specific plugins
description = 'An android screen adaptation plug-in '
// The plugins block can contain multiple plugin entries.
//
// The name for each plugin block below (greetingsPlugin, goodbyePlugin)
// does not affect the plugin configuration, but they need to be unique
// for each plugin.
// Plugin config blocks can set the id, displayName, version, description
// and tags for each plugin.
// id and displayName are mandatory.
// If no version is set, the project version will be used.
// If no tags or description are set, the tags or description from the
// pluginBundle block will be used, but they must be set in one of the
// two places.
plugins {
// first plugin
easySmallWidthPlugin {
// id is captured from java-gradle-plugin configuration
displayName = 'EasySmallWidth'
tags = ['individual', 'tags', 'per', 'plugin']
version = myVersion
}
}
// Optional overrides for Maven coordinates.
// If you have an existing plugin deployed to Bintray and would like to keep
// your existing group ID and artifact ID for continuity, you can specify
// them here.
//
// As publishing to a custom group requires manual approval by the Gradle
// team for security reasons, we recommend not overriding the group ID unless
// you have an existing group ID that you wish to keep. If not overridden,
// plugins will be published automatically without a manual approval process.
//
// You can also override the version of the deployed artifact here, though it
// defaults to the project version, which would normally be sufficient.
mavenCoordinates {
groupId = "com.txl.easySmallWidth"
artifactId = "easySmallWidth"
version = myVersion
}
}