mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix build configuration for releasing TeaVM. Add release script.
This commit is contained in:
parent
0e4b0f6b11
commit
671b1da25b
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,9 +1,9 @@
|
||||||
# output dir
|
# output dir
|
||||||
target
|
|
||||||
build
|
build
|
||||||
/build-dir
|
/build-dir
|
||||||
/build-cache
|
/build-cache
|
||||||
/deploy-with-env.sh
|
/deploy-with-env.sh
|
||||||
|
/release-with-env.sh
|
||||||
/.gradle
|
/.gradle
|
||||||
/build-logic/.gradle
|
/build-logic/.gradle
|
||||||
/relocated
|
/relocated
|
||||||
|
@ -33,5 +33,3 @@ local.properties
|
||||||
!.idea/codeStyles
|
!.idea/codeStyles
|
||||||
!.idea/copyright
|
!.idea/copyright
|
||||||
!.idea/checkstyle-idea.xml
|
!.idea/checkstyle-idea.xml
|
||||||
|
|
||||||
dependency-reduced-pom.xml
|
|
|
@ -67,6 +67,7 @@ class DependencyRelocationExtensionImpl implements DependencyRelocationExtension
|
||||||
project.getPlugins().apply(VersionCatalogPlugin.class);
|
project.getPlugins().apply(VersionCatalogPlugin.class);
|
||||||
project.getPlugins().apply(JavaLibraryPlugin.class);
|
project.getPlugins().apply(JavaLibraryPlugin.class);
|
||||||
project.getPlugins().apply(PublishTeaVMPlugin.class);
|
project.getPlugins().apply(PublishTeaVMPlugin.class);
|
||||||
|
project.setDescription("Relocated " + dependency.alias + " artifact to avoid JAR hell");
|
||||||
|
|
||||||
var synthesizedProjects = new HashMap<ModuleIdentifier, String>();
|
var synthesizedProjects = new HashMap<ModuleIdentifier, String>();
|
||||||
for (var dep : depsByProjectPath.values()) {
|
for (var dep : depsByProjectPath.values()) {
|
||||||
|
|
|
@ -24,6 +24,8 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||||
import org.gradle.api.publish.plugins.PublishingPlugin;
|
import org.gradle.api.publish.plugins.PublishingPlugin;
|
||||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||||
import org.gradle.external.javadoc.CoreJavadocOptions;
|
import org.gradle.external.javadoc.CoreJavadocOptions;
|
||||||
|
import org.gradle.plugins.signing.SigningExtension;
|
||||||
|
import org.gradle.plugins.signing.SigningPlugin;
|
||||||
|
|
||||||
public abstract class PublishTeaVMPlugin implements Plugin<Project> {
|
public abstract class PublishTeaVMPlugin implements Plugin<Project> {
|
||||||
private static final String EXTENSION_NAME = "teavmPublish";
|
private static final String EXTENSION_NAME = "teavmPublish";
|
||||||
|
@ -32,6 +34,7 @@ public abstract class PublishTeaVMPlugin implements Plugin<Project> {
|
||||||
public void apply(Project target) {
|
public void apply(Project target) {
|
||||||
target.getPlugins().apply(PublishingPlugin.class);
|
target.getPlugins().apply(PublishingPlugin.class);
|
||||||
target.getPlugins().apply(MavenPublishPlugin.class);
|
target.getPlugins().apply(MavenPublishPlugin.class);
|
||||||
|
target.getPlugins().apply(SigningPlugin.class);
|
||||||
|
|
||||||
var extension = new ExtensionImpl();
|
var extension = new ExtensionImpl();
|
||||||
target.getExtensions().add(PublishTeaVMExtension.class, EXTENSION_NAME, extension);
|
target.getExtensions().add(PublishTeaVMExtension.class, EXTENSION_NAME, extension);
|
||||||
|
@ -42,6 +45,12 @@ public abstract class PublishTeaVMPlugin implements Plugin<Project> {
|
||||||
customizePublication(target, publication, extension);
|
customizePublication(target, publication, extension);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
var publish = Boolean.parseBoolean(target.getProviders().gradleProperty("teavm.mavenCentral.publish")
|
||||||
|
.getOrElse("false"));
|
||||||
|
if (publish) {
|
||||||
|
var signing = target.getExtensions().getByType(SigningExtension.class);
|
||||||
|
publishing.getPublications().configureEach(signing::sign);
|
||||||
|
}
|
||||||
publishing.repositories(repositories -> {
|
publishing.repositories(repositories -> {
|
||||||
var url = target.getProviders().gradleProperty("teavm.publish.url");
|
var url = target.getProviders().gradleProperty("teavm.publish.url");
|
||||||
if (url.isPresent()) {
|
if (url.isPresent()) {
|
||||||
|
@ -54,7 +63,16 @@ public abstract class PublishTeaVMPlugin implements Plugin<Project> {
|
||||||
"teavm.publish.password").get());
|
"teavm.publish.password").get());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
repositories.mavenCentral();
|
if (publish) {
|
||||||
|
repositories.maven(repository -> {
|
||||||
|
repository.setName("OSSRH");
|
||||||
|
repository.setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2");
|
||||||
|
repository.getCredentials().setUsername(target.getProviders().gradleProperty(
|
||||||
|
"ossrhUsername").get());
|
||||||
|
repository.getCredentials().setPassword(target.getProviders().gradleProperty(
|
||||||
|
"ossrhPassword").get());
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -71,4 +71,4 @@ version.ref = "shadow"
|
||||||
[plugins]
|
[plugins]
|
||||||
|
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||||
intellij = { id = "org.jetbrains.intellij", version = "1.10.0" }
|
intellij = { id = "org.jetbrains.intellij", version = "1.13.1" }
|
49
release.sh
Executable file
49
release.sh
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#
|
||||||
|
# Copyright 2023 Alexey Andreev.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
mkdir -p build-dir
|
||||||
|
|
||||||
|
git fetch
|
||||||
|
git archive master | tar -x -C build-dir || { echo 'Git archive failed' ; exit 1; }
|
||||||
|
|
||||||
|
TEAVM_RELEASE_VERSION=$1
|
||||||
|
|
||||||
|
function release_teavm {
|
||||||
|
echo "Building version $TEAVM_RELEASE_VERSION"
|
||||||
|
|
||||||
|
GRADLE="./gradlew"
|
||||||
|
GRADLE+=" --no-daemon --no-configuration-cache --stacktrace"
|
||||||
|
GRADLE+=" -Pteavm.mavenCentral.publish=true"
|
||||||
|
GRADLE+=" -Pteavm.project.version=$TEAVM_RELEASE_VERSION"
|
||||||
|
GRADLE+=" -Psigning.keyId=$TEAVM_GPG_KEY_ID"
|
||||||
|
GRADLE+=" -Psigning.password=$TEAVM_GPG_PASSWORD"
|
||||||
|
GRADLE+=" -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg"
|
||||||
|
GRADLE+=" -PossrhUsername=$TEAVM_SONATYPE_LOGIN"
|
||||||
|
GRADLE+=" -PossrhPassword=$TEAVM_SONATYPE_PASSWORD"
|
||||||
|
GRADLE+=" -Pteavm.idea.publishToken='$TEAVM_INTELLIJ_TOKEN'"
|
||||||
|
|
||||||
|
$GRADLE build -x test || { echo 'Build failed' ; return 1; }
|
||||||
|
$GRADLE --max-workers 1 publish publishPlugin || { echo 'Release failed' ; return 1; }
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd build-dir
|
||||||
|
release_teavm
|
||||||
|
EXIT_CODE=$?
|
||||||
|
popd
|
||||||
|
rm -rf build-dir
|
||||||
|
exit $EXIT_CODE
|
|
@ -83,13 +83,15 @@ gradle.afterProject {
|
||||||
extensions.findByType<PublishingExtension>()?.apply {
|
extensions.findByType<PublishingExtension>()?.apply {
|
||||||
publications.all {
|
publications.all {
|
||||||
if (this is MavenPublication) {
|
if (this is MavenPublication) {
|
||||||
pom { setupPom() }
|
pom { setupPom(this@afterProject) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun MavenPom.setupPom() {
|
fun MavenPom.setupPom(project: Project) {
|
||||||
|
name.set(project.description)
|
||||||
|
description.set(project.description)
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name.set("The Apache Software License, Version 2.0")
|
name.set("The Apache Software License, Version 2.0")
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-library`
|
`java-library`
|
||||||
`teavm-publish`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Incremental generator of C code"
|
description = "Incremental generator of C code"
|
||||||
|
@ -25,7 +24,3 @@ dependencies {
|
||||||
implementation(project(":core"))
|
implementation(project(":core"))
|
||||||
implementation(project(":tools:core"))
|
implementation(project(":tools:core"))
|
||||||
}
|
}
|
||||||
|
|
||||||
teavmPublish {
|
|
||||||
artifactId = "teavm-c-inremental"
|
|
||||||
}
|
|
|
@ -20,6 +20,8 @@ plugins {
|
||||||
`teavm-publish`
|
`teavm-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description = "TeaVM Gradle plugin"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":core"))
|
implementation(project(":core"))
|
||||||
implementation(project(":tools:core"))
|
implementation(project(":tools:core"))
|
||||||
|
@ -30,10 +32,14 @@ gradlePlugin {
|
||||||
create("TeaVMPlugin") {
|
create("TeaVMPlugin") {
|
||||||
id = "org.teavm"
|
id = "org.teavm"
|
||||||
implementationClass = "org.teavm.gradle.TeaVMPlugin"
|
implementationClass = "org.teavm.gradle.TeaVMPlugin"
|
||||||
|
displayName = "TeaVM application plugin"
|
||||||
|
description = "Installs TeaVM compilation tasks, configurations and source sets"
|
||||||
}
|
}
|
||||||
create("TeaVMLibraryPlugin") {
|
create("TeaVMLibraryPlugin") {
|
||||||
id = "org.teavm.library"
|
id = "org.teavm.library"
|
||||||
implementationClass = "org.teavm.gradle.TeaVMLibraryPlugin"
|
implementationClass = "org.teavm.gradle.TeaVMLibraryPlugin"
|
||||||
|
displayName = "TeaVM library plugin"
|
||||||
|
description = "Installs TeaVM DSL for consuming TeaVM libraries and running tests in a browser"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,8 +110,5 @@ publishing {
|
||||||
artifactId = "teavm-gradle-plugin"
|
artifactId = "teavm-gradle-plugin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ intellij {
|
||||||
"org.jetbrains.kotlin"
|
"org.jetbrains.kotlin"
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -47,4 +46,8 @@ tasks {
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishPlugin {
|
||||||
|
token.set(providers.gradleProperty("teavm.idea.publishToken"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<id>org.teavm.idea</id>
|
<id>org.teavm.idea</id>
|
||||||
<name>TeaVM IDEA Integration</name>
|
<name>TeaVM Integration</name>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<vendor email="info@teavm.org" url="http://teavm.org">TeaVM community</vendor>
|
<vendor email="info@teavm.org" url="http://teavm.org">TeaVM community</vendor>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user