mirror of
https://github.com/servo/servo.git
synced 2025-06-08 16:43:28 +00:00
Create a Maven repository
This commit is contained in:
parent
57053e03bb
commit
54d7788698
2 changed files with 51 additions and 3 deletions
|
@ -198,7 +198,12 @@ class PackageCommands(CommandBase):
|
||||||
@CommandArgument('--flavor', '-f',
|
@CommandArgument('--flavor', '-f',
|
||||||
default=None,
|
default=None,
|
||||||
help='Package using the given Gradle flavor')
|
help='Package using the given Gradle flavor')
|
||||||
def package(self, release=False, dev=False, android=None, debug=False, debugger=None, target=None, flavor=None):
|
@CommandArgument('--maven',
|
||||||
|
default=None,
|
||||||
|
action='store_true',
|
||||||
|
help='Create a local Maven repository')
|
||||||
|
def package(self, release=False, dev=False, android=None, debug=False,
|
||||||
|
debugger=None, target=None, flavor=None, maven=False):
|
||||||
if android is None:
|
if android is None:
|
||||||
android = self.config["build"]["android"]
|
android = self.config["build"]["android"]
|
||||||
if target and android:
|
if target and android:
|
||||||
|
@ -235,9 +240,13 @@ class PackageCommands(CommandBase):
|
||||||
variant = ":assemble" + flavor_name + build_type + build_mode
|
variant = ":assemble" + flavor_name + build_type + build_mode
|
||||||
apk_task_name = ":servoapp" + variant
|
apk_task_name = ":servoapp" + variant
|
||||||
aar_task_name = ":servoview" + variant
|
aar_task_name = ":servoview" + variant
|
||||||
|
maven_task_name = ":servoview:uploadArchive"
|
||||||
|
argv = ["./gradlew", "--no-daemon", apk_task_name, aar_task_name]
|
||||||
|
if maven:
|
||||||
|
argv.append(maven_task_name)
|
||||||
try:
|
try:
|
||||||
with cd(path.join("support", "android", "apk")):
|
with cd(path.join("support", "android", "apk")):
|
||||||
subprocess.check_call(["./gradlew", "--no-daemon", apk_task_name, aar_task_name], env=env)
|
subprocess.check_call(argv, env=env)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print("Packaging Android exited with return value %d" % e.returncode)
|
print("Packaging Android exited with return value %d" % e.returncode)
|
||||||
return e.returncode
|
return e.returncode
|
||||||
|
|
|
@ -259,3 +259,42 @@ class ServoDependency {
|
||||||
public String fileName;
|
public String fileName;
|
||||||
public String folderFilter;
|
public String folderFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'maven'
|
||||||
|
import org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact
|
||||||
|
|
||||||
|
uploadArchives {
|
||||||
|
doFirst {
|
||||||
|
for ( arch in ["arm", "armv7", "arm64", "x86"] ) {
|
||||||
|
def target = getTargetDir(false, arch)
|
||||||
|
def aar = new File(target, "servoview.aar")
|
||||||
|
if (aar.exists()) {
|
||||||
|
def art = new DefaultPublishArtifact("servoview-" + arch, "aar", "aar", null, new Date(), aar);
|
||||||
|
project.artifacts.add('archives', art)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories.mavenDeployer {
|
||||||
|
repository(url: "file://localhost/${buildDir}/maven")
|
||||||
|
def cmd = "git rev-parse --short HEAD"
|
||||||
|
def proc = cmd.execute()
|
||||||
|
def commit = proc.text.trim()
|
||||||
|
def version = "0.0.1." + new Date().format('yyyyMMdd') + "." + commit
|
||||||
|
for ( arch_ in ["arm", "armv7", "arm64", "x86"] ) {
|
||||||
|
def arch = arch_
|
||||||
|
addFilter(arch) {artifact, file -> artifact.name == "servoview-" + arch}
|
||||||
|
pom(arch).artifactId = "servoview-" + arch
|
||||||
|
pom(arch).groupId = 'org.mozilla.servoview'
|
||||||
|
pom(arch).version = version
|
||||||
|
pom(arch).project {
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name 'The Mozilla Public License, v. 2.0'
|
||||||
|
url 'http://mozilla.org/MPL/2.0/'
|
||||||
|
distribution 'repo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue