Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Gradle Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: publishMavenJarPublicationToGitHubPackagesRepository
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82 changes: 79 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,95 @@ application (but not subdirectories of i18n) are automatically loaded in to the
database the first time a message is requested after the plugin is installed.

##Installation
Add dependency to your build.gradle for > Grails 6.x:

Add dependency to your build.gradle for > Grails 3.2.x:
```
repositories {
...
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.github.vsachinv:grails-localizations:6.0-M1'
}
```

In addition if you don't want to use jitpack.io then use following github package registry:

```groovy
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/vsachinv/grails-localizations")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}

```



Add dependency to your build.gradle for > Grails 5.x and < Grails 6.x:

```
repositories {
...
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.github.vsachinv:grails-localizations:5.0-M1'
}
```

In addition if you don't want to use jitpack.io then use following github package registry:

```groovy
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/vsachinv/grails-localizations")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}

```

Add dependency to your build.gradle for > Grails 4.x and < Grails 5.x:

```
repositories {
...
maven { url "https://jitpack.io" }
}

dependencies {
compile 'com.github.vsachinv:grails-localizations:4.0-M1'
}
```

Add dependency to your build.gradle for > Grails 3.2.x and < Grails 4.x:

```
repositories {
...
maven { url "http://dl.bintray.com/sachinverma/plugins" }
// maven { url "http://dl.bintray.com/sachinverma/plugins" } remove this as Bintray repo Services down now.
// maven { url "https://softclinic.jfrog.io/artifactory/grails-plugins-release" }
maven { url "https://jitpack.io" }
}

dependencies {
compile 'org.grails.plugins:grails-localizations:0.1.3'
//compile 'org.grails.plugins:grails-localizations:0.1.3'
compile 'com.github.vsachinv:grails-localizations:0.1.3'
}
```
Source Code for Grails 3.x: https://github.com/vsachinv/grails-localizations/tree/grails3-upgrade


Add dependency to your BuildConfig.groovy for Grails 2.x:
Expand Down
205 changes: 137 additions & 68 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,88 +1,157 @@
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.8.2"
}
plugins {
id "groovy"
id "idea"
id "org.grails.grails-web"
id "org.grails.grails-gsp"
id "org.grails.grails-plugin"
id "application"
id "eclipse"
id "com.gorylenko.gradle-git-properties"
id "maven-publish"
}

version "0.1.3"
group "org.grails.plugins"

apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "org.grails.grails-plugin"
apply plugin: "org.grails.grails-plugin-publish"
apply plugin: "org.grails.grails-gsp"
apply plugin: "asset-pipeline"
group = "org.grails.plugins"

repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://repo.grails.org/grails/core/" }
}

configurations {
all {
}
}

dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
profile "org.grails.profiles:web-plugin"
provided "org.grails:grails-plugin-services"
provided "org.grails:grails-plugin-domain-class"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2"
implementation("org.grails:grails-core")
implementation("org.grails:grails-logging")
implementation("org.grails:grails-plugin-databinding")
implementation("org.grails:grails-plugin-i18n")
implementation("org.grails:grails-plugin-interceptors")
implementation("org.grails:grails-plugin-rest")
implementation("org.grails:grails-plugin-services")
implementation("org.grails:grails-plugin-url-mappings")
implementation("org.grails:grails-web-boot")
implementation("org.grails.plugins:hibernate5")
implementation("org.springframework.boot:spring-boot-autoconfigure")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.boot:spring-boot-starter-validation")
compileOnly("io.micronaut:micronaut-inject-groovy")
console("org.grails:grails-console")
runtimeOnly("com.h2database:h2")
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
testImplementation("io.micronaut:micronaut-inject-groovy")
testImplementation("org.grails:grails-gorm-testing-support")
testImplementation("org.spockframework:spock-core")
testImplementation("io.micronaut:micronaut-http-client")

implementation("org.grails.plugins:scaffolding")
implementation "org.grails.plugins:converters:4.0.1"

}

application {
mainClass.set("grails6pluginsample.Application")
}

java {
sourceCompatibility = JavaVersion.toVersion("11")
}

bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
addResources = true
ignoreExitValue true
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
// enable if you wish to package this plugin as a standalone application
bootRepackage.enabled = false
grailsPublish {
githubSlug = 'halfbaked/grails-localizations'
license {
name = 'Apache-2.0'

tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
title = "Localizations (messages) plugin"
desc = '''This plugin will pull i18n definitions from the database rather than from the standard properties files in the i18n folder for Grails 3 applications.

It will do the following:
* Create a domain class and corresponding table called Localization
* Prepopulate the table with all the message properties it finds in the i18n folder
* Ensure Grails writes i18n messages based on what it finds in the database rather than the 118n folder

In addtion the plugin also has these added features to help you:
* A CRUD UI to add, delete, and update i18n messages
* A cache for increased speed
* A JSONP action which can be useful in client-side templating.

Asumptions:
* Your database supports unicode
* Your application has a layout called main
'''
developers = [sachinverma: "Sachin Verma", halfbaked: "Eamonn O'Connell"]
}

bintray {
pkg {
name = "$project.name"
issueTrackerUrl = "https://github.com/halfbaked/$project.name/issues"
vcsUrl = "https://github.com/halfbaked/$project.name"
version {
attributes = ['grails-plugin': "$project.group:$project.name"]
name = project.version
}

gitProperties {
keys = ['git.branch', 'git.commit.id', 'git.commit.time', 'git.commit.id.abbrev']
failOnNoGitDirectory = true
extProperty = 'gitProps' // git properties will be put in a map at project.ext.gitProps
}

generateGitProperties.outputs.upToDateWhen {
false
} // make sure the generateGitProperties task always executes (even when git.properties is not changed)

jar {
dependsOn generateGitProperties
manifest {
attributes("Built-By": System.getProperty("user.name"))
attributes(["Plugin-Version" : version,
"Plugin-Title" : project.name,
"Plugin-Build-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Git-Commit" : "${-> project.ext.gitProps['git.commit.id.abbrev']}",
"Git-Branch" : "${-> project.ext.gitProps['git.branch']}"])
}
from sourceSets.main.output
exclude 'git.properties'
}

task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

task packageJavadoc(type: Jar) {
from javadoc
classifier = 'javadoc'
}

assets {
packagePlugin = true
task packageGroovydoc(type: Jar) {
from groovydoc
classifier = 'groovydoc'
}

tasks.withType(Test) {
useJUnitPlatform()
}
// enable if you wish to package this plugin as a standalone application
bootJar.enabled = false

publishing {

publications {
mavenJar(MavenPublication) {
from components.java
artifact sourceJar
artifact packageJavadoc
artifact packageGroovydoc
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/vsachinv/grails-localizations")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
maven {
name = "NexusRepo"
credentials {
username project.findProperty("nexusUsername") ?: System.getenv("NEXUS_USERNAME")
password project.findProperty("nexusPassword") ?: System.getenv("NEXUS_PASSWORD")
}
url project.findProperty("nexusUrl") ?: System.getenv("NEXUS_URL")
}

}
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://repo.grails.org/grails/core" }
}

dependencies {
implementation("org.grails:grails-gradle-plugin:6.1.2")
implementation("org.grails.plugins:hibernate5:8.1.0")
implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0")
implementation("com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.2")
}
10 changes: 7 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
grailsVersion=3.2.9
gormVersion=6.0.12.RELEASE
gradleWrapperVersion=3.4.1
grailsVersion=6.2.0
grailsGradlePluginVersion=6.1.2
version=6.0-M1
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading