Skip to content

Commit

Permalink
Merge pull request clojurephant#152 from clojurephant/fixes
Browse files Browse the repository at this point in the history
Additional fixes to finalize 0.6.0
  • Loading branch information
ajoberstar authored Jan 9, 2021
2 parents 4c358be + 0137d09 commit b51a530
Show file tree
Hide file tree
Showing 34 changed files with 421 additions and 451 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ jobs:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
CLOJARS_USER: ${{ secrets.CLOJARS_USER }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}
GRADLE_OPTS: "-Dorg.gradle.project.gradle.publish.key=${{ secrets.GRADLE_PLUGIN_KEY }} -Dorg.gradle.project.gradle.publish.secret=${{ secrets.GRADLE_PLUGIN_SECRET }}"
run: "./gradlew reckonTagPush publish publishPlugins -Preckon.scope=${{ github.event.inputs.scope }} -Preckon.stage=${{ github.event.inputs.stage }}"
135 changes: 0 additions & 135 deletions build.gradle

This file was deleted.

13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("org.ajoberstar.grgit")
id("org.ajoberstar.reckon")
id("com.diffplug.spotless")
}

///////////////////////////////////////////////////////////////////////////////
// Versioning and Release
///////////////////////////////////////////////////////////////////////////////
reckon {
scopeFromProp()
stageFromProp("alpha", "beta", "rc", "final")
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
maven(url = "https://repo.clojars.org")
}

dependencies {
implementation("dev.clojurephant:clojurephant-plugin:0.6.0-alpha.4")
implementation("com.diffplug.spotless:spotless-plugin-gradle:5.9.0")
}
72 changes: 72 additions & 0 deletions buildSrc/src/main/kotlin/clj-new-template.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import java.io.ByteArrayOutputStream
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.util.GradleVersion

plugins {
id("dev.clojurephant.clojure")
id("maven-publish")
}

dependencies {
compileOnly("org.clojure:clojure:1.10.1")
compileOnly("seancorfield:clj-new:1.1.234")
}

publishing {
publications {
create<MavenPublication>("main") {
group = project.name
artifactId = "clj-template"
from(components["java"])
}
}
}

tasks.named<Copy>("processResources") {
eachFile {
if (name.endsWith(".gradle")) {
filter(ReplaceTokens::class, "tokens" to mapOf("clojurephant.version" to project.version.toString()))
}
}
}

tasks.register<JavaExec>("newProject") {
workingDir = file("${rootProject.projectDir}/templates-test")
classpath = files(sourceSets["main"].output, configurations["compileClasspath"])
main = "clojure.main"
args("-m", "clj-new.create", project.name, "my.group/sample-${project.name}", "+localplugin")
doFirst {
workingDir.mkdirs()
delete("${workingDir}/sample-${project.name}")
}
dependsOn(tasks.jar)
dependsOn(":clojurephant-tools:publishToMavenLocal")
dependsOn(":clojurephant-plugin:publishToMavenLocal")
}

tasks.register<Exec>("verifyGradleVersion") {
dependsOn(tasks.named("newProject"))

workingDir = file("${rootProject.projectDir}/templates-test/sample-${project.name}")
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
executable = "gradlew.bat"
} else {
executable = "./gradlew"
}
args("--version")

standardOutput = ByteArrayOutputStream()
doLast {
val out = standardOutput.toString()
val versionPattern = """Gradle (\d+\S+)""".toRegex()
val matchResult = versionPattern.find(out)
val (version) = matchResult!!.destructured
if (!GradleVersion.version(version).equals(GradleVersion.current())) {
throw GradleException("Templates have incorrect Gradle wrapper \"$version\". Run ./copy-wrapper.ps1 to update.")
}
}
}

tasks.named("check") {
dependsOn(tasks.named("verifyGradleVersion"))
}
96 changes: 96 additions & 0 deletions buildSrc/src/main/kotlin/library-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
plugins {
java
`maven-publish`
id("dev.clojurephant.clojure")
id("com.diffplug.spotless")
}

///////////////////////////////////////////////////////////////////////////////
// Dependencies
///////////////////////////////////////////////////////////////////////////////
repositories {
mavenCentral()
maven {
name = "Clojars"
url = uri("https://repo.clojars.org/")
}
}

///////////////////////////////////////////////////////////////////////////////
// Packaging
///////////////////////////////////////////////////////////////////////////////
group = "dev.clojurephant"

configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}

tasks.register<Jar>("sourcesJar") {
from(sourceSets["main"].allSource)
archiveClassifier.set("sources")
}

///////////////////////////////////////////////////////////////////////////////
// Code Style and Formatting
///////////////////////////////////////////////////////////////////////////////
spotless {
java {
importOrder("java", "javax", "")
removeUnusedImports()
eclipse().configFile(rootProject.file("gradle/eclipse-java-formatter.xml"))
}
}

///////////////////////////////////////////////////////////////////////////////
// Publishing
///////////////////////////////////////////////////////////////////////////////

// Publish to following repositories
publishing {
repositories {
maven {
name = "bintray"
url = uri("https://api.bintray.com/maven/clojurephant/maven/clojurephant/;publish=1")
credentials {
username = System.getenv("BINTRAY_USER")
password = System.getenv("BINTRAY_KEY")
}
}
maven {
name = "clojars"
url = uri("https://repo.clojars.org")
credentials {
username = System.getenv("CLOJARS_USER")
password = System.getenv("CLOJARS_TOKEN")
}
}
}
publications.withType<MavenPublication>() {
// use static versions in poms
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}

pom {
// include repository info in POM (needed for cljdoc)
scm {
connection.set("https://github.com/clojurephant/clojurephant.git")
developerConnection.set("git@github.com:clojurephant/clojurephant.git")
url.set("https://github.com/clojurephant/clojurephant")
if (!version.toString().contains("+")) {
tag.set(version.toString())
}
}
}
}
}

// Clojars doesn"t support module metadata
tasks.withType<GenerateModuleMetadata>() {
enabled = false
}
3 changes: 1 addition & 2 deletions clojurephant-plugin/.stutter/java14.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# DO NOT MODIFY: Generated by Stutter plugin.
6.3
6.7.1
6.8-rc-5
6.8
3 changes: 1 addition & 2 deletions clojurephant-plugin/.stutter/java8.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
5.0
5.6.4
6.0.1
6.7.1
6.8-rc-5
6.8
Loading

0 comments on commit b51a530

Please sign in to comment.