Skip to content

Commit c7beef8

Browse files
committed
Revert "More gradle tweaks so our gradle files work unchanged in mozilla-central."
This reverts commit adae414.
1 parent 7978150 commit c7beef8

File tree

3 files changed

+101
-97
lines changed

3 files changed

+101
-97
lines changed

settings.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ buildscript {
4242
}
4343
}
4444

45-
if (!gradle.root.hasProperty("mozconfig")) {
46-
rootProject.name = "appservices"
47-
}
45+
rootProject.name = "appservices"
4846

4947
def setupProject(name, projectProps, appServicesRootDir) {
5048
def path = projectProps.path

tools/nimbus-gradle-plugin/build.gradle

Lines changed: 74 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -43,83 +43,100 @@ dependencies {
4343
implementation localGroovy()
4444
}
4545

46-
// In app-services, we need all these tasks, which do nothing, so this module behaves like
47-
// our others and we do not need to special case it in automation.
48-
if (!gradle.root.hasProperty("mozconfig")) {
49-
tasks.register("lintRelease") {
50-
doLast {}
51-
}
46+
tasks.register("lintRelease") {
47+
doLast {
48+
// Do nothing. We execute the same set of tasks for all our modules in parallel on taskcluster.
49+
// This project doesn't have a lint task. To avoid special casing our automation I just added
50+
// an empty lint task here.
51+
}
52+
}
5253

53-
tasks.register("assembleAndroidTest") {
54-
doLast {}
55-
}
54+
tasks.register("assembleAndroidTest") {
55+
doLast {
56+
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
57+
// behaves like our others and we do not need to special case it in automation.
58+
}
59+
}
5660

57-
tasks.register("assembleRelease") {
58-
doLast {}
59-
}
61+
tasks.register("assembleRelease") {
62+
doLast {
63+
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
64+
// behaves like our others and we do not need to special case it in automation.
65+
}
66+
}
6067

61-
tasks.register("testRelease") {
62-
doLast {}
63-
}
68+
tasks.register("testRelease") {
69+
doLast {
70+
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
71+
// behaves like our others and we do not need to special case it in automation.
72+
}
73+
}
6474

65-
tasks.register("checkMavenArtifacts") {
66-
doLast {}
75+
tasks.register("checkMavenArtifacts") {
76+
doLast {
77+
// Do nothing. Like the `lint` task above this is just a dummy task so that this module
78+
// behaves like our others and we do not need to special case it in automation.
6779
}
80+
}
6881

69-
// publish only makes sense in app-services.
70-
publishing {
71-
publications {
72-
mavenJava(MavenPublication) {
73-
from components.java
74-
75-
pom {
76-
groupId = rootProject.config.componentsGroupId
77-
artifactId = archivesBaseName
78-
description = project.ext.description
79-
version = rootProject.config.componentsVersion + (rootProject.hasProperty('local') ? '-' + rootProject.property('local') : '')
80-
81-
licenses {
82-
license {
83-
name = properties.libLicense
84-
url = properties.libLicenseUrl
85-
}
86-
}
82+
// Must match the implementation in publish.gradle
83+
static def getLocalPublicationTimestamp() {
84+
def date = new Date()
85+
return date.format('yyyyMMddHHmmss')
86+
}
8787

88-
developers {
89-
developer {
90-
name = 'Mozilla Nimbus Team'
91-
email = 'nimbus-team@mozilla.com'
92-
}
88+
publishing {
89+
publications {
90+
mavenJava(MavenPublication) {
91+
from components.java
92+
93+
pom {
94+
groupId = rootProject.config.componentsGroupId
95+
artifactId = archivesBaseName
96+
description = project.ext.description
97+
version = rootProject.config.componentsVersion + (rootProject.hasProperty('local') ? '-' + rootProject.property('local') : '')
98+
99+
licenses {
100+
license {
101+
name = properties.libLicense
102+
url = properties.libLicenseUrl
93103
}
104+
}
94105

95-
scm {
96-
connection = properties.libVcsUrl
97-
developerConnection = properties.libVcsUrl
98-
url = properties.libUrl
106+
developers {
107+
developer {
108+
name = 'Mozilla Nimbus Team'
109+
email = 'nimbus-team@mozilla.com'
99110
}
100111
}
101-
}
102-
}
103112

104-
if (it.hasProperty('android')) {
105-
android {
106-
singleVariant('release') {
107-
withSourcesJar()
113+
scm {
114+
connection = properties.libVcsUrl
115+
developerConnection = properties.libVcsUrl
116+
url = properties.libUrl
108117
}
109118
}
110119
}
120+
}
111121

112-
repositories {
113-
maven {
114-
url = "$buildDir/maven"
122+
if (it.hasProperty('android')) {
123+
android {
124+
singleVariant('release') {
125+
withSourcesJar()
115126
}
116127
}
117128
}
118129

119-
publishing.publications.withType(MavenPublication).each {publication ->
120-
def checkFileSizeTask = task "checkLibSizeForMavenArtifact-${publication.artifactId}"(type: Exec) {
121-
commandLine "${rootProject.projectDir}/automation/check_artifact_size.sh", project.buildDir, publication.artifactId
130+
repositories {
131+
maven {
132+
url = "$buildDir/maven"
122133
}
123-
checkMavenArtifacts.dependsOn(checkFileSizeTask)
124134
}
125135
}
136+
137+
publishing.publications.withType(MavenPublication).each {publication ->
138+
def checkFileSizeTask = task "checkLibSizeForMavenArtifact-${publication.artifactId}"(type: Exec) {
139+
commandLine "${rootProject.projectDir}/automation/check_artifact_size.sh", project.buildDir, publication.artifactId
140+
}
141+
checkMavenArtifacts.dependsOn(checkFileSizeTask)
142+
}

tools/nimbus-gradle-plugin/settings.gradle

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
if (gradle.root.hasProperty("mozconfig")) {
6-
apply from: file('../../../../mobile/android/shared-settings.gradle')
7-
}
8-
95
import org.yaml.snakeyaml.Yaml
106
buildscript {
117
dependencies {
@@ -33,41 +29,34 @@ buildscript {
3329
}
3430
}
3531

36-
def yaml
37-
def buildconfig
38-
def calcVersion
32+
def yaml = new Yaml()
33+
def buildconfig = yaml.load(new File(rootDir, '../../.buildconfig-android.yml').newInputStream())
3934

40-
if (!gradle.root.hasProperty("mozconfig")) {
41-
// This config stuff is only used in app-services.
42-
yaml = new Yaml()
43-
buildconfig = yaml.load(new File(rootDir, '../../.buildconfig-android.yml').newInputStream())
35+
def calcVersion(buildconfig) {
36+
def local = gradle.rootProject.findProperty("local")
37+
def version = new File(rootDir, '../../version.txt').getText().trim()
4438

45-
calcVersion = { ->
46-
def local = gradle.rootProject.findProperty("local")
47-
def version = new File(rootDir, '../../version.txt').getText().trim()
48-
49-
if (gradle.rootProject.hasProperty("nightlyVersion")) {
50-
return gradle.rootProject.nightlyVersion
51-
} else if(local) {
52-
return '0.0.1-SNAPSHOT'
53-
} else {
54-
return version
55-
}
39+
if (gradle.rootProject.hasProperty("nightlyVersion")) {
40+
return gradle.rootProject.nightlyVersion
41+
} else if(local) {
42+
return '0.0.1-SNAPSHOT'
43+
} else {
44+
return version
5645
}
46+
}
5747

58-
gradle.projectsLoaded { ->
59-
// Wait until root project is "loaded" before we set "config"
60-
// XXX - there's no "config" here. This should be upgraded to use the same mechanism as the other components?
61-
// Note that since this is set on "rootProject.ext", it will be "in scope" during the evaluation of all projects'
62-
// gradle files. This means that they can just access "config.<value>", and it'll function properly
63-
gradle.rootProject.ext.library = [
64-
// You can use -Plocal=true to help with mavenLocal publishing workflow.
65-
// It makes a fake version number that's smaller than any published version,
66-
// which can be depended on specifically by the ./build-scripts/substitute-local-appservices.gradle
67-
// but which is unlikely to be depended on by accident otherwise.
68-
version: calcVersion(),
69-
groupId: buildconfig.groupId,
70-
]
71-
gradle.rootProject.ext.description = buildconfig.projects["tooling-nimbus-gradle"].description
72-
}
48+
gradle.projectsLoaded { ->
49+
// Wait until root project is "loaded" before we set "config"
50+
// XXX - there's no "config" here. This should be upgraded to use the same mechanism as the other components?
51+
// Note that since this is set on "rootProject.ext", it will be "in scope" during the evaluation of all projects'
52+
// gradle files. This means that they can just access "config.<value>", and it'll function properly
53+
gradle.rootProject.ext.library = [
54+
// You can use -Plocal=true to help with mavenLocal publishing workflow.
55+
// It makes a fake version number that's smaller than any published version,
56+
// which can be depended on specifically by the ./build-scripts/substitute-local-appservices.gradle
57+
// but which is unlikely to be depended on by accident otherwise.
58+
version: calcVersion(buildconfig),
59+
groupId: buildconfig.groupId,
60+
]
61+
gradle.rootProject.ext.description = buildconfig.projects["tooling-nimbus-gradle"].description
7362
}

0 commit comments

Comments
 (0)