Skip to content

Commit

Permalink
added bintray support; CUBA 6.9 support (#6)
Browse files Browse the repository at this point in the history
* added bintray support; CUBA 6.9 support

* updated README information

* switch to 0.2.0
  • Loading branch information
mariodavid authored Jul 14, 2018
1 parent efd7727 commit 543e562
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 84 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.0] - 2018-07-14

### Dependencies
- CUBA 6.9.x

## [0.1.0] - 2018-02-11

### Added

- ability to add attachments to any Entity (`@WithAttachments`)


### Dependencies
- CUBA 6.8.x
92 changes: 38 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@ Just add `@WithAttachments` on the browse screen of your entity and the rest wil
![1-browse-with-attachments](https://github.com/mariodavid/cuba-component-attachable/blob/master/img/1-browse-with-attachments.png)



## Installation



1. `attachable` is available in the [CUBA marketplace](https://www.cuba-platform.com/marketplace)
2. Select a version of the add-on which is compatible with the platform version used in your project:

| Platform Version | declarative-controllers | Add-on Version |
| ---------------- | -------------- | -------------- |
| 6.9.x | 0.6.x | 0.2.x |
| 6.8.x | 0.4.x | 0.1.x |


The latest version is: [ ![Download](https://api.bintray.com/packages/mariodavid/cuba-components/cuba-component-attachable/images/download.svg) ](https://bintray.com/mariodavid/cuba-components/cuba-component-attachable/_latestVersion)

Add custom application component to your project:

* Artifact group: `de.diedavids.cuba.attachable`
* Artifact name: `attachable-global`
* Version: *add-on version*

3. install the compatible version of [cuba-component-declarative-controllers](https://github.com/balvi/cuba-component-declarative-controllers) as another dependecy (see Table from 2. for version compatability).


### NOTE: Dependency: declarative-controllers
This application component requires `declarative-controllers` as another dependency you have to add to your application.

The reason is, that you need to extend your screen from `AnnotatableAbstractLookup` instead of `AbstractLookup`.
This superclass is part of the app-component: [cuba-component-declarative-controllers](https://github.com/balvi/cuba-component-declarative-controllers).

Technically it is not strictly required to directly add the dependency to `declarative-controllers`, since `attachable` already has a dependency on it.

However: since you directly depend on the app component (with extending your classes from `AnnotatableAbstractLookup`),
it is a best practice to explicitly declare the dependency to it.



## Usage

To add attachments to your entity, you have to add the following annotation to your browse / edit screen controller:
Expand Down Expand Up @@ -57,57 +95,3 @@ The ability to do the preview depends on the attachment type and the browser cap
The application components adds the following application properties, that can be changed in the corresponding screen (`Administration > Application Properties):

* `attachable.updateAttachmentCounterOnSelect` - whether or not a counter of attachments should be displayed after a particular entity is selected in the table

## Installation


### NOTE: Dependency: declarative-controllers
This application component requires `declarative-controllers` as another dependency you have to add to your application.

The reason is, that you need to extend your screen from `AnnotatableAbstractLookup` instead of `AbstractLookup`.
This superclass is part of the app-component: [cuba-component-declarative-controllers](https://github.com/balvi/cuba-component-declarative-controllers).

Technically it is not strictly required to directly add the dependency to `declarative-controllers`, since `attachable` already has a dependency on it.

However: since you directly depend on the app component (with extending your classes from `AnnotatableAbstractLookup`),
it is a best practice to explicitly declare the dependency to it.



1. Add the following maven repository `https://dl.bintray.com/mariodavid/cuba-components` to the build.gradle of your CUBA application:


buildscript {

//...

repositories {

// ...

maven {
url "https://dl.bintray.com/mariodavid/cuba-components"
}
}

// ...
}


2. Select a version of the add-on which is compatible with the platform version used in your project:

| Platform Version | declarative-controllers | Add-on Version |
| ---------------- | -------------- | -------------- |
| 6.8.x | 0.4.x | 0.1.x |


The latest version is: [ ![Download](https://api.bintray.com/packages/mariodavid/cuba-components/cuba-component-attachable/images/download.svg) ](https://bintray.com/mariodavid/cuba-components/cuba-component-attachable/_latestVersion)

Add custom application component to your project:

* Artifact group: `de.diedavids.cuba.attachable`
* Artifact name: `attachable-global`
* Version: *add-on version*

3. install the compatible version of [cuba-component-declarative-controllers](https://github.com/balvi/cuba-component-declarative-controllers) as another dependecy (see Table from 2. for version compatability).

64 changes: 48 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

buildscript {
ext.cubaVersion = '6.8.0'
ext.cubaVersion = '6.9.2'
repositories {

mavenLocal()
Expand All @@ -25,6 +25,8 @@ buildscript {
dependencies {
classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"

classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0"

classpath 'net.saliman:gradle-cobertura-plugin:2.5.0'
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2"
}
Expand All @@ -41,44 +43,74 @@ def coreModule = project(":${modulePrefix}-core")
def guiModule = project(":${modulePrefix}-gui")
def webModule = project(":${modulePrefix}-web")

def servletApi = 'org.apache.tomcat:tomcat-servlet-api:8.0.26'
def servletApi = 'javax.servlet:javax.servlet-api:3.1.0'


apply(plugin: 'idea')
apply(plugin: 'cuba')


def bintrayRepositoryUrl = "https://api.bintray.com/maven/mariodavid/cuba-components/cuba-component-attachable/;publish=1"


cuba {
artifact {
group = 'de.diedavids.cuba.attachable'
version = "0.1.0"
version = "0.2.0"
isSnapshot = false
}
tomcat {
dir = "$project.rootDir/deploy/tomcat"
}
uploadRepository {
if (cuba.artifact.isSnapshot) {
url = System.properties['uploadRepositorySnapshot'] ?: System.env.UPLOAD_REPOSITORY_SNAPSHOT
} else {
url = System.properties['uploadRepositoryRelease'] ?: System.env.UPLOAD_REPOSITORY_RELEASE ?: bintrayRepositoryUrl
}

user = System.properties['uploadRepositoryUsername'] ?: System.env.UPLOAD_REPOSITORY_USERNAME
password = System.properties['uploadRepositoryPassword'] ?:System.env.UPLOAD_REPOSITORY_PASSWORD
}
ide {
vcs = 'Git'
}
}


subprojects {
apply plugin: 'com.jfrog.bintray'

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('UPLOAD_REPOSITORY_USERNAME')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('UPLOAD_REPOSITORY_PASSWORD')

configurations = ['archives']

publish = true

override = false

// metadata
pkg {
repo = 'cuba-components'
name = 'cuba-component-attachable'
desc = 'CUBA component that lets you add attachments to any entity'
userOrg = 'mariodavid'

websiteUrl = 'https://github.com/mariodavid/cuba-component-attachable'
issueTrackerUrl = 'https://github.com/mariodavid/cuba-component-attachable/issues'
vcsUrl = 'https://github.com/mariodavid/cuba-component-attachable.git'

licenses = ["Apache-2.0"]

labels = ['attachable', 'file attachments', 'cuba-patform', 'cuba-component']
githubRepo = 'mariodavid/cuba-component-attachable'
githubReleaseNotesFile = 'CHANGELOG.md'

version {
name = "${cuba.artifact.version}"
desc = ''
released = new Date()
vcsTag = "${cuba.artifact.version}"
}
}
}
}

dependencies {
appComponent("com.haulmont.cuba:cuba-global:$cubaVersion")
appComponent("de.balvi.cuba.declarativecontrollers:declarativecontrollers-global:0.4.0")
appComponent("de.diedavids.cuba.entitysoftreference:entity-soft-reference-global:0.2.0")
appComponent("de.balvi.cuba.declarativecontrollers:declarativecontrollers-global:0.6.0")
appComponent("de.diedavids.cuba.entitysoftreference:entity-soft-reference-global:0.3.0")

}

Expand Down
4 changes: 4 additions & 0 deletions studio-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<functionalitySettings>
<functionality id="oneToOneIndex"
state="ENABLE"/>
<functionality id="joinedInheritanceDeleteCascade"
state="ENABLE"/>
<functionality id="newFkConstraintNaming"
state="ENABLE"/>
</functionalitySettings>
</studio>
14 changes: 1 addition & 13 deletions upload-to-repository.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
#!/usr/bin/env bash

if [[ -z "$1" || -z "$2" ]]
then
echo "Define username, password and repository URL as parameters. Usage: ./upload-to-repository.sh myUser myPassword https://api.bintray.com/maven/balvi/..."

else
if [[ -z "$3" ]]
then
./gradlew -DuploadRepositoryUsername=$1 -DuploadRepositoryPassword=$2 uploadArchives
else
./gradlew -DuploadRepositoryUsername=$1 -DuploadRepositoryPassword=$2 -DuploadRepositoryRelease=$3 uploadArchives

fi

fi
./gradlew clean assemble bintrayUpload

0 comments on commit 543e562

Please sign in to comment.