mirror of
https://github.com/google/nomulus.git
synced 2025-05-04 22:17:51 +02:00
Add a script to generate dependency metadata
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=225872347
This commit is contained in:
parent
214fb49091
commit
40b05ffb3c
3 changed files with 74 additions and 11 deletions
|
@ -120,7 +120,7 @@ subprojects {
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = project.findProperty('gcsRepo')
|
url = project.findProperty('repositoryUrl')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,8 @@ subprojects {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
it.resolvedConfiguration.resolvedArtifacts.each { resolvedArtifact ->
|
it.resolvedConfiguration.resolvedArtifacts.each { resolvedArtifact ->
|
||||||
if (resolvedArtifact.id.componentIdentifier.displayName in ['project :util', 'project :third_party']) {
|
if (resolvedArtifact.id.componentIdentifier.displayName in
|
||||||
|
['project :core', 'project :proxy', 'project :util', 'project :third_party']) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
distinctResolvedArtifacts[resolvedArtifact.id.toString()] = resolvedArtifact
|
distinctResolvedArtifacts[resolvedArtifact.id.toString()] = resolvedArtifact
|
||||||
|
@ -203,7 +204,10 @@ subprojects {
|
||||||
def repositoryUri = URI.create(mavenRepository.url.toString())
|
def repositoryUri = URI.create(mavenRepository.url.toString())
|
||||||
def artifactUri = repositoryUri.resolve(defaultLayout.getPath(artifact))
|
def artifactUri = repositoryUri.resolve(defaultLayout.getPath(artifact))
|
||||||
if (project.ext.urlExists(artifactUri.toURL())) {
|
if (project.ext.urlExists(artifactUri.toURL())) {
|
||||||
project.ext.writeMetadata(resolvedArtifact, artifactUri.toURL(), project.findProperty('privateRepository') + "/${project.name}")
|
project.ext.writeMetadata(
|
||||||
|
resolvedArtifact,
|
||||||
|
artifactUri.toURL(),
|
||||||
|
project.findProperty('privateRepository') + "/${project.name}")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
gradle/generate_dependency_metadata.sh
Executable file
38
gradle/generate_dependency_metadata.sh
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2018 The Nomulus Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# This script runs a workflow to clone a git repository to local, generate
|
||||||
|
# a metadata file for each dependency artifact and check in the file to remote
|
||||||
|
# repository.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ALL_SUBPROJECTS="core proxy util"
|
||||||
|
|
||||||
|
USAGE="Usage: ${0} REPO_URL"
|
||||||
|
REPO_URL=${1:?${USAGE}}
|
||||||
|
|
||||||
|
REPO_DIR="$(mktemp -d)"
|
||||||
|
|
||||||
|
git clone ${REPO_URL} ${REPO_DIR}
|
||||||
|
for PROJECT in ${ALL_SUBPROJECTS}; do
|
||||||
|
$(dirname $0)/gradlew -PprivateRepository="${REPO_DIR}" \
|
||||||
|
":${PROJECT}:generateDependencyMetadata"
|
||||||
|
done
|
||||||
|
cd "${REPO_DIR}"
|
||||||
|
git add -A
|
||||||
|
git diff-index --quiet HEAD \
|
||||||
|
|| git commit -m "Update dependency metadata file" && git push
|
||||||
|
rm -rf "${REPO_DIR}"
|
|
@ -12,7 +12,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
#
|
#
|
||||||
# This script runs a workflow to generate dependency lock file, run a build against
|
# This script runs a workflow to generate dependency lock file, run a build against
|
||||||
# the generated lock file, save the lock file and upload dependency JARs to a private
|
# the generated lock file, save the lock file and upload dependency JARs to a private
|
||||||
|
@ -22,16 +21,38 @@ set -e
|
||||||
|
|
||||||
ALL_SUBPROJECTS="core proxy util"
|
ALL_SUBPROJECTS="core proxy util"
|
||||||
SUBPROJECTS=
|
SUBPROJECTS=
|
||||||
|
REPOSITORY_URL=
|
||||||
|
|
||||||
if [[ -z "$@" ]]; then
|
while [[ $# -gt 0 ]]; do
|
||||||
|
KEY="$1"
|
||||||
|
case ${KEY} in
|
||||||
|
--repositoryUrl)
|
||||||
|
shift
|
||||||
|
REPOSITORY_URL="$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
SUBPROJECTS="${SUBPROJECTS} ${KEY}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z ${SUBPROJECTS} ]]; then
|
||||||
SUBPROJECTS="${ALL_SUBPROJECTS}"
|
SUBPROJECTS="${ALL_SUBPROJECTS}"
|
||||||
else
|
|
||||||
SUBPROJECTS="$@"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${REPOSITORY_URL} ]]; then
|
||||||
|
echo "--repositoryUrl must be specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WORKING_DIR=$(dirname $0)
|
||||||
|
|
||||||
for PROJECT in ${SUBPROJECTS}; do
|
for PROJECT in ${SUBPROJECTS}; do
|
||||||
./gradlew ":${PROJECT}:generateLock"
|
${WORKING_DIR}/gradlew ":${PROJECT}:generateLock"
|
||||||
./gradlew -PdependencyLock.useGeneratedLock=true ":${PROJECT}:build"
|
${WORKING_DIR}/gradlew -PdependencyLock.useGeneratedLock=true \
|
||||||
./gradlew ":${PROJECT}:saveLock"
|
":${PROJECT}:build"
|
||||||
./gradlew ":${PROJECT}:publish"
|
${WORKING_DIR}/gradlew ":${PROJECT}:saveLock"
|
||||||
|
${WORKING_DIR}/gradlew -PrepositoryUrl="${REPOSITORY_URL}" \
|
||||||
|
":${PROJECT}:publish"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue