kopia lustrzana https://github.com/JOSM/MapWithAI
Update to gradle josm plugin 0.8.2 from 0.8.0
Signed-off-by: Taylor Smock <tsmock@fb.com>pull/1/head
rodzic
89c7d898ce
commit
5aa110b829
|
@ -101,7 +101,7 @@ code_navigation:
|
|||
build:
|
||||
stage: test
|
||||
script:
|
||||
- ./gradlew build generatePot generateSnapshotUpdateSite --stacktrace #--info
|
||||
- ./gradlew build localDist --stacktrace #--info
|
||||
artifacts:
|
||||
paths:
|
||||
- build
|
||||
|
@ -359,6 +359,8 @@ publish update site:
|
|||
rm -vrf "pages/public/snapshot/libs"
|
||||
mkdir -pv "pages/public/snapshot/libs"
|
||||
cp -v "build/snapshot-update-site" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/update-site"
|
||||
cp -v "build/localDist/list" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/update-site"
|
||||
sed -i "1s/.*/${PLUGIN_JAR_BASE_NAME}-dev.jar;${CI_PAGES_URL}/${CI_PROJECT_NAME}/snapshot/${CI_COMMIT_REF_NAME}/${PLUGIN_JAR_BASE_NAME}-dev.jar"
|
||||
cp -v "build/dist/"* "pages/public/snapshot/${CI_COMMIT_REF_NAME}"
|
||||
cp -v "build/dist/${PLUGIN_JAR_BASE_NAME}.jar" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/${PLUGIN_JAR_BASE_NAME}-dev.jar"
|
||||
cp -v "build/libs/"*"test-fixture"* "pages/public/snapshot/libs/mapwithai-test-fixture.jar"
|
||||
|
|
101
build.gradle
101
build.gradle
|
@ -1,11 +1,4 @@
|
|||
import groovy.xml.XmlParser
|
||||
import net.ltgt.gradle.errorprone.CheckSeverity
|
||||
import org.openstreetmap.josm.gradle.plugin.config.JosmManifest
|
||||
import org.openstreetmap.josm.gradle.plugin.task.GeneratePluginList
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.stream.Collectors
|
||||
|
||||
plugins {
|
||||
id "com.diffplug.spotless" version "6.6.1"
|
||||
|
@ -18,7 +11,7 @@ plugins {
|
|||
id "java-test-fixtures" /* Used for publishing test fixtures package */
|
||||
id "maven-publish"
|
||||
id "net.ltgt.errorprone" version "2.0.2"
|
||||
id "org.openstreetmap.josm" version "0.8.0"
|
||||
id "org.openstreetmap.josm" version "0.8.2"
|
||||
id "org.sonarqube" version "3.3"
|
||||
id "pmd"
|
||||
}
|
||||
|
@ -48,18 +41,22 @@ java {
|
|||
// Set up Errorprone
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.errorprone {
|
||||
check("ClassCanBeStatic", CheckSeverity.ERROR)
|
||||
check("ConstantField", CheckSeverity.WARN)
|
||||
check("DefaultCharset", CheckSeverity.ERROR)
|
||||
check("FieldCanBeFinal", CheckSeverity.WARN)
|
||||
check("LambdaFunctionalInterface", CheckSeverity.WARN)
|
||||
check("MethodCanBeStatic", CheckSeverity.WARN)
|
||||
check("MultiVariableDeclaration", CheckSeverity.WARN)
|
||||
check("PrivateConstructorForUtilityClass", CheckSeverity.WARN)
|
||||
check("RemoveUnusedImports", CheckSeverity.WARN)
|
||||
check("ReferenceEquality", CheckSeverity.ERROR)
|
||||
check("UngroupedOverloads", CheckSeverity.WARN)
|
||||
check("WildcardImport", CheckSeverity.ERROR)
|
||||
error(
|
||||
"ClassCanBeStatic",
|
||||
"DefaultCharset",
|
||||
"ReferenceEquality",
|
||||
"WildcardImport"
|
||||
)
|
||||
warn(
|
||||
"ConstantField",
|
||||
"FieldCanBeFinal",
|
||||
"LambdaFunctionalInterface",
|
||||
"MethodCanBeStatic",
|
||||
"MultiVariableDeclaration",
|
||||
"PrivateConstructorForUtilityClass",
|
||||
"RemoveUnusedImports",
|
||||
"UngroupedOverloads"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,70 +281,6 @@ spotbugsMain {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a manifest map
|
||||
* @param manifest The manifest to convert
|
||||
* @return The map
|
||||
* @deprecated In v0.8.1 there will be a GenerateJarManifest class
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, String> createUpdateManifest(JosmManifest manifest) {
|
||||
def returnMap = new TreeMap<String, String>();
|
||||
// Required fields first
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_MIN_JOSM_VERSION, manifest.minJosmVersion, false)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_VERSION, project.version.toString(), false)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_MAIN_CLASS, manifest.mainClass, false)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_DESCRIPTION, manifest.description, false)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.AUTHOR, manifest.author)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_MIN_JAVA_VERSION, manifest.minJavaVersion)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_PLATFORM, manifest.platform)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_PROVIDES, manifest.provides)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_EARLY, manifest.loadEarly)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_ICON, manifest.iconPath)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_DEPENDENCIES, manifest.pluginDependencies)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_LOAD_PRIORITY, manifest.loadPriority)
|
||||
putIfNotNull(returnMap, JosmManifest.Attribute.PLUGIN_CAN_LOAD_AT_RUNTIME, manifest.canLoadAtRuntime)
|
||||
|
||||
return returnMap
|
||||
}
|
||||
|
||||
static putIfNotNull(Map<String, String> map, JosmManifest.Attribute attribute, Object value, boolean optional = true) {
|
||||
if (value instanceof Provider) {
|
||||
value = value.getOrNull()
|
||||
}
|
||||
if (value instanceof Collection) {
|
||||
value = (value as Collection).stream().map(Object::toString).collect(Collectors.joining(";"))
|
||||
}
|
||||
if (value != null && !value.toString().trim().isEmpty()) {
|
||||
map.put(attribute.manifestKey, value.toString());
|
||||
} else if (!optional) {
|
||||
throw new IllegalArgumentException("Attribute " + attribute.manifestKey + " cannot be null or empty");
|
||||
}
|
||||
}
|
||||
|
||||
task generateSnapshotUpdateSite(type: GeneratePluginList) {
|
||||
dependsOn(tasks.processResources)
|
||||
|
||||
outputFile = new File(project.buildDir, "snapshot-update-site")
|
||||
versionSuffix = {a -> ""}
|
||||
doFirst {
|
||||
def pluginDownloadUrl = "https://${gitlabGroup}.gitlab.io/${gitlabRepositoryName}/snapshot/master/${archivesBaseName}-dev.jar"
|
||||
it.iconBase64Provider = {
|
||||
def file = new File(sourceSets.main.resources.srcDirs[0], it)
|
||||
if (file.exists()) {
|
||||
def contentType = file.name.endsWith(".svg") ? "svg+xml" : "png"
|
||||
return "data:image/" + contentType + ";base64," + Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get(file.toURI())));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generate a plugin jar manifest map
|
||||
* @deprecated GenerateJarManifest.kt was added after v0.8.0
|
||||
*/
|
||||
def manifest = createUpdateManifest(project.josm.manifest as JosmManifest)
|
||||
it.addPlugin("$archivesBaseName-dev.jar", manifest, new URL(pluginDownloadUrl))
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
|
|
Ładowanie…
Reference in New Issue