Skip to content

Commit

Permalink
WARNING: API broken changes! Implement components / injectors scan an…
Browse files Browse the repository at this point in the history
…d auto instantiation.
  • Loading branch information
daggerok committed Mar 4, 2018
1 parent 803ff88 commit 8cb1bdf
Show file tree
Hide file tree
Showing 49 changed files with 749 additions and 1,556 deletions.
29 changes: 26 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,43 @@ script:
# master-SNAPSHOT
- export sample=jitpackmaster
- cd $root/samples/$sample
- bash gradlew --refresh-dependencies
- bash gradlew #--refresh-dependencies
- bash build/install/$sample/bin/$sample
- bash ./build/install/$sample/bin/$sample trololo

# bintray 0.0.1; JitPack 1.5
- >
for sample in \
bintray001 \
jitpack15 \
; do
export sample=bintray001
cd $root/samples/$sample
bash gradlew
bash gradlew #--refresh-dependencies
bash build/install/$sample/bin/$sample
bash ./build/install/$sample/bin/$sample trololo
bash ./build/install/$sample/bin/$sample $sample
done
cache:
directories:
- $HOME/.m2/wrapper
- $HOME/.m2/repository/ch
- $HOME/.m2/repository/javax
- $HOME/.m2/repository/junit
- $HOME/.m2/repository/org
- $HOME/.m2/repository/codehaus
- $HOME/.m2/repository/apache
- $HOME/.m2/repository/jdom
- $HOME/.m2/repository/ow2
- $HOME/.m2/repository/plugins
- $HOME/.m2/repository/vavr
- $HOME/.gradle/wrapper
- $HOME/.gradle/**/ch/junit
- $HOME/.gradle/**/javax/junit
- $HOME/.gradle/**/junit/junit
- $HOME/.gradle/**/org/**
- $HOME/.gradle/**/codehaus/**
- $HOME/.gradle/**/apache/**
- $HOME/.gradle/**/jdom/**
- $HOME/.gradle/**/ow2/**
- $HOME/.gradle/**/plugins/**
- $HOME/.gradle/**/vavr/**
2 changes: 2 additions & 0 deletions BINTRAY.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= bintray

//tag::content[]
1. register on bintray.com
.2. update gradle.properties
Expand All @@ -21,3 +22,4 @@ links:
. link:https://github.com/bintray/gradle-bintray-plugin
. link:https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle
. link:https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_maven
//end::content[]
2 changes: 2 additions & 0 deletions JITPACK.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= jitpack

//tag::content[]
1. create github release
.2. resolving dependencies with gradle (build.gradle):
Expand Down Expand Up @@ -70,3 +71,4 @@ buildscript {
links:

. link:https://jitpack.io/#daggerok/daggerok-context
//end::content[]
29 changes: 29 additions & 0 deletions MIGRATION.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
= migration

//tag::content[]
JDK 1.4 features

. assert operator `java -ea AssertPractice`
. regular expressions `Pattern.compile(matchObj).matcher(origObj).group()/start()/end()`
. splitting `"a String".split(" ");`
. exception chaining / wrapping

JDK 1.5 features

. autoboxing / autounboxing
. generics
. for-each loop
. vararg (Variable-Length Arguments)
. emun (Enumerations)
. annotations `getClass().getAnnotation()`
. static import `import static java.lang.Math.*;`
. c-lang printf() `new Formatter().format("dec: %d, hexa: %x, char: %c, doub: %1.4f.", 50, 50, 'A', 3.14).toString();`
. Scanner `new Scanner("10 5 3 1") .nextInt()/.hasNextInt()`
. collections (generics) `new ArrayList<Integer>(); new PriorityQueue<Double>()`
. high-performance immutable StringBuilder (replacement of mutable StringBuffer)

links:

. link:https://www.topcoder.com/community/data-science/data-science-tutorials/new-features-of-java-1-5/[JDK 5], link:https://way2java.com/java-versions-2/jdk-1-5-java-se-5-version/[java 1.5 features]
. link:http://www.oracle.com/technetwork/java/javase/adoptionguide-137484.html[JDK 6]
//end::content[]
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//tag::content[]

Simples dependency injection library ever.
Simplest lightly dependency injection library for java ever!
Supported minimal java version: 1.5

TODO: use cases, tests, documentation, usage samples, contribute, jitpack build, etc...
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ buildscript {
javaVersion = "1.5"
vavrVersion = "0.9.2"
reflectionsVersion = "0.9.11"
lombokVersion = "1.16.20"
logbackVersion = "1.2.3"
slf4jVersion = "1.7.25"
junitVersion = "4.12"
Expand Down Expand Up @@ -38,6 +37,10 @@ allprojects {
}
}

compileJava {
options.compilerArgs += ["-Xlint:unchecked"]
}

dependencies {

// Reflections
Expand All @@ -46,10 +49,6 @@ dependencies {
// JSR-330
compile("javax.inject:javax.inject:$injectVersion")

// In java we trust...
compileOnly("org.projectlombok:lombok:$lombokVersion")
testCompileOnly("org.projectlombok:lombok:$lombokVersion")

// Logging
compile("org.slf4j:slf4j-api:$slf4jVersion")
compile("org.slf4j:jul-to-slf4j:$slf4jVersion")
Expand Down
9 changes: 0 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${maven.compiler.target}</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<lombok.version>1.16.20</lombok.version>
<slf4j.version>1.7.25</slf4j.version>
<inject.version>1</inject.version>
<junit.version>4.12</junit.version>
Expand All @@ -37,14 +36,6 @@
<version>${reflections.version}</version>
</dependency>

<!-- In java we trust -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>

<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
24 changes: 3 additions & 21 deletions samples/bintray001/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
buildscript {
ext {
javaVersion = "1.8"
vavrVersion = "0.9.2"
slf4jVersion = "1.7.25"
lombokVersion = "1.16.20"
daggerokContextVersion = "0.0.1"
}
}
Expand All @@ -17,13 +14,6 @@ plugins {
id "com.github.johnrengelman.shadow" version "2.0.2"
}

allprojects {
repositories {
// bintray 1:
maven { url "https://dl.bintray.com/daggerok/daggerok" }
}
}

group = "daggerok"
version = "0.0.1"
sourceCompatibility = targetCompatibility = "$javaVersion"
Expand All @@ -49,22 +39,14 @@ defaultTasks "clean", "build", "installDist", "distZip", "publish"
repositories {
mavenLocal()
mavenCentral()

// bintray 1:
maven { url "https://dl.bintray.com/daggerok/daggerok" }
}

dependencies {
// bintray 2:
compile "com.github.daggerok:daggerok-context:$daggerokContextVersion"

compile "io.vavr:vavr:$vavrVersion"

compile "org.slf4j:slf4j-api:$slf4jVersion"
// compile "org.slf4j:slf4j-jdk14:$slf4jVersion"
compile "org.slf4j:jul-to-slf4j:$slf4jVersion"
compile "org.slf4j:log4j-over-slf4j:$slf4jVersion"
compile "ch.qos.logback:logback-classic:1.2.3"
compileOnly "org.projectlombok:lombok:$lombokVersion"

testCompileOnly("org.projectlombok:lombok:$lombokVersion")
}

task wrapper(type: Wrapper) {
Expand Down
39 changes: 0 additions & 39 deletions samples/bintray001/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<lombok.version>1.16.18</lombok.version>
<slf4j.version>1.7.25</slf4j.version>
<vavr.version>0.9.2</vavr.version>
<daggerok-context.version>0.0.1</daggerok-context.version>
</properties>

Expand All @@ -34,42 +31,6 @@
<artifactId>daggerok-context</artifactId>
<version>${daggerok-context.version}</version>
</dependency>

<dependency>
<groupId>io.vavr</groupId>
<artifactId>vavr</artifactId>
<version>${vavr.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>

<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>

<build>
Expand Down
14 changes: 3 additions & 11 deletions samples/bintray001/src/main/java/daggerok/App.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
package daggerok;

import daggerok.app.Main;
import daggerok.app.mappers.InputMapper;
import daggerok.app.services.CapitalizeService;
import daggerok.app.validators.InputValidator;
import daggerok.context.DaggerokContext;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class App {
public static void main(String[] args) {

final DaggerokContext applicationContext = DaggerokContext.create(App.class.getPackage());

applicationContext.register(InputMapper.class, new InputMapper(applicationContext.getBean(InputValidator.class)))
.register(CapitalizeService.class, new CapitalizeService(applicationContext.getBean(InputMapper.class)))
.injectBeans();
final String name = args.length > 0 ? args[0] : "maksimko!";

final DaggerokContext applicationContext = DaggerokContext.create(App.class.getPackage())
.initialize();
final Main main = applicationContext.getBean(Main.class);

final String name = args.length > 0 ? args[0] : "maksimko!";
main.sayHello(name);
}
}
1 change: 0 additions & 1 deletion samples/bintray001/src/main/java/lombok.config

This file was deleted.

11 changes: 0 additions & 11 deletions samples/bintray001/src/main/resources/logback.xml

This file was deleted.

32 changes: 0 additions & 32 deletions samples/jitpack15/.mvn/Dockerfile

This file was deleted.

Binary file removed samples/jitpack15/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion samples/jitpack15/.mvn/wrapper/maven-wrapper.properties

This file was deleted.

Loading

0 comments on commit 8cb1bdf

Please sign in to comment.