Skip to content

Commit 3a05974

Browse files
committed
Reapply "More gradle tweaks so our gradle files work unchanged in mozilla-central."
This reverts commit c7beef8.
1 parent e17c7cc commit 3a05974

File tree

3 files changed

+97
-101
lines changed

3 files changed

+97
-101
lines changed

settings.gradle

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

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

4749
def setupProject(name, projectProps, appServicesRootDir) {
4850
def path = projectProps.path

tools/nimbus-gradle-plugin/build.gradle

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

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-
}
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+
}
5352

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-
}
53+
tasks.register("assembleAndroidTest") {
54+
doLast {}
55+
}
6056

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-
}
57+
tasks.register("assembleRelease") {
58+
doLast {}
59+
}
6760

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-
}
61+
tasks.register("testRelease") {
62+
doLast {}
63+
}
7464

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.
65+
tasks.register("checkMavenArtifacts") {
66+
doLast {}
7967
}
80-
}
8168

82-
// Must match the implementation in publish.gradle
83-
static def getLocalPublicationTimestamp() {
84-
def date = new Date()
85-
return date.format('yyyyMMddHHmmss')
86-
}
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+
}
8787

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
88+
developers {
89+
developer {
90+
name = 'Mozilla Nimbus Team'
91+
email = 'nimbus-team@mozilla.com'
92+
}
10393
}
104-
}
10594

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

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

122-
if (it.hasProperty('android')) {
123-
android {
124-
singleVariant('release') {
125-
withSourcesJar()
112+
repositories {
113+
maven {
114+
url = "$buildDir/maven"
126115
}
127116
}
128117
}
129118

130-
repositories {
131-
maven {
132-
url = "$buildDir/maven"
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
133122
}
123+
checkMavenArtifacts.dependsOn(checkFileSizeTask)
134124
}
135125
}
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: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
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+
59
import org.yaml.snakeyaml.Yaml
610
buildscript {
711
dependencies {
@@ -29,34 +33,41 @@ buildscript {
2933
}
3034
}
3135

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

35-
def calcVersion(buildconfig) {
36-
def local = gradle.rootProject.findProperty("local")
37-
def version = new File(rootDir, '../../version.txt').getText().trim()
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())
3844

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
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+
}
4556
}
46-
}
4757

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
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+
}
6273
}

0 commit comments

Comments
 (0)